Boost logo

Boost-Commit :

From: lists.drrngrvy_at_[hidden]
Date: 2007-10-26 23:15:04


Author: drrngrvy
Date: 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
New Revision: 40493
URL: http://svn.boost.org/trac/boost/changeset/40493

Log:
Trying SCGI stuff with a compiler (!) - it's really messy at the moment, unfortunately.
Added:
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/acceptor.hpp (contents, props changed)
   sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/scgi/
   sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/scgi/Jamfile.v2 (contents, props changed)
   sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/scgi/basic-1.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_client.hpp | 22 +++--
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_io_object.hpp | 7 +
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request.hpp | 133 +++++++++++++++++++++------------------
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request_acceptor.hpp | 8 +-
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi.hpp | 4
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/protocol_traits.hpp | 35 ++++++---
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/header.hpp | 12 +--
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider.hpp | 5
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_ostream.hpp | 19 +++--
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_service.hpp | 33 ++++++---
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/response.hpp | 14 ++--
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi.hpp | 13 ++-
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/acceptor_service_impl.hpp | 122 ++++++++++++++++++++----------------
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/client.hpp | 18 +++-
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request.hpp | 15 +++-
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_acceptor_service.hpp | 15 ++--
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_impl.hpp | 19 ++++
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_service.hpp | 97 +++++++++++++++++++++-------
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/scgi.hpp | 2
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/tags.hpp | 4 +
   sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/cgi/Jamfile.v2 | 4
   sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/util/system/Jamfile.v2 | 2
   22 files changed, 367 insertions(+), 236 deletions(-)

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_client.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_client.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -37,31 +37,35 @@
    * clients aware of how busy the connection is and size its output packets
    * accordingly... But I'm not doing that.
    */
- template<typename Connection>
+ template<typename Connection, typename Protocol>
   class basic_client
   {
   public:
- typedef cgi::map map_type;
- typedef Protocol protocol_type;
+ //typedef cgi::map map_type;
     typedef Connection connection_type;
+ typedef Protocol protocol_type;
     typedef typename connection_type::pointer connection_ptr;
 
- basic_client(cgi::io_service& ios)
- : io_service_(ios)
+ basic_client()
+ {
+ }
+
+ basic_client(io_service& ios)
+ //: io_service_(ios)
     {
     }
 
- io_service& io_service() { return io_service_; }
+ //io_service& io_service() { return io_service_; }
 
     /// Associate a connection with this client
     /**
      * Note: the connection must have been created using the new operator
      */
- bool set_connection(connection_type* conn)
+ bool set_connection(typename connection_type::pointer& conn)
     {
       // make sure there isn't already a connection associated with the client
       if (!connection_) return false;
- connection_.reset(conn);
+ connection_ = conn;
       return true;
     }
 
@@ -98,7 +102,7 @@
       connection_->async_read_some(buf, handler);
     }
   private:
- io_service& io_service_;
+ //io_service& io_service_;
     connection_ptr connection_;
   };
 

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_io_object.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_io_object.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_io_object.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -21,16 +21,17 @@
   public:
     typedef Service service_type;
 
- cgi::io_service& io_service()
+ ::cgi::io_service&
+ io_service()
     {
       return service.io_service();
     }
 
   private:
- typedef typename Service::impl_type impl_type;
+ typedef typename Service::implementation_type impl_type;
 
   protected:
- explicit basic_io_object(boost::asio::io_service& ios)
+ explicit basic_io_object(::cgi::io_service& ios)
       : service(boost::asio::use_service<Service>(ios))
     {
       service.construct(impl);

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -75,7 +75,8 @@
   {
   public:
     typedef basic_request<RequestService, ProtocolService
- , Role, Allocator > type;
+ , Role, Allocator > type;
+ typedef ::cgi::map map_type;
     typedef RequestService service_type;
     typedef typename service_type::protocol_type protocol_type;
     typedef ProtocolService protocol_service_type;
@@ -221,12 +222,14 @@
      *
      * Set the output sink as `stdout_`, `stderr_`, or `stdout_ | stderr_`
      */
+ /*
     void set_output(cgi::sink dest = stdout_)
     {
       boost::system::error_code ec;
       this->service(this->impl, dest, ec);
       detail::throw_error(ec);
     }
+ */
 
     /// Set the output for the request
     /**
@@ -234,13 +237,16 @@
      *
      * Set the output sink as `stdout_`, `stderr_`, or `stdout_ | stderr_`
      */
+ /*
     void set_output(cgi::sink dest, boost::system::error_code& ec)
     {
       this->service(this->impl, dest, ec);
     }
+ */
 
+/*
     /// Read some data from the client
- template<typename MutableBufferSequence/*, typename Source*/>
+ template<typename MutableBufferSequence>
     std::size_t read_some(const MutableBufferSequence& buf)
     {
       boost::system::error_code ec;
@@ -250,7 +256,7 @@
     }
 
     /// Read some data from the client
- template<typename MutableBufferSequence/*, typename Source*/>
+ template<typename MutableBufferSequence, typename Source>
     std::size_t read_some(const MutableBufferSequence& buf
                          , boost::system::error_code& ec)
     {
@@ -261,8 +267,8 @@
     /**
      * Note: on the first write, the header block is closed (with a blank
      * line).
- */
- template<typename ConstBufferSequence/*, typename Sink*/>
+ *
+ template<typename ConstBufferSequence, typename Sink>
     std::size_t write_some(const ConstBufferSequence& buf)
     {
       boost::system::error_code ec;
@@ -275,18 +281,19 @@
     /**
      * Note: on the first write, the header block is closed (with a blank
      * line).
- */
- template<typename ConstBufferSequence/*, typename Sink*/>
+ *
+ template<typename ConstBufferSequence, typename Sink>
     std::size_t write_some(const ConstBufferSequence& buf
                           , boost::system::error_code& ec)
     {
       return this->service.write_some(this->impl, buf, ec);
     }
+*/
 
     /// Get a `cgi::map&` corresponding to all of the GET variables
- cgi::map& get_()
+ map_type& GET()
     {
- return this->service.meta_get(this->impl);
+ return this->service.GET(this->impl);
     }
 
     /// Find the get meta-variable matching name
@@ -295,10 +302,10 @@
      * fail with `cgi::error::request_aborted` if the request has been aborted
      * by the client.
      */
- std::string get_(const std::string& name)
+ std::string GET(const std::string& name)
     {
       boost::system::error_code ec;
- std::string ret = this->service.meta_get(this->impl, name, ec);
+ std::string ret = this->service.GET(this->impl, name, ec);
       detail::throw_error(ec);
       return ret;
     }
@@ -309,15 +316,15 @@
      * fail with `ec == cgi::error::request_aborted` if the request has been
      * aborted by the client.
      */
- std::string get_(const std::string& name, boost::system::error_code& ec)
+ std::string GET(const std::string& name, boost::system::error_code& ec)
     {
- return this->service.meta_get(this->impl, name, ec);
+ return this->service.GET(this->impl, name, ec);
     }
 
     /// Get a `cgi::map&` corresponding to all of the POST variables
- cgi::map& post_()
+ map_type& POST()
     {
- return this->service.meta_post(this->impl);
+ return this->service.POST(this->impl);
     }
 
     /// Find the post meta-variable matching name
@@ -330,10 +337,10 @@
      * fail with `cgi::error::request_aborted` if the request has been aborted
      * by the client.
      */
- std::string post_(const std::string& name, bool greedy = true)
+ std::string POST(const std::string& name, bool greedy = true)
     {
       boost::system::error_code ec;
- std::string ret = this->service.meta_post(this->impl, name, ec, greedy);
+ std::string ret = this->service.POST(this->impl, name, ec, greedy);
       detail::throw_error(ec);
       return ret;
     }
@@ -343,16 +350,16 @@
      * fail with `ec == cgi::error::request_aborted` if the request has been
      * aborted by the client.
      */
- std::string post_(const std::string& name, boost::system::error_code& ec
+ std::string POST(const std::string& name, boost::system::error_code& ec
                           , bool greedy = true)
     {
- return this->service.meta_post(this->impl, name, ec, greedy);
+ return this->service.POST(this->impl, name, ec, greedy);
     }
 
     /// Get a `cgi::map&` corresponding to all of the form variables
- cgi::map& form_()
+ map_type& form()
     {
- return this->service.meta_form(this->impl);
+ return this->service.form(this->impl);
     }
 
     /// Find the form variable matching name
@@ -364,10 +371,10 @@
      * fail with `cgi::error::request_aborted` if the request has been aborted
      * by the client.
      */
- std::string form_(const std::string& name, bool greedy = true)
+ std::string form(const std::string& name, bool greedy = true)
     {
       boost::system::error_code ec;
- std::string ret = form_(name, ec, greedy);
+ std::string ret = form(name, ec, greedy);
       detail::throw_error(ec);
       return ret;
     }
@@ -377,23 +384,23 @@
      * fail with `ec == cgi::error::request_aborted` if the request has been
      * aborted by the client.
      */
- std::string form_(const std::string& name, boost::system::error_code& ec
+ std::string form(const std::string& name, boost::system::error_code& ec
                          , bool greedy = true)
     {
       std::string rm(request_method());
       if (rm == "GET")
- return this->service.meta_get(this->impl, name, ec);
+ return this->service.GET(this->impl, name, ec);
       else
       if (rm == "POST")
- return this->service.meta_post(this->impl, name, ec, greedy);
+ return this->service.POST(this->impl, name, ec, greedy);
       else
         return "";
     }
 
     /// Get a `cgi::map&` corresponding to all of the HTTP_COOKIE variables
- cgi::map& cookie_()
+ map_type& cookie()
     {
- return this->service.meta_cookie(this->impl);
+ return this->service.cookie(this->impl);
     }
 
     /// Find the cookie meta-variable matching name
@@ -402,7 +409,7 @@
      * fail with `cgi::error::request_aborted` if the request has been aborted
      * by the client.
      */
- std::string cookie_(const std::string& name)
+ std::string cookie(const std::string& name)
     {
       boost::system::error_code ec;
       std::string ret = this->service.cookie(this->impl, name, ec);
@@ -416,15 +423,15 @@
      * fail with `ec == cgi::error::request_aborted` if the request has been
      * aborted by the client.
      */
- std::string cookie_(const std::string& name, boost::system::error_code& ec)
+ std::string cookie(const std::string& name, boost::system::error_code& ec)
     {
       return this->service.cookie(this->impl, name, ec);
     }
 
     /// Get a `cgi::map&` corresponding to all of the environment variables
- cgi::map& env_()
+ map_type& env()
     {
- return this->service.meta_env(this->impl);
+ return this->service.env(this->impl);
     }
 
     /// Find the environment meta-variable matching name
@@ -433,10 +440,10 @@
      * fail with `cgi::error::request_aborted` if the request has been aborted
      * by the client.
      */
- std::string env_(const std::string& name)
+ std::string env(const std::string& name)
     {
       boost::system::error_code ec;
- std::string ret = this->service.meta_env(this->impl, name, ec);
+ std::string ret = this->service.env(this->impl, name, ec);
       detail::throw_error(ec);
       return ret;
     }
@@ -447,9 +454,9 @@
      * fail with `ec == cgi::error::request_aborted` if the request has been
      * aborted by the client.
      */
- std::string env_(const std::string& name, boost::system::error_code& ec)
+ std::string env(const std::string& name, boost::system::error_code& ec)
     {
- return this->service.meta_env(this->impl, name, ec);
+ return this->service.env(this->impl, name, ec);
     }
 
     /// Search through all meta vars for the meta-variable matching name
@@ -466,11 +473,11 @@
      * provide a meta_var_all() function which is greedy; the
      * ugly/long name there to discourage use.
      */
- std::string var_(const std::string& name, bool greedy = false)
+ std::string var(const std::string& name, bool greedy = false)
     {
       boost::system::error_code ec;
- std::string ret = var_(name, ec, greedy);
- return this->service.meta_var(this->impl, name, greedy);
+ std::string ret = var(name, ec, greedy);
+ return this->service.var(this->impl, name, greedy);
       std::string request_method( env_("REQUEST_METHOD") );
 
       std::string tmp;
@@ -478,81 +485,81 @@
       // If it's not a POST request search meta_get first (to save time)
       if (request_method.empty() || request_method == "GET")
       {
- tmp = get_(name);
+ tmp = GET(name);
         if (!tmp.empty())
           return tmp;
       }
 
- tmp = cookie_(name);
+ tmp = cookie(name);
       if (!tmp.empty())
               return tmp;
 
- tmp = env_(name);
+ tmp = env(name);
       if (!tmp.empty())
               return tmp;
 
       if (!request_method.empty() && request_method == "POST")
       {
- tmp = post_(name);
+ tmp = POST(name);
         if (!tmp.empty())
           return tmp;
       }
 
- tmp = get_(name);
+ tmp = GET(name);
       return tmp.empty() ? "" : tmp;
     }
 
     // Some helper functions for the basic CGI 1.1 meta-variables
     std::string auth_type()
- { return env_("AUTH_TYPE"); }
+ { return env("AUTH_TYPE"); }
 
     std::string content_length()
- { return env_("CONTENT_LENGTH"); }
+ { return env("CONTENT_LENGTH"); }
 
     std::string content_type()
- { return env_("CONTENT_TYPE"); }
+ { return env("CONTENT_TYPE"); }
 
     std::string gateway_interface()
- { return env_("GATEWAY_INTERFACE"); }
+ { return env("GATEWAY_INTERFACE"); }
 
     std::string path_info()
- { return env_("PATH_INFO"); }
+ { return env("PATH_INFO"); }
 
     std::string path_translated()
- { return env_("PATH_TRANSLATED"); }
+ { return env("PATH_TRANSLATED"); }
 
     std::string query_string()
- { return env_("QUERY_STRING"); }
+ { return env("QUERY_STRING"); }
 
     std::string remote_addr()
- { return env_("REMOTE_ADDR"); }
+ { return env("REMOTE_ADDR"); }
 
     std::string remote_host()
- { return env_("REMOTE_HOST"); }
+ { return env("REMOTE_HOST"); }
 
     std::string remote_ident()
- { return env_("REMOTE_IDENT"); }
+ { return env("REMOTE_IDENT"); }
 
     std::string remote_user()
- { return env_("REMOTE_USER"); }
+ { return env("REMOTE_USER"); }
 
     std::string request_method()
- { return env_("REQUEST_METHOD"); }
+ { return env("REQUEST_METHOD"); }
 
     std::string script_name()
- { return env_("SCRIPT_NAME"); }
+ { return env("SCRIPT_NAME"); }
 
     std::string server_name()
- { return env_("SERVER_NAME"); }
+ { return env("SERVER_NAME"); }
 
     std::string server_port()
- { return env_("SERVER_PORT"); }
+ { return env("SERVER_PORT"); }
 
     std::string server_protocol()
- { return env_("SERVER_PROTOCOL"); }
+ { return env("SERVER_PROTOCOL"); }
 
     std::string server_software()
- { return env_("SERVER_SOFTWARE"); }
+ { return env("SERVER_SOFTWARE"); }
 
 
     /// The role that the request is playing
@@ -591,8 +598,10 @@
     }
 
     /// Get the client connection associated with the request
+ /**
+ * You use the client for read/write calls. Y
     typename implementation_type::connection_type&
- client()
+ client()
     {
       return this->service.client(this->impl);
     }

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request_acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request_acceptor.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request_acceptor.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -13,20 +13,20 @@
 #include <boost/system/error_code.hpp>
 
 #include <boost/asio/basic_io_object.hpp>
-#include "boost/detail/throw_error.hpp"
+#include "boost/cgi/detail/throw_error.hpp"
 
 namespace cgi {
 
   /// The interface class for any *cgi::acceptor.
   template<typename RequestAcceptorService>
   class basic_request_acceptor
- : private boost::noncopyable
- , public boost::asio::basic_io_object<RequestAcceptorService>
+ : public boost::asio::basic_io_object<RequestAcceptorService>
+ //, private boost::noncopyable
   {
   public:
     // typedef impl_type;
     typedef RequestAcceptorService service_type;
- typedef service_type::protocol_type protocol_type;
+ typedef typename service_type::protocol_type protocol_type;
     typedef int port_number_type;
 
     explicit basic_request_acceptor(basic_protocol_service<protocol_type>& ps)

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -10,8 +10,8 @@
 #define CGI_CGI_HPP_INCLUDED__
 
 // Include all cgi-related headers only.
-#include "boost/cgi/request.hpp"
-#include "boost/cgi/service.hpp"
+#include "boost/cgi/cgi/request.hpp"
+#include "boost/cgi/cgi/service.hpp"
 
 // Include headers common to all protocols
 #include "boost/cgi/detail/common_headers.hpp"

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/protocol_traits.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/protocol_traits.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/protocol_traits.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -16,42 +16,49 @@
 
 namespace cgi {
 
+ namespace cgi {}
+ namespace acgi {}
+ namespace fcgi {}
+ namespace scgi
+ {
+ class scgi_request_impl;
+ class scgi_service_impl;
+ class scgi_gateway_impl;
+ class scgi_gateway_service;
+ class scgi_request_service;
+ class scgi_acceptor_service;
+ }
+
   // Forward declarations
 
   class cgi_request_impl;
   class acgi_request_impl;
   class async_cgi_request_impl;
   class fcgi_request_impl;
- class scgi_request_impl;
 
   //template<typename>
   class cgi_service_impl;
   class acgi_service_impl;
   class async_cgi_service_impl;
   class fcgi_service_impl;
- class scgi_service_impl;
 
   class cgi_gateway_impl;
   class acgi_gateway_impl;
   class async_cgi_gateway_impl;
   class fcgi_gateway_impl;
- class scgi_gateway_impl;
 
   class cgi_gateway_service;
   class acgi_gateway_service;
   class async_cgi_gateway_service;
   class fcgi_gateway_service;
- class scgi_gateway_service;
   template<typename> class gateway_service;
 
   class acgi_acceptor_service;
- class scgi_acceptor_service;
   class fcgi_acceptor_service;
 
   class cgi_request_service;
   class acgi_request_service;
   class fcgi_request_service;
- class scgi_request_service;
 
  namespace detail {
 
@@ -63,6 +70,7 @@
     template<>
     struct protocol_traits<tags::cgi>
     {
+ typedef protocol_traits<tags::cgi> type;
       typedef cgi_request_impl impl_type;
       typedef cgi_request_service request_service_type;
       typedef basic_protocol_service<tags::cgi> protocol_service_type;
@@ -77,6 +85,7 @@
     template<>
     struct protocol_traits<tags::async_cgi>
     {
+ typedef protocol_traits<tags::async_cgi> type;
       typedef async_cgi_request_impl impl_type;
       typedef acgi_request_service request_service_type;
       typedef basic_protocol_service<tags::acgi> protocol_service_type;
@@ -107,6 +116,7 @@
     template<>
     struct protocol_traits<tags::fcgi>
     {
+ typedef protocol_traits<tags::fcgi> type;
       typedef fcgi_request_impl impl_type;
       typedef fcgi_request_service request_service_type;
       typedef basic_protocol_service<tags::fcgi> protocol_service_type;
@@ -121,16 +131,17 @@
     template<>
     struct protocol_traits<tags::scgi>
     {
- typedef scgi_request_impl impl_type;
- typedef scgi_request_service request_service_type;
+ typedef protocol_traits<tags::scgi> type;
+ typedef scgi::scgi_request_impl impl_type;
+ typedef scgi::scgi_request_service request_service_type;
       typedef basic_protocol_service<tags::scgi> protocol_service_type;
       typedef basic_request<request_service_type, protocol_service_type>
                                                      request_type;
- typedef scgi_service_impl service_impl_type;
- typedef scgi_acceptor_service acceptor_service_impl;
+ typedef scgi::scgi_service_impl service_impl_type;
+ typedef scgi::scgi_acceptor_service acceptor_service_impl;
       typedef basic_connection<tags::tcp_socket> connection_type;
- typedef scgi_gateway_impl gateway_impl_type;
- typedef scgi_gateway_service gateway_service_type;
+ //typedef scgi_gateway_impl gateway_impl_type;
+ //typedef scgi_gateway_service gateway_service_type;
     };
 
  } // namespace detail

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/header.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/header.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/header.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -21,7 +21,11 @@
     }
 
     /// Templated constructor to allow user-defined types to be converted
- template<typename T> header(T& t);
+ template<typename T>
+ header::header(T& t)
+ : content(t.to_string())
+ {
+ }
 
     header(const std::string& name, const std::string& val)
       : content(name + ": " + val + "\r\n")
@@ -42,12 +46,6 @@
     return header("Location", url);
   }
 
- inline template<>
- header::header(cookie& ck)
- : content(ck.to_string())
- {
- }
-
 } // namespace cgi
 
 #endif // CGI_HEADER_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -53,7 +53,8 @@
     {
     }
 
- cgi::io_service& get_io_service()
+ ::cgi::io_service&
+ get_io_service()
     {
       return io_service_;
     }
@@ -73,7 +74,7 @@
       io_service_.reset();
     }
   private:
- cgi::io_service io_service_;
+ ::cgi::io_service io_service_;
   };
 
 

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_ostream.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_ostream.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_ostream.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -77,7 +77,7 @@
   public:
     /// Default constructor
     request_ostream(http::status_code sc = http::ok)
- : buffer_(new cgi::streambuf())
+ : buffer_(new ::cgi::streambuf())
       , ostream_(buffer_.get())
       , http_status_(sc)
       , headers_sent_(false)
@@ -89,7 +89,7 @@
      * Takes the buffer and uses it internally, does nothing with it on
      * destruction.
      */
- request_ostream(cgi::streambuf* buf, http::status_code sc = http::ok)
+ request_ostream(::cgi::streambuf* buf, http::status_code sc = http::ok)
       : /*request_(NULL)
           , */ostream_(buf)
       , http_status_(sc)
@@ -180,8 +180,8 @@
      * If there is no error, the buffer is cleared.
      */
     template<typename CommonGatewayRequest>
- boost::system::error_code& flush(CommonGatewayRequest& req
- , boost::system::error_code& ec)
+ boost::system::error_code&
+ flush(CommonGatewayRequest& req, boost::system::error_code& ec)
     {
       if (!headers_sent_)
       {
@@ -287,8 +287,8 @@
      * Note: The data in the stream isn't cleared after this call.
      */
     template<typename CommonGatewayRequest>
- boost::system::error_code& send(CommonGatewayRequest& req
- , boost::system::error_code& ec)
+ boost::system::error_code&
+ send(CommonGatewayRequest& req, boost::system::error_code& ec)
     {
       if (!headers_sent_)
       {
@@ -317,9 +317,10 @@
     }
 
     /// Get the buffer associated with the stream
- cgi::streambuf* rdbuf()
+ ::cgi::streambuf*
+ rdbuf()
     {
- return static_cast<cgi::streambuf*>(ostream_.rdbuf());
+ return static_cast<::cgi::streambuf*>(ostream_.rdbuf());
     }
 
     void set_status(const http::status_code& num)
@@ -334,7 +335,7 @@
 
   protected:
     std::vector<boost::asio::const_buffer> headers_;
- boost::shared_ptr<cgi::streambuf> buffer_;
+ boost::shared_ptr<::cgi::streambuf> buffer_;
     std::ostream ostream_;
     http::status_code http_status_;
     bool headers_sent_;

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_service.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -85,8 +85,8 @@
 
     //void construct
 
- boost::system::error_code& load(impl_type& impl, bool parse_stdin
- , boost::system::error_code& ec)
+ boost::system::error_code&
+ load(impl_type& impl, bool parse_stdin, boost::system::error_code& ec)
     {
       return service_impl_.load(impl, parse_stdin, ec);
     }
@@ -104,13 +104,13 @@
     }
 
     boost::system::error_code&
- set_header(impl_type& impl, const std::string& name
- , const std::string& value, boost::system::error_code& ec)
+ set_header(impl_type& impl, const std::string& name
+ , const std::string& value, boost::system::error_code& ec)
     {
       return service_impl_.set_header(impl, name, value, ec);
     }
       
-
+/*
     template<typename ConstBufferSequence>
     std::size_t write_some(impl_type& impl, const ConstBufferSequence& buf
                           , boost::system::error_code& ec)
@@ -124,25 +124,34 @@
     {
       return service_impl_.read_some(impl, buf, ec);
     }
-
- std::string meta_get(impl_type& impl, const std::string& name
- , boost::system::error_code& ec)
+*/
+ std::string
+ GET(impl_type& impl, const std::string& name
+ , boost::system::error_code& ec)
     {
       return service_impl_.meta_get(impl, name, ec);
     }
 
- std::string meta_post(impl_type& impl, const std::string& name
- , boost::system::error_code& ec)
+ std::string
+ POST(impl_type& impl, const std::string& name
+ , boost::system::error_code& ec)
     {
       return service_impl_.meta_post(impl, name, ec);
     }
 
- std::string cookie(impl_type& impl, const std::string& name
- , boost::system::error_code& ec)
+ std::string
+ cookie(impl_type& impl, const std::string& name
+ , boost::system::error_code& ec)
     {
       return service_impl_.cookie(impl, name, ec);
     }
 
+ std::string
+ header(impl_type& impl, const std::string& name
+ , boost::system::error_code& ec)
+ {
+ }
+
   private:
     service_impl_type& service_impl_;
   };

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/response.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/response.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/response.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -26,16 +26,16 @@
 
 
   class response
- : public cgi::request_ostream
+ : public request_ostream
   {
   public:
     response(http::status_code sc = http::ok)
- : cgi::request_ostream(sc)
+ : request_ostream(sc)
     {
     }
 
- response(cgi::streambuf* buf, http::status_code sc = http::ok)
- : cgi::request_ostream(buf, sc)
+ response(::cgi::streambuf* buf, http::status_code sc = http::ok)
+ : request_ostream(buf, sc)
     {
     }
 
@@ -77,13 +77,13 @@
     return resp<< hdr.content;
   }
 
- template<>
- response& operator<<(response& resp, const cookie& ck)
+ template<typename T>
+ response& operator<<(response& resp, const basic_cookie<T>& ck)
   {
     // Note: the 'set-cookie' isn't part of the cookie object since
     // the cookie can also be set after the headers have been sent.
     // See http://tinyurl.com/33znkj
- return resp<< "Set-cookie: " << ck << "\r\n";
+ return resp<< "Set-cookie: " << ck.to_string() << "\r\n";
   }
 
 } // namespace cgi

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -9,12 +9,14 @@
 #ifndef CGI_SCGI_HPP_INCLUDED__
 #define CGI_SCGI_HPP_INCLUDED__
 
-// #include all scgi-related headers only
-#include "scgi/service.hpp"
-#include "scgi/request_service.hpp"
-#include "scgi/request_acceptor_service.hpp"
-#include "detail/common_headers.hpp"
+// #include headers for SCGI use.
+#include "boost/cgi/scgi/service.hpp"
+#include "boost/cgi/scgi/acceptor.hpp"
+#include "boost/cgi/scgi/request_service.hpp"
+#include "boost/cgi/scgi/request_acceptor_service.hpp"
+#include "boost/cgi/detail/common_headers.hpp"
 
+/*
 namespace cgi {
 
   typedef basic_request_acceptor<scgi_request_acceptor_service> scgi_acceptor;
@@ -24,5 +26,6 @@
 # endif
 
 } // namespace cgi
+*/
 
 #endif // CGI_SCGI_HPP_INCLUDED__

Added: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/acceptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/acceptor.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,24 @@
+// -- scgi/acceptor.hpp --
+//
+// Copyright (c) Darren Garvey 2007.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+////////////////////////////////////////////////////////////////
+#ifndef CGI_SCGI_ACCEPTOR_HPP_INCLUDED__
+#define CGI_SCGI_ACCEPTOR_HPP_INCLUDED__
+
+#include "boost/cgi/basic_request_acceptor.hpp"
+#include "boost/cgi/scgi/request_acceptor_service.hpp"
+
+namespace cgi {
+ namespace scgi {
+
+ /// Typedef for common usage (SCGI)
+ typedef basic_request_acceptor<scgi_request_acceptor_service<> > acceptor;
+
+ } // namespace scgi
+} // namespace cgi
+
+#endif // CGI_SCGI_ACCEPTOR_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/acceptor_service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/acceptor_service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/acceptor_service_impl.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -13,8 +13,10 @@
 
 #include <boost/ref.hpp>
 #include <boost/bind.hpp>
+#include <boost/asio.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/utility/enable_if.hpp>
+#include <boost/system/error_code.hpp>
 
 //#include "is_async.hpp"
 #include "boost/cgi/io_service.hpp"
@@ -23,62 +25,73 @@
 #include "boost/cgi/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/detail/service_base.hpp"
 //#include "service_selector.hpp"
+#include "boost/cgi/scgi/request.hpp"
 
 namespace cgi {
-
- /// The service_impl class for SCGI basic_request_acceptor<>s
- /**
- * Note: this is near enough to being generic. It will hopefully translate
- * directly to the fcgi_acceptor_service_impl. In other words you would
- * then have one acceptor_service_impl<>, so you'd use
- * acceptor_service_impl<scgi> acceptor_service_impl_; // and
- * acceptor_service_impl<fcgi> acceptor_service_impl_; // etc...
- *
- * Note: If the protocol is an asynchronous protocol, which means it requires
- * access to a boost::asio::io_service instance, then this class becomes a
- * model of the Service concept (**LINK**) and must only use the constructor
- * which takes a ProtocolService (**LINK**). If the protocol isn't async then
- * the class can be used without a ProtocolService.
- */
- template<typename Protocol>
- class scgi_acceptor_service_impl
- : public detail::service_base<request_service<Protocol> >
- {
- public:
- //typedef scgi_request_acceptor_impl implementation_type;
- typedef typename implementation_type::protocol_type protocol_type;
- typedef basic_protocol_service<protocol_type> protocol_service_type;
- typedef boost::asio::ip::tcp native_protocol_type;
- typedef acceptor_service_type::native_type native_type;
- typedef implementation_type::acceptor_service_type acceptor_service_type;
-
- /// The unique service identifier
- //static boost::asio::io_service::id id;
-
- struct implementation_type
- {
- typedef Protocol protocol_type;
- typedef scgi::request request_type;
- typedef boost::asio::socket_acceptor_service<
- native_protocol_type> acceptor_service_type;
-
- acceptor_service_type::implementation_type acceptor_;
- boost::mutex mutex_;
- std::queue<boost::shared_ptr<request_type> > waiting_requests_;
- protocol_service_type* service_;
- };
-
- explicit scgi_request_acceptor_service(cgi::io_service& ios)
- : detail::service_base<request_service<Protocol> >(ios)
- , acceptor_service_(boost::asio::use_service<acceptor_service_type>(ios)
- {
- }
-
- void set_protocol_service(implementation_type& impl
- , protocol_service_type& ps)
- {
- impl.protocol_service_ = &ps;
- }
+ namespace scgi {
+
+ /// The service_impl class for SCGI basic_request_acceptor<>s
+ /**
+ * Note: this is near enough to being generic. It will hopefully translate
+ * directly to the fcgi_acceptor_service_impl. In other words you would
+ * then have one acceptor_service_impl<>, so you'd use
+ * acceptor_service_impl<scgi> acceptor_service_impl_; // and
+ * acceptor_service_impl<fcgi> acceptor_service_impl_; // etc...
+ *
+ * Note: If the protocol is an asynchronous protocol, which means it requires
+ * access to a boost::asio::io_service instance, then this class becomes a
+ * model of the Service concept (**LINK**) and must only use the constructor
+ * which takes a ProtocolService (**LINK**). If the protocol isn't async then
+ * the class can be used without a ProtocolService.
+ */
+ template<typename Protocol = ::cgi::scgi_>
+ class acceptor_service_impl
+ : public detail::service_base<request_service<Protocol> >
+ {
+ public:
+
+ /// The unique service identifier
+ //static boost::asio::io_service::id id;
+
+ struct implementation_type
+ {
+ typedef Protocol protocol_type;
+ typedef basic_protocol_service<protocol_type> protocol_service_type;
+ typedef boost::asio::ip::tcp native_protocol_type;
+ typedef scgi::request request_type;
+ typedef boost::asio::socket_acceptor_service<
+ native_protocol_type> acceptor_service_type;
+
+ acceptor_service_type::implementation_type acceptor_;
+ boost::mutex mutex_;
+ std::queue<boost::shared_ptr<request_type> > waiting_requests_;
+ protocol_service_type* service_;
+ };
+
+ //typedef scgi_request_acceptor_impl implementation_type;
+ typedef acceptor_service_impl<Protocol> type;
+ typedef typename type::implementation_type::protocol_type
+ protocol_type;
+ typedef typename type::implementation_type::protocol_service_type
+ protocol_service_type;
+ typedef typename type::implementation_type::acceptor_service_type
+ acceptor_service_type;
+ typedef typename type::implementation_type::native_protocol_type
+ native_protocol_type;
+ typedef typename acceptor_service_type::native_type native_type;
+ //typedef typename acceptor_service_type::native_type native_type;
+
+ explicit acceptor_service_impl(::cgi::io_service& ios)
+ : detail::service_base<request_service<Protocol> >(ios)
+ , acceptor_service_(boost::asio::use_service<acceptor_service_type>(ios))
+ {
+ }
+
+ void set_protocol_service(implementation_type& impl
+ , protocol_service_type& ps)
+ {
+ impl.protocol_service_ = &ps;
+ }
 
     protocol_service_type&
       get_protocol_service(implementation_type& impl)
@@ -180,6 +193,7 @@
     acceptor_service_type& acceptor_service_;
   };
 
+ } // namespace scgi
 } // namespace cgi
 
 #include "boost/cgi/detail/pop_options.hpp"

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/client.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/client.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -17,20 +17,25 @@
  namespace scgi {
 
   /// A client that uses a TCP socket that owned by it.
- template<>
+ template<typename Connection>
   class basic_client<tcp_connection>
   {
   public:
     typedef ::cgi::io_service io_service_type;
     typedef cgi::map map_type;
- typedef Protocol protocol_type;
+ //typedef Protocol protocol_type;
     struct connection_type : Connection
     { typedef boost::shared_ptr<connection_type> pointer; }
 
     /// Construct
+ basic_client()
+ {
+ }
+
+ /// Construct
     basic_client(io_service_type& ios)
- : io_service_(ios)
- , connection_(new connection_type::pointer(ios))
+ //: io_service_(ios)
+ //, connection_(new connection_type::pointer(ios))
     {
     }
 
@@ -38,10 +43,11 @@
     /** Closing the connection as early as possible is good for efficiency */
     ~basic_client()
     {
- connection_->close();
+ if (connection_)
+ connection_->close();
     }
 
- io_service_type& io_service() { return io_service_; }
+ //io_service_type& io_service() { return io_service_; }
 
     /// Associate a connection with this client
     /**

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -10,18 +10,23 @@
 #define CGI_SCGI_REQUEST_HPP_INCLUDED__
 
 #include "boost/cgi/tags.hpp"
-#include "boost/cgi/basic_request.hpp"
-
+#include "boost/cgi/basic_request_fwd.hpp"
+#include "boost/cgi/request_service_fwd.hpp"
+#include "boost/cgi/scgi/request_service.hpp"
+#include "boost/cgi/scgi/service.hpp"
 namespace cgi {
 
- class scgi_request_service;
+ //class scgi::scgi_request_service;
 
- typedef basic_request<scgi_request_service> scgi_request;
+ // This is deprecated/obsolete
+ //typedef basic_request<scgi::scgi_request_service> scgi_request;
 
  namespace scgi {
    // typedef for typical usage (SCGI)
- typedef basic_request<scgi_request_service> request;
+ typedef basic_request<scgi_request_service, service> request;
  } // namespace scgi
 } // namespace cgi
 
+#include "boost/cgi/basic_request.hpp"
+
 #endif // CGI_SCGI_REQUEST_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_acceptor_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_acceptor_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_acceptor_service.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -19,6 +19,7 @@
 #include "boost/cgi/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/detail/service_base.hpp"
 //#include "service_selector.hpp"
+#include "boost/cgi/scgi/acceptor_service_impl.hpp"
 
 namespace cgi {
 
@@ -30,22 +31,22 @@
    * which takes a ProtocolService (**LINK**). If the protocol isn't async then
    * the class can be used without a ProtocolService.
    */
- template<typename Protocol>
+ template<typename Protocol = scgi_>
   class scgi_request_acceptor_service
     : public detail::service_base<request_service<Protocol> >
   {
   public:
     //typedef typename service_impl_type::impl_type impl_type;
 
- typedef scgi_acceptor_service_impl service_impl_type;
+ typedef scgi::acceptor_service_impl<> service_impl_type;
     typedef service_impl_type::implementation_type implementation_type;
- typedef implementation_type::protocol_type protocol_type;
+ typedef typename implementation_type::protocol_type protocol_type;
     typedef basic_protocol_service<protocol_type> protocol_service_type;
 
     /// The unique service identifier
     //static boost::asio::io_service::id id;
 
- scgi_request_acceptor_service(cgi::io_service& ios)
+ scgi_request_acceptor_service(::cgi::io_service& ios)
       : detail::service_base<request_service<Protocol> >(ios)
     {
     }
@@ -76,9 +77,9 @@
     }
 
     template<typename CommonGatewayRequest>
- boost::system::error_code& accept(implementation_type& impl
- , CommonGatewayRequest& request
- , boost::system::error_code& ec)
+ boost::system::error_code&
+ accept(implementation_type& impl, CommonGatewayRequest& request
+ , boost::system::error_code& ec)
     {
       return service_impl_.accept(impl, request, ec);
     }

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_impl.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -17,15 +17,27 @@
 #include "boost/cgi/http/status_code.hpp"
 #include "boost/cgi/connections/tcp_socket.hpp"
 
+/**************
+ *
+ * THIS FILE IS OBSOLETE.
+ *
+ * SEE request_service.hpp:cgi::scgi::scgi_request_service::implementation_type
+ * INSTEAD.
+ *
+**************/
+
 namespace cgi {
+ namespace scgi {
 
+
   /// The implementation_type for scgi_request_service
   class scgi_request_impl
   {
   public:
- typedef cgi::map map_type;
- typedef tcp_connection connection_type;
- typedef connection_type::pointer connection_ptr;
+ typedef cgi::map map_type;
+ typedef tcp_connection connection_type;
+ typedef connection_type::pointer connection_ptr;
+ typedef ::cgi::basic_client<connection_type> client_type;
 
     scgi_request_impl()
       : stdin_parsed_(false)
@@ -62,6 +74,7 @@
     bool request_finished_;
   };
 
+ } // namespace scgi
 } // namespace cgi
 
 #endif // CGI_SCGI_REQUEST_IMPL_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/request_service.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -11,29 +11,65 @@
 
 #include <boost/system/error_code.hpp>
 
-#include "boost/cgi/scgi/request_impl.hpp"
+//#include "boost/cgi/scgi/request_impl.hpp"
 #include "boost/cgi/map.hpp"
 #include "boost/cgi/tags.hpp"
+#include "boost/cgi/read.hpp"
 #include "boost/cgi/role_type.hpp"
 #include "boost/cgi/io_service.hpp"
+#include "boost/cgi/basic_client.hpp"
+#include "boost/cgi/connections/tcp_socket.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
 #include "boost/cgi/detail/service_base.hpp"
 #include "boost/cgi/detail/extract_params.hpp"
 
 namespace cgi {
+ namespace scgi {
 
   /// The IoObjectService class for a SCGI basic_request<>s
   class scgi_request_service
     : public detail::service_base<scgi_request_service>
   {
   public:
- typedef tags::scgi protocol_type;
- typedef scgi_request_impl implementation_type;
- typedef cgi::map map_type;
+ /// The actual implementation date for an SCGI request.
+ struct implementation_type
+ {
+ typedef ::cgi::map map_type;
+ typedef tcp_connection connection_type;
+ typedef ::cgi::scgi_ protocol_type;
+ typedef basic_client<connection_type, protocol_type> client_type;
+
+ implementation_type()
+ : client_()
+ , stdin_parsed_(false)
+ , http_status_(http::no_content)
+ , request_status_(unloaded)
+ , all_done_(false)
+ {
+ }
+
+ client_type client_;
 
- scgi_request_service(cgi::io_service& ios)
+ bool stdin_parsed_;
+ http::status_code http_status_;
+ status_type request_status_;
+
+ map_type env_vars_;
+ map_type get_vars_;
+ map_type post_vars_;
+ map_type cookie_vars_;
+
+ std::string null_str_;
+ bool all_done_;
+ };
+
+ typedef scgi_request_service type;
+ typedef type::implementation_type::protocol_type protocol_type;
+ typedef type::implementation_type::map_type map_type;
+
+ scgi_request_service(::cgi::io_service& ios)
       : detail::service_base<scgi_request_service>(ios)
- , io_service_(ios)
+ //, io_service_(ios)
     {
     }
 
@@ -43,19 +79,29 @@
 
     void construct(implementation_type& impl)
     {
- impl.connection()
- = implementation_type::connection_type::create(this->io_service());
+ impl.client_.set_connection(
+ implementation_type::connection_type::create(this->io_service())
+ );
     }
 
     void destroy(implementation_type& impl)
     {
+ //if (!impl.all_done_)
+ // detail::abort_impl(impl); // this function isn't implemented yet!
       //impl.set_state(aborted);
     }
 
     boost::system::error_code& load(implementation_type& impl, bool parse_stdin
                                    , boost::system::error_code& ec)
     {
- const std::string& request_method = meta_env(impl, "REQUEST_METHOD", ec);
+ //int header_len( get_length_of_header(impl, ec) );
+ BOOST_ASSERT(!ec);
+
+ std::vector<char> buf;
+ // read the header content
+ //::cgi::read(impl.client_, buffer(buf, header_len), ec);
+/*
+ const std::string& request_method = env(impl, "REQUEST_METHOD", ec);
       if (request_method == "GET")
         if (parse_get_vars(impl, ec))
               return ec;
@@ -65,7 +111,7 @@
               return ec;
 
       parse_cookie_vars(impl, ec);
- return ec;
+ */ return ec;
     }
 
     template<typename MutableBufferSequence>
@@ -87,13 +133,13 @@
 
     //template<typename VarType> map_type& var(implementation_type&) const;
 
- std::string meta_get(implementation_type& impl, const std::string& name
- , boost::system::error_code& ec)
+ std::string GET(implementation_type& impl, const std::string& name
+ , boost::system::error_code& ec)
     {
       return var(impl.get_vars_, name, ec);
     }
 
- map_type& meta_get(implementation_type& impl)
+ map_type& GET(implementation_type& impl)
     {
       return impl.get_vars_;
     }
@@ -110,9 +156,9 @@
      -----------------------------------------------
 
      */
- std::string meta_post(implementation_type& impl, const std::string& name
- , boost::system::error_code& ec
- , bool greedy = true)
+ std::string POST(implementation_type& impl, const std::string& name
+ , boost::system::error_code& ec
+ , bool greedy = true)
     {
       const std::string& val = var(impl.post_vars_, name, ec);
       if (val.empty() && greedy && !ec)
@@ -123,7 +169,7 @@
       return val;
     }
 
- map_type& meta_post(implementation_type& impl)
+ map_type& POST(implementation_type& impl)
     {
       return impl.post_vars_;
     }
@@ -136,15 +182,15 @@
       return var(impl.cookie_vars_, name, ec);
     }
 
- map_type& meta_cookie(implementation_type& impl)
+ map_type& cookie(implementation_type& impl)
     {
       return impl.cookie_vars_;
     }
 
 
     /// Find the environment meta-variable matching name
- std::string meta_env(implementation_type& impl, const std::string& name
- , boost::system::error_code& ec)
+ std::string env(implementation_type& impl, const std::string& name
+ , boost::system::error_code& ec)
     {
       return var(impl.env_vars_, name, ec);
     }
@@ -157,7 +203,7 @@
 
   protected:
     /// Extract the var value from
- std::string var(map_type& meta_data, const std::string& name
+ std::string var(map_type& _data, const std::string& _name
                    , boost::system::error_code& ec)
     {
       /* Alt:
@@ -169,8 +215,8 @@
       return std::string();
       **/
 
- if( meta_data.find(name) != meta_data.end() )
- return meta_data[name];
+ if( _data.find(_name) != _data.end() )
+ return _data[_name];
       return "";
     }
 
@@ -178,7 +224,7 @@
     boost::system::error_code&
     parse_get_vars(implementation_type& impl, boost::system::error_code& ec)
     {
- detail::extract_params(meta_env(impl, "QUERY_STRING", ec)
+ detail::extract_params(env(impl, "QUERY_STRING", ec)
                     , impl.get_vars_
                     , boost::char_separator<char>
                         ("", "=&", boost::keep_empty_tokens)
@@ -235,9 +281,10 @@
     }
 
   private:
- cgi::io_service& io_service_;
+ //cgi::io_service& io_service_;
   };
 
+ } // namespace scgi
 } // namespace cgi
 
 #endif // CGI_SCGI_REQUEST_SERVICE_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/scgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/scgi.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/scgi/scgi.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -17,6 +17,7 @@
 namespace cgi {
 
   /// A class representing the SCGI protocol
+ /*
   class scgi
   {
   public:
@@ -27,6 +28,7 @@
 
     typedef boost::asio::ip::tcp native_protocol;
   };
+ */
 
 } // namespace cgi
 

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/tags.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/tags.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/tags.hpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -10,6 +10,10 @@
 #define CGI_TAGS_HPP_INCLUDED__
 
 namespace cgi {
+
+ /// SCGI (note, this must be removed)
+ struct scgi_{};
+
  namespace tags {
 
    // the null tag type

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/cgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/cgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/cgi/Jamfile.v2 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -22,7 +22,9 @@
     <library>../../util/system//boost_system
     #<library>l:/usr/local/lib/libboost_system.a
     <define>BOOST_ALL_NO_LIB=1
- <define>_CRT_SECURE_NO_DEPRECIATE=1
+ <define>_CRT_SECURE_NO_DEPRECATE=1
+ <define>_SCL_SECURE_NO_WARNINGS
+ <define>_CRT_SECURE_NO_WARNINGS
     <toolset>gcc:<linkflags>-lpthread
   ;
 

Added: sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/scgi/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/scgi/Jamfile.v2 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,19 @@
+
+project cgi.examples.server1
+ : build-dir
+ ../../../../bin.v2
+ ;
+
+exe server1
+ :
+ basic-1.cpp
+ :
+ <include>$(BOOST_ROOT)
+ <include>../../../../
+ <library>../../util/system//boost_system
+ <define>BOOST_ALL_NO_LIB=1
+ <define>_CRT_SECURE_NO_WARNINGS
+ <define>_SCL_SECURE_NO_WARNINGS
+ ;
+
+

Added: sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/scgi/basic-1.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/example/scgi/basic-1.cpp 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -0,0 +1,53 @@
+// -- basic-1.cpp --
+//
+// Copyright (c) Darren Garvey 2007
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+////////////////////////////////////////////////////////////////
+
+#include "boost/cgi/scgi.hpp"
+
+namespace cgi {
+ namespace scgi {
+
+ class server1
+ {
+ public:
+ //using cgi::scgi;
+
+ typedef service protocol_service_type;
+
+ server1()
+ : service_()
+ //, acceptor_()
+ {
+ }
+
+ void run()
+ {
+ //acceptor_.async_accept(
+ service_.run();
+ }
+
+ void stop()
+ {
+ service_.stop();
+ }
+ private:
+ protocol_service_type service_;
+ //acceptor acceptor_;
+ };
+
+ } // namespace scgi
+} // namespace cgi
+
+int main()
+{
+ cgi::scgi::server1 server;
+
+ server.run();
+
+ return 0;
+}

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/util/system/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/util/system/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/util/system/Jamfile.v2 2007-10-26 23:15:02 EDT (Fri, 26 Oct 2007)
@@ -2,6 +2,6 @@
 
 lib boost_system
   :
- : <toolset>msvc:<file>C:/Boost/lib/boost_system-mt.dll
+ : <toolset>msvc:<file>C:/Boost/lib/boost_system-vc-mt-1_35.dll
     <toolset>gcc:<file>/usr/local/lib/libboost_system.a
   ;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk