Boost logo

Boost-Commit :

From: lists.drrngrvy_at_[hidden]
Date: 2007-11-07 13:08:27


Author: drrngrvy
Date: 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
New Revision: 40899
URL: http://svn.boost.org/trac/boost/changeset/40899

Log:
Commit to bridge the gap since the last. The included updates are many and scattered, mostly incomplete (see below).

* Removed gateway_* files, since they're not needed (although changing basic_client -> basic_gateway might be a future possibility; it depends how the Client concept develops).

* Working on a more rigorous testing environment (not yet included here). For this we need an 'executor' that can generate fake requests and launch the programs compiled using this library in the way they're supposed to be. I avoided doing this before now because it seemed like a monumental task, but thanks to the (not-done-yet) Boost.Process, it isn't.

The separate testing environment provides more than just the ability to test the library independently of an HTTP server.
 
 Required features:
 - Allow one to easily debug their program.
 - Allow basic benchmarking facilities.
 - Allow testing of CGI, SCGI and FastCGI programs.
 - Allow loading of 'requests' from file or command line

In short, the lack of tests is hindering progress. Dropping the *need* for an HTTP server layer should help immensely. Obviously they will still be needed, just not at every step of the way.

Removed:
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/gateway_impl/
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/gateway_service/
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/gateway_service.hpp
   sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/doc/cgi.qbk
Text files modified:
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi.hpp | 15 -
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi.hpp | 2
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request.hpp | 8
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_impl.hpp | 5
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_service.hpp | 6
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_connection.hpp | 4
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_protocol_service_fwd.hpp | 4
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_request.hpp | 6
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_impl.hpp | 4
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_service.hpp | 8
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/async_stdio.hpp | 12
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/stdio.hpp | 16 -
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_request_impl_base.hpp | 3
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_service_impl_base.hpp | 63 ++++----
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/common_headers.hpp | 1
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/save_environment.hpp | 13 +
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/fcgi/specification.hpp | 178 +++++++++++++++-------
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/header.hpp | 10 +
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service.hpp | 6
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider.hpp | 17 +
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider_fwd.hpp | 4
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_ostream.hpp | 20 +-
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/request_service.hpp | 22 +-
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/response.hpp | 309 ++++++++++++++++++++++++++++++++++++++-
   sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/tags.hpp | 4
   25 files changed, 563 insertions(+), 177 deletions(-)

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,16 +9,11 @@
 #ifndef CGI_HPP_INCLUDED__
 #define CGI_HPP_INCLUDED__
 
-// #include all headers except for cgi/cgi.hpp, cgi/fcgi.hpp, cgi/scgi.hpp
+// #include all headers
 
-#include "cgi/basic_request.hpp"
-#include "cgi/response.hpp"
-#include "cgi/map.hpp"
-#include "cgi/basic_protocol_service.hpp"
-#include "cgi/cookie.hpp"
-#include "cgi/header.hpp"
-#include "cgi/io_service.hpp"
-#include "cgi/basic_connection.hpp"
-#include "cgi/io_service_provider.hpp"
+#include "boost/cgi/cgi.hpp"
+#include "boost/cgi/acgi.hpp"
+#include "boost/cgi/fcgi.hpp"
+#include "boost/cgi/scgi.hpp"
 
 #endif // CGI_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -29,7 +29,7 @@
    typedef acgi_request request;
    //typedef acgi_service service;
    //typedef acgi_acceptor acceptor;
- using namespace cgi;
+ using namespace ::cgi;
 
  } // namespace acgi
 } // namespace cgi

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,9 +9,9 @@
 #ifndef CGI_ACGI_REQUEST_HPP_INCLUDED__
 #define CGI_ACGI_REQUEST_HPP_INCLUDED__
 
-#include "service.hpp"
-#include "request_impl.hpp"
-#include "request_service.hpp"
+#include "boost/cgi/acgi/service.hpp"
+#include "boost/cgi/acgi/request_impl.hpp"
+#include "boost/cgi/acgi/request_service.hpp"
 #include "boost/cgi/tags.hpp"
 #include "boost/cgi/basic_request_fwd.hpp"
 #include "boost/cgi/acgi/request_impl.hpp"
@@ -24,6 +24,6 @@
 
 } // namespace cgi
 
-#include "../basic_request.hpp"
+#include "boost/cgi/basic_request.hpp"
 
 #endif // CGI_ACGI_REQUEST_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_impl.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,7 +9,8 @@
 #ifndef CGI_ACGI_REQUEST_IMPL_HPP_INCLUDED__
 #define CGI_ACGI_REQUEST_IMPL_HPP_INCLUDED__
 
-#include "service.hpp"
+#include "boost/cgi/acgi/service.hpp"
+#include "boost/cgi/basic_client.hpp"
 #include "boost/cgi/detail/cgi_request_impl_base.hpp"
 #include "boost/cgi/connections/async_stdio.hpp"
 
@@ -25,6 +26,8 @@
   {
   public:
     typedef acgi_service protocol_service_type;
+ //typedef ::cgi::basic_client<async_stdio_connection, tags::acgi> client_type;
+ typedef async_stdio_connection client_type;
 
     acgi_request_impl()
       : cgi_request_impl_base<async_stdio_connection>()

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/acgi/request_service.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,7 +9,7 @@
 #ifndef CGI_ACGI_SERVICE_IMPL_HPP_INCLUDED__
 #define CGI_ACGI_SERVICE_IMPL_HPP_INCLUDED__
 
-#include "request_impl.hpp"
+#include "boost/cgi/acgi/request_impl.hpp"
 #include "boost/cgi/tags.hpp"
 #include "boost/cgi/io_service.hpp"
 #include "boost/cgi/map.hpp"
@@ -29,14 +29,14 @@
   public:
     typedef acgi_request_service type;
     typedef acgi_request_impl impl_type;
- typedef cgi::map map_type;
+ typedef ::cgi::map map_type;
     typedef tags::acgi protocol_type;
     typedef acgi_service protocol_service_type;
 
     /// The unique service identifier
     // static boost::asio::io_service::id id;
 
- acgi_request_service(cgi::io_service& ios)
+ acgi_request_service(::cgi::io_service& ios)
       : detail::service_base<acgi_request_service>(ios)
     {
     }

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_connection.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_connection.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_connection.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -13,8 +13,8 @@
 #include <ostream>
 #include <boost/asio.hpp>
 
-#include "tags.hpp"
-#include "connection_base.hpp"
+#include "boost/cgi/tags.hpp"
+#include "boost/cgi/connection_base.hpp"
 //#include "connections/async_stdio_connection_impl.hpp"
 
 namespace cgi {

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_protocol_service_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_protocol_service_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/basic_protocol_service_fwd.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,6 +9,10 @@
 #ifndef CGI_BASIC_PROTOCOL_SERVICE_FWD_HPP_INCLUDED__
 #define CGI_BASIC_PROTOCOL_SERVICE_FWD_HPP_INCLUDED__
 
+#if _MSC_VER > 1020
+#pragma once
+#endif
+
 #include "boost/cgi/io_service_provider.hpp"
 
 namespace cgi {

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-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -82,6 +82,7 @@
     typedef ProtocolService protocol_service_type;
     typedef boost::shared_ptr<type> pointer;
     typedef typename RequestService::implementation_type implementation_type;
+ typedef typename implementation_type::client_type client_type;
 
 
     // Throws
@@ -216,6 +217,11 @@
       this->service.set_status(this->impl, aborted);
     }
 
+ client_type& client()
+ {
+ return this->service.client(this->impl);
+ }
+
     /// Set the output for the request
     /**
      * Not Implemented Yet ******************

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_impl.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -15,6 +15,7 @@
 #include <boost/shared_ptr.hpp>
 
 #include "boost/cgi/http/status_code.hpp"
+#include "boost/cgi/basic_client.hpp"
 #include "boost/cgi/connections/stdio.hpp"
 #include "boost/cgi/role_type.hpp"
 #include "boost/cgi/status_type.hpp"
@@ -40,6 +41,9 @@
     : public cgi_request_impl_base<stdio_connection>
   {
   public:
+ //typedef ::cgi::basic_client<stdio_connection, tags::cgi> client_type;
+ typedef stdio_connection client_type;
+
     /// Constructor
     /**
      * Since this request type is synchronous, there is no need for an

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/cgi/request_service.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -13,10 +13,10 @@
 #include <map>
 #include <boost/system/error_code.hpp>
 
-#include "request_impl.hpp"
-#include "../detail/cgi_service_impl_base.hpp"
-#include "../detail/extract_params.hpp"
-#include "../connections/stdio.hpp"
+#include "boost/cgi/cgi/request_impl.hpp"
+#include "boost/cgi/detail/cgi_service_impl_base.hpp"
+#include "boost/cgi/detail/extract_params.hpp"
+#include "boost/cgi/connections/stdio.hpp"
 
 namespace cgi {
 

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/async_stdio.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/async_stdio.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/async_stdio.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -14,9 +14,9 @@
 #include <boost/system/error_code.hpp>
 #include <boost/enable_shared_from_this.hpp>
 
-#include "stdio.hpp"
-#include "../io_service.hpp"
-#include "../tags.hpp"
+#include "boost/cgi/connections/stdio.hpp"
+#include "boost/cgi/io_service.hpp"
+#include "boost/cgi/tags.hpp"
 
 namespace cgi {
 
@@ -30,13 +30,13 @@
     typedef basic_connection<tags::async_stdio> type;
     typedef boost::shared_ptr<type> pointer;
 
- basic_connection(io_service& ios)
+ basic_connection(::cgi::io_service& ios)
       : basic_connection<tags::stdio>()
       , io_service_(ios)
     {
     }
 
- static pointer create(cgi::io_service& ios)
+ static pointer create(::cgi::io_service& ios)
     {
       return pointer(new basic_connection<tags::async_stdio>(ios));
     }
@@ -108,7 +108,7 @@
     }
 
   private:
- io_service& io_service_;
+ ::cgi::io_service& io_service_;
   };
 
   typedef basic_connection<tags::async_stdio> async_stdio_connection;

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/stdio.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/stdio.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/connections/stdio.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -16,11 +16,11 @@
 #include <boost/system/error_code.hpp>
 #include <boost/asio.hpp>
 
-#include "../basic_connection_fwd.hpp"
-#include "../tags.hpp"
-#include "../connection_base.hpp"
-#include "../data_sink.hpp"
-//#include "../io_service.hpp"
+#include "boost/cgi/basic_connection_fwd.hpp"
+#include "boost/cgi/tags.hpp"
+#include "boost/cgi/connection_base.hpp"
+#include "boost/cgi/data_sink.hpp"
+//#include "boost/cgi/io_service.hpp"
 
 namespace cgi {
 
@@ -34,7 +34,6 @@
     basic_connection()
       : in_(std::cin)
       , out_(std::cout)
- , err_(std::cerr)
     {
     }
 
@@ -42,7 +41,6 @@
     basic_connection(T&)
       : in_(std::cin)
       , out_(std::cout)
- , err_(std::cerr)
     {
     }
 
@@ -53,8 +51,7 @@
 
     template<typename MutableBufferSequence>
     std::size_t read_some(MutableBufferSequence buf
- , boost::system::error_code& ec
- , cgi::sink origin)
+ , boost::system::error_code& ec)
     {
       if( buf.data() != in_.rdbuf() )
         return in_.read(buf.begin(), buf.size());
@@ -81,7 +78,6 @@
   protected:
     std::istream& in_;
     std::ostream& out_;
- std::ostream& err_;
   };
 
   typedef basic_connection<tags::stdio> stdio_connection;

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_request_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_request_impl_base.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_request_impl_base.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -42,6 +42,8 @@
   public:
     typedef ::cgi::map map_type;
     typedef Connection connection_type;
+ typedef typename
+ basic_client<Connection, tags::acgi> client_type;
     typedef typename connection_type::pointer conn_ptr;
 
     /// Constructor
@@ -80,6 +82,7 @@
     status_type request_status_;
 
     conn_ptr connection_;
+ client_type client_;
 
     std::string null_str_;
   };

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_service_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_service_impl_base.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/cgi_service_impl_base.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -1,7 +1,7 @@
 #ifndef CGI_CGI_SERVICE_IMPL_BASE_HPP_INCLUDED__
 #define CGI_CGI_SERVICE_IMPL_BASE_HPP_INCLUDED__
 
-#include "../detail/push_options.hpp"
+#include "boost/cgi/detail/push_options.hpp"
 
 #include <string>
 #include <cstdlib>
@@ -11,6 +11,7 @@
 #include <boost/system/error_code.hpp>
 
 #include "boost/cgi/map.hpp"
+#include "boost/cgi/basic_client.hpp"
 #include "boost/cgi/role_type.hpp"
 #include "boost/cgi/status_type.hpp"
 #include "boost/cgi/detail/extract_params.hpp"
@@ -32,8 +33,8 @@
   class cgi_service_impl_base
   {
   public:
- typedef RequestImplType implementation_type;
- typedef cgi::map map_type;
+ typedef RequestImplType implementation_type;
+ typedef ::cgi::map map_type;
 
     cgi_service_impl_base()
     {
@@ -56,7 +57,7 @@
     }
 
     /// Return the connection associated with the request
- typename implementation_type::connection_type&
+ typename implementation_type::client_type&
     client(implementation_type& impl)
     {
       return *impl.connection();
@@ -89,7 +90,7 @@
 
       parse_cookie_vars(impl, ec);
       impl.status() = loaded;
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
 
       return ec;
     }
@@ -117,16 +118,16 @@
       return meta_data[name];
     }
 
- std::string meta_get(implementation_type& impl, const std::string& name
+ std::string GET(implementation_type& impl, const std::string& name
                         , boost::system::error_code& ec)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       return var(impl.get_vars(), name, ec);
     }
 
- map_type& meta_get(implementation_type& impl)
+ map_type& GET(implementation_type& impl)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       return impl.get_vars();
     }
 
@@ -142,11 +143,11 @@
      -----------------------------------------------
 
      */
- 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)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       const std::string& val = var(impl.post_vars(), name, ec);
       if (val.empty() && greedy && !ec)
       {
@@ -156,9 +157,9 @@
       return val;
     }
 
- map_type& meta_post(implementation_type& impl)
+ map_type& POST(implementation_type& impl)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       return impl.post_vars();
     }
 
@@ -167,29 +168,29 @@
     std::string cookie(implementation_type& impl, const std::string& name
                       , boost::system::error_code& ec)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       return var(impl.cookie_vars(), name, ec);
     }
 
- map_type& meta_cookie(implementation_type& impl)
+ map_type& cookie(implementation_type& impl)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       return impl.cookie_vars();
     }
 
 
     /// Find the environment meta-variable matching name
- std::string meta_env(implementation_type& impl, const std::string& name
+ std::string env(implementation_type& impl, const std::string& name
                         , boost::system::error_code& ec)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       const char* c = ::getenv(name.c_str());
       return c ? c : impl.null_str();
     }
 
- map_type& meta_env(implementation_type& impl)
+ map_type& env(implementation_type& impl)
     {
- BOOST_ASSERT(impl.status() >= loaded);
+ //BOOST_ASSERT(impl.status() >= loaded);
       return impl.env_vars();
     }
 
@@ -211,7 +212,7 @@
     parse_get_vars(RequestImpl& impl, boost::system::error_code& ec)
     {
       // Make sure the request is in a pre-loaded state
- BOOST_ASSERT (impl.status() <= unloaded);
+ //BOOST_ASSERT (impl.status() <= unloaded);
 
       std::string& vars = impl.env_vars()["QUERY_STRING"];
       if (vars.empty())
@@ -231,7 +232,7 @@
     parse_cookie_vars(RequestImpl& impl, boost::system::error_code& ec)
     {
       // Make sure the request is in a pre-loaded state
- BOOST_ASSERT (impl.status() <= unloaded);
+ //BOOST_ASSERT (impl.status() <= unloaded);
 
       std::string& vars(impl.env_vars()["HTTP_COOKIE"]);
       if (vars.empty())
@@ -251,25 +252,25 @@
     parse_post_vars(RequestImpl& impl, boost::system::error_code& ec)
     {
       // Make sure this function hasn't already been called
- BOOST_ASSERT (!impl.stdin_parsed());
+ //BOOST_ASSERT (!impl.stdin_parsed());
 
       std::istream& is(std::cin);
       char ch;
       std::string name;
       std::string str;
- cgi::map& post_map(impl.post_vars());
+ map_type& post_map(impl.post_vars());
 
       const char* a = ::getenv("content_length");
       if (a) str = a;
- else std::cerr<< "no content-length";
+ else throw std::runtime_error("no content-length");
 
- std::cerr<< "content length = ";
+ //std::cerr<< "content length = ";
       //var(impl.get_vars(), "CONTENT_LENGTH", ec);
- std::cerr.flush();
+ //std::cerr.flush();
 
       while( is.get(ch) )
       {
- std::cerr<< "; ch=" << ch << "; ";
+ //std::cerr<< "; ch=" << ch << "; ";
           switch(ch)
           {
           case '%': // unencode a hex character sequence
@@ -315,6 +316,6 @@
 
 } // namespace cgi
 
-#include "../detail/pop_options.hpp"
+#include "boost/cgi/detail/pop_options.hpp"
 
 #endif // CGI_CGI_SERVICE_IMPL_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/common_headers.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/common_headers.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/common_headers.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -22,5 +22,6 @@
 //#include "boost/cgi/logger.hpp"
 #include "boost/cgi/read.hpp"
 #include "boost/cgi/write.hpp"
+#include "boost/cgi/header.hpp"
 
 #endif // CGI_CGI_CGI_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/save_environment.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/save_environment.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/detail/save_environment.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -15,8 +15,13 @@
 #include "boost/cgi/map.hpp"
 
 // The process' environment
-// MSVC warns of 'inconsistent dll linkage' here...
-extern char** environ;
+#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
+ // MSVC warns of 'inconsistent dll linkage' here...
+ _CRTIMP extern char** environ;
+#else
+ extern char** environ;
+#endif
+
 
 namespace cgi {
  namespace detail {
@@ -26,8 +31,8 @@
     * @param env This defaults to `::environ`, or the current process'
     * environment.
     */
- void save_environment(std::map<std::string,std::string>& env_map
- , char** env = environ)
+ template<typename MapT>
+ void save_environment(MapT& env_map, char** env = environ)
    {
      for(; *env; ++env)
      {

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/fcgi/specification.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/fcgi/specification.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/fcgi/specification.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -28,10 +28,11 @@
     const short HEADER_LEN = 8;
 
     // Value for version component of Header
- const short VERSION_1 = 1;
+ const short BOOST_CGI_FASTCGI_VERSION_1 = 1;
 
     // current version
- const unsigned char VERSION_NUM = (unsigned char)VERSION_1;
+ const unsigned char VERSION_NUM
+ = (unsigned char)BOOST_CGI_FASTCGI_VERSION_1;
 
     // Values for the type component of Header
     enum request_t { BEGIN_REQUEST = 1
@@ -74,73 +75,92 @@
     struct Header
     {
     private:
- unsigned char version_;
- unsigned char type_;
- unsigned char requestIdB1_;
- unsigned char requestIdB0_;
- unsigned char contentLengthB1_;
- unsigned char contentLengthB0_;
- unsigned char paddingLength_;
- unsigned char reserved_;
+ /// The underlying type of a FastCGI header.
+ /**
+ * To guarantee the header is laid out exactly as we want, the
+ * structure must be a POD-type (see http://tinyurl.com/yo9eav).
+ */
+ struct implementation_type
+ {
+ unsigned char version_;
+ unsigned char type_;
+ unsigned char requestIdB1_;
+ unsigned char requestIdB0_;
+ unsigned char contentLengthB1_;
+ unsigned char contentLengthB0_;
+ unsigned char paddingLength_;
+ unsigned char reserved_;
+ } impl;
+
     public:
- Header() { memset(this, 0, sizeof(*this)); }
+ Header() { memset(this->impl, 0, sizeof(*this)); }
 
       Header(request_t t, int id, int len)
- : version_ (VERSION_NUM)
- , type_ ((unsigned char)t)
- , requestIdB1_ ((unsigned char)(id >> 8) & 0xff)
- , requestIdB0_ ((unsigned char)(id ) & 0xff)
- , contentLengthB1_((unsigned char)(len >> 8) & 0xff)
- , contentLengthB0_((unsigned char)(len ) & 0xff)
- , paddingLength_ ((unsigned char)0)
- , reserved_ (0)
+ : impl.version_ (VERSION_NUM)
+ , impl.type_ ((unsigned char)t)
+ , impl.requestIdB1_ ((unsigned char)(id >> 8) & 0xff)
+ , impl.requestIdB0_ ((unsigned char)(id ) & 0xff)
+ , impl.contentLengthB1_((unsigned char)(len >> 8) & 0xff)
+ , impl.contentLengthB0_((unsigned char)(len ) & 0xff)
+ , impl.paddingLength_ ((unsigned char)0)
+ , impl.reserved_ (0)
       { }
 
       std::u_int16_t version() const
       {
- return version_;
+ return impl.version_;
       }
 
       std::u_int16_t type() const
       {
- return type_;
+ return impl.type_;
       }
 
       std::u_int16_t request_id() const
       {
- return requestIdB0_ + (requestIdB1_ << 8);
+ return impl.requestIdB0_ + (impl.requestIdB1_ << 8);
       }
 
       std::u_int16_t content_length() const
       {
- return contentLengthB0_ + (contentLengthB1_ << 8);
+ return impl.contentLengthB0_ + (impl.contentLengthB1_ << 8);
       }
 
       std::u_int16_t padding_length() const
       {
- return paddingLength_;
+ return impl.paddingLength_;
       }
       int body_length() const
       {
- return content_length() + padding_length();
+ return impl.content_length() + impl.padding_length();
       }
     };
 
- struct BeginRequestBody
+ class BeginRequestBody
     {
- unsigned char roleB1_;
- unsigned char roleB0_;
- unsigned char flags_;
- unsigned char reserved_[5];
+ /// The underlying type of a BeginRequestBody sub-header.
+ /**
+ * To guarantee the header is laid out exactly as we want, the
+ * structure must be a POD-type (see http://tinyurl.com/yo9eav).
+ */
+ struct implementation_type
+ {
+ unsigned char roleB1_;
+ unsigned char roleB0_;
+ unsigned char flags_;
+ unsigned char reserved_[5];
+ } impl;
+
+ public:
 
       int role() const
       {
- return (roleB1_ << 8 ) + roleB0_;
+ return (impl.roleB1_ << 8 ) + impl.roleB0_;
       }
 
       unsigned char flags() const
       {
- return flags_;
+ return impl.flags_;
       }
     };
 
@@ -150,63 +170,101 @@
       BeginRequestBody body_;
     };
 
- struct EndRequestBody
+ class EndRequestBody
     {
- unsigned char appStatusB3_;
- unsigned char appStatusB2_;
- unsigned char appStatusB1_;
- unsigned char appStatusB0_;
- unsigned char protocolStatus_;
- unsigned char reserved_[3];
+ /// The underlying type of an EndRequestBody sub-header.
+ /**
+ * To guarantee the header is laid out exactly as we want, the
+ * structure must be a POD-type (see http://tinyurl.com/yo9eav).
+ */
+ struct implementation_type
+ {
+ unsigned char appStatusB3_;
+ unsigned char appStatusB2_;
+ unsigned char appStatusB1_;
+ unsigned char appStatusB0_;
+ unsigned char protocolStatus_;
+ unsigned char reserved_[3];
+ } impl;
 
+ public:
       EndRequestBody( std::u_int64_t appStatus
                     , status_t procStatus
                     )
- : appStatusB3_( (appStatus >> 24) & 0xff )
- , appStatusB2_( (appStatus >> 16) & 0xff )
- , appStatusB1_( (appStatus >> 8) & 0xff )
- , appStatusB0_( (appStatus >> 0) & 0xff )
- , protocolStatus_((unsigned char)procStatus)
+ : impl.appStatusB3_( (appStatus >> 24) & 0xff )
+ , impl.appStatusB2_( (appStatus >> 16) & 0xff )
+ , impl.appStatusB1_( (appStatus >> 8) & 0xff )
+ , impl.appStatusB0_( (appStatus >> 0) & 0xff )
+ , impl.protocolStatus_((unsigned char)procStatus)
       {
- memset(reserved_, 0, sizeof(reserved_));
+ memset(impl.reserved_, 0, sizeof(impl.reserved_));
       }
     };
 
- struct EndRequestRecord
+ class EndRequestRecord
     {
- Header header_;
- EndRequestBody body_;
+ /// The underlying type of an EndRequestRecord sub-header.
+ /**
+ * To guarantee the header is laid out exactly as we want, the
+ * structure must be a POD-type (see http://tinyurl.com/yo9eav).
+ */
+ struct implementation_type
+ {
+ Header header_;
+ EndRequestBody body_;
+ } impl;
 
+ public:
       EndRequestRecord( std::u_int16_t id
                       , std::u_int64_t appStatus
                       , status_t procStatus
                       )
- : header_( END_REQUEST, id, sizeof(EndRequestBody) )
- , body_( appStatus, procStatus )
+ : impl.header_( END_REQUEST, id, sizeof(EndRequestBody) )
+ , impl.body_( appStatus, procStatus )
       {
       }
     };
 
- struct UnknownTypeBody
+ class UnknownTypeBody
     {
- unsigned char type_;
- unsigned char reserved_[7];
+ /// The underlying type of an UnknownTypeBody sub-header.
+ /**
+ * To guarantee the header is laid out exactly as we want, the
+ * structure must be a POD-type (see http://tinyurl.com/yo9eav).
+ */
+ struct implementation_type
+ {
+ unsigned char type_;
+ unsigned char reserved_[7];
+ } impl;
 
+ public:
       UnknownTypeBody( unsigned char t )
- : type_(t)
+ : impl.type_(t)
       {
- memset(reserved_, 0, sizeof(reserved_));
+ memset(impl.reserved_, 0, sizeof(impl.reserved_));
       }
+
+ unsigned char type() const { return impl.type_; }
     };
 
- struct UnknownTypeRecord
+ class UnknownTypeRecord
     {
- Header header_;
- UnknownTypeBody body_;
+ /// The underlying type of a UnknownTypeRecord sub-header
+ /**
+ * To guarantee the header is laid out exactly as we want, the
+ * structure must be a POD-type (see http://tinyurl.com/yo9eav).
+ */
+ struct implementation_type
+ {
+ Header header_;
+ UnknownTypeBody body_;
+ } impl;
 
+ public:
       UnknownTypeRecord( int type )
- : header_( UNKNOWN_TYPE, 0, sizeof(UnknownTypeBody) )
- , body_( (unsigned char)type )
+ : impl.header_( UNKNOWN_TYPE, 0, sizeof(UnknownTypeBody) )
+ , impl.body_( (unsigned char)type ) // not sure why this is C-style
       {
       }
     };

Deleted: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/gateway_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/gateway_service.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
+++ (empty file)
@@ -1,117 +0,0 @@
-// -- gateway_service.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_GATEWAY_SERVICE_HPP_INCLUDED__
-#define CGI_GATEWAY_SERVICE_HPP_INCLUDED__
-
-namespace cgi {
-
-
- template<typename Protocol
- , typename ProtocolService = basic_protocol_service<Protocol> >
- class gateway_service
- {
- public:
- typedef Protocol protocol_type;
- typedef ProtocolService io_service_type;
- typedef boost::shared_ptr<connection_type> conn_ptr;
-
-
- gateway_service(io_service_type& ios)
- : io_service_(ios)
- {
- }
-
- void stop(impl_type& impl)
- {
-
-
- //boost::system::error_code&
- //accept(impl_type& impl, conn_ptr conn, boost::system::error_code& ec)
- //{
- // boost::asio::acceptor(
- //}
-
- //boost::system::error_code&
- //accept(conn_ptr conn, boost::system::error_code& ec)
- //{
- // conn = create_connection();
-
- // if( accept_impl(conn, ec) )
- // {
- // io_service_.connections_.insert(conn);
- // return ec;
- // }
-
- // // else change the current connection type held by the service, and try again
- // // (when implemented by asio & server front-ends)
- // // for now just set an error and return
- // ec = boost::system::system_error(666);
- // return ec;
- //}
-
- //template<typename Handler>
- //class accept_handler
- //{
- //public:
- // accept_handler(Handler handler)
- // : handler_(handler)
- // {
- // }
-
- // void operator()(const boost::system::error_code& ec)
- // {
- // handler_(ec);
- // }
-
- //private:
- // Handler handler_;
- //};
-
- //template<typename Handler>
- //void async_accept(Handler handler)
- //{
- //}
-
- private:
-
- /// Create a connection of the correct type
- /**
- * For now this only creates one type of connection (either a tcp socket for FCGI,
- * or a cin/cout wrapper for vanilla CGI).
- *
- * It will be necessary once asio has the capabilities, to allow for different
- * connection types here. This should be relatively simple assuming conn_ptr is
- * a shared_ptr of a connection_base and all connection types inherit from this.
- */
- conn_ptr create_connection()
- {
- return new tcp_connection(io_service_);
- }
-
- io_service_type& io_service_;
- };
-
-
- template<> boost::system::error_code&
- gateway_service<protocol::cgi>::accept( gateway_service<protocol::cgi>::conn_ptr conn
- , boost::system::error_code& ec
- )
- {
- conn = create_connection();
- }
-
- template<> boost::shared_ptr<connection_base>
- gateway_service<protocol::cgi>::create_connection()
- {
- return new stdio_connection(gateway_);
- }
-
-} // namespace cgi
-
-#endif // CGI_GATEWAY_SERVICE_HPP_INCLUDED__

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-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -20,12 +20,20 @@
     {
     }
 
+ /*
     /// Templated constructor to allow user-defined types to be converted
     template<typename T>
- header::header(T& t)
+ header(T& t)
       : content(t.to_string())
     {
     }
+ */
+
+ //template<>
+ header(const std::string& _content)
+ : content(_content)
+ {
+ }
 
     header(const std::string& name, const std::string& val)
       : content(name + ": " + val + "\r\n")

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,11 +9,15 @@
 #ifndef CGI_IO_SERVICE_HPP_INCLUDED__
 #define CGI_IO_SERVICE_HPP_INCLUDED__
 
+//#if _MSC_VER > 1020
+//#pragma once
+//#endif
+
 #include <boost/asio/io_service.hpp>
 
 namespace cgi {
 
- typedef boost::asio::io_service io_service;
+ using boost::asio::io_service;
 
 } // namespace cgi
 

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-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,15 +9,20 @@
 #ifndef CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__
 #define CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__
 
-#include <list>
-#include <boost/ref.hpp>
-#include <boost/bind.hpp>
-#include <boost/thread.hpp>
-#include <boost/shared_ptr.hpp>
+#if _MSC_VER > 1020
+#pragma once
+#endif
+
+#include "boost/cgi/detail/push_options.hpp"
+
+//#include <list>
+//#include <boost/ref.hpp>
+//#include <boost/bind.hpp>
+//#include <boost/thread.hpp>
+//#include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
 
 #include "boost/cgi/io_service.hpp"
-#include "boost/cgi/detail/push_options.hpp"
 #include "boost/cgi/io_service_provider_fwd.hpp"
 
 

Modified: sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/acceptor_work/boost/cgi/io_service_provider_fwd.hpp 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,6 +9,10 @@
 #ifndef CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
 #define CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
 
+#if _MSC_VER > 1020
+#pragma once
+#endif
+
 #include "boost/cgi/tags.hpp"
 
 namespace cgi {

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-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -168,8 +168,8 @@
         ostream_<< "Content-type: text/plain\r\n\r\n";
         headers_sent_ = true;
       }
- cgi::write(req, headers_);
- cgi::write(req, rdbuf()->data());
+ ::cgi::write(req, headers_);
+ ::cgi::write(req, rdbuf()->data());
       // the above function will throw on an error
       clear();
     }
@@ -188,7 +188,7 @@
         ostream_<< "Content-type: text/plain\r\n\r\n";
         headers_sent_ = true;
       }
- if(!cgi::write(req, rdbuf()->data(), ec))
+ if(!::cgi::write(req, rdbuf()->data(), ec))
         clear();
       return ec;
     }
@@ -227,9 +227,9 @@
         ostream_<< "Content-type: text/plain\r\n\r\n";
         headers_sent_ = true;
       }
- cgi::async_write(req, rdbuf()->data()
- , flush_handler<Handler>
- (*this, handler, boost::arg<1>()));
+ ::cgi::async_write(req, rdbuf()->data()
+ , flush_handler<Handler>
+ (*this, handler, boost::arg<1>()));
     }
 
 
@@ -277,7 +277,7 @@
         ostream_<< "Content-type: text/plain\r\n\r\n";
         headers_sent_ = true;
       }
- cgi::write(req.client(), rdbuf()->data());
+ ::cgi::write(req.client(), rdbuf()->data());
       req.set_status(http_status_);
     }
 
@@ -295,7 +295,7 @@
         ostream_<< "Content-type: text/plain\r\n\r\n";
         headers_sent_ = true;
       }
- cgi::write(req.client(), rdbuf()->data(), ec);
+ ::cgi::write(req.client(), rdbuf()->data(), ec);
       req.set_status(http_status_);
       return ec;
     }
@@ -313,7 +313,7 @@
         ostream_<< "Content-type: text/plain\r\n\r\n";
         headers_sent_ = true;
       }
- cgi::async_write(req, rdbuf()->data(), handler);
+ ::cgi::async_write(req, rdbuf()->data(), handler);
     }
 
     /// Get the buffer associated with the stream
@@ -356,6 +356,6 @@
 
 } // namespace cgi
 
-#include "detail/pop_options.hpp"
+#include "boost/cgi/detail/pop_options.hpp"
 
 #endif // CGI_REQUEST_OSTREAM_HPP_INCLUDED__

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-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,15 +9,15 @@
 #ifndef CGI_REQUEST_SERVICE_HPP_INCLUDED
 #define CGI_REQUEST_SERVICE_HPP_INCLUDED
 
-#include "detail/push_options.hpp"
+#include "boost/cgi/detail/push_options.hpp"
 
 #include <boost/utility/enable_if.hpp>
 
 //#include "is_async.hpp"
-#include "io_service.hpp"
-#include "detail/protocol_traits.hpp"
-#include "basic_protocol_service_fwd.hpp"
-#include "detail/service_base.hpp"
+#include "boost/cgi/io_service.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
+#include "boost/cgi/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/detail/service_base.hpp"
 //#include "service_selector.hpp"
 
 namespace cgi {
@@ -40,8 +40,8 @@
 
   public:
     typedef typename service_impl_type::impl_type impl_type;
- typedef typename service_impl_type::implementation_type
- implementation_type;
+ typedef typename
+ service_impl_type::implementation_type implementation_type;
     typedef Protocol protocol_type;
     typedef basic_protocol_service<Protocol> protocol_service_type;
 
@@ -51,7 +51,7 @@
     //{
     //}
 
- request_service(cgi::io_service& ios)
+ request_service(::cgi::io_service& ios)
       : detail::service_base<request_service<Protocol> >(ios)
       , service_impl_(boost::asio::use_service<service_impl_type>(ios))
     {
@@ -129,14 +129,14 @@
       GET(impl_type& impl, const std::string& name
          , boost::system::error_code& ec)
     {
- return service_impl_.meta_get(impl, name, ec);
+ return service_impl_.GET(impl, name, ec);
     }
 
     std::string
       POST(impl_type& impl, const std::string& name
           , boost::system::error_code& ec)
     {
- return service_impl_.meta_post(impl, name, ec);
+ return service_impl_.POST(impl, name, ec);
     }
 
     std::string
@@ -158,6 +158,6 @@
 
 } // namespace cgi
 
-#include "detail/pop_options.hpp"
+#include "boost/cgi/detail/pop_options.hpp"
 
 #endif // CGI_REQUEST_SERVICE_HPP_INCLUDED

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-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,10 +9,11 @@
 #ifndef CGI_RESPONSE_HPP_INCLUDED__
 #define CGI_RESPONSE_HPP_INCLUDED__
 
+#include "boost/cgi/detail/push_options.hpp"
+
 #include <string>
 
-#include "boost/cgi/detail/push_options.hpp"
-#include "boost/cgi/request_ostream.hpp"
+//#include "boost/cgi/request_ostream.hpp"
 #include "boost/cgi/buffer.hpp"
 #include "boost/cgi/cookie.hpp"
 #include "boost/cgi/header.hpp"
@@ -26,23 +27,298 @@
 
 
   class response
- : public request_ostream
   {
   public:
     response(http::status_code sc = http::ok)
- : request_ostream(sc)
+ : buffer_(new ::cgi::streambuf())
+ , ostream_(buffer_.get())
+ , http_status_(sc)
+ , headers_sent_(false)
     {
     }
 
+ /// Construct with a particular buffer
+ /**
+ * Takes the buffer and uses it internally, does nothing with it on
+ * destruction.
+ */
     response(::cgi::streambuf* buf, http::status_code sc = http::ok)
- : request_ostream(buf, sc)
+ : /*request_(NULL)
+ , */ostream_(buf)
+ , http_status_(sc)
     {
     }
 
+ /// Construct, taking a buffer from an external source
+ /**
+ * Gets a buffer from the request/protocol service held by the request.
+ * <strike>
+ * Takes a buffer from T (can be a model of ProtocolService or
+ * CommonGatewayRequest) to use internally.
+ * </strike>
+ */
+// template<typename CommonGatewayRequest>
+// request_ostream(CommonGatewayRequest& req, http::status_code sc = http::ok)
+// : request_(&req)
+// , buffer_(new cgi::streambuf())
+// , ostream_(buffer_.get()) //detail::take_buffer(req))
+// , http_status_(sc)
+//// , destination_(destination)
+// {
+// }
+
     ~response()
     {
     }
 
+ void clear()
+ {
+ ostream_.clear();
+ headers_.clear();
+ }
+
+ // provide this too?
+ std::size_t write(const char* str, std::size_t len)
+ {
+ ostream_.write(str, len);
+ return len;
+ }
+
+ std::size_t write(const std::string& str)
+ {
+ return write(str.c_str(), str.size());
+ }
+
+ template<typename ConstBufferSequence>
+ std::size_t write(const ConstBufferSequence& buf)
+ {
+ //ostream_.write(buf.data(), buf.size());
+ return buf.size();
+ }
+
+ /// Synchronously flush the data to the current request
+ /**
+ * If there is no error, the buffer is cleared.
+ */
+ //void flush()
+ //{
+ // BOOST_ASSERT(request_ != NULL);
+ // flush(*request_);
+ //}
+
+ /// Synchronously flush the data to the supplied request
+ /**
+ * This call uses throwing semantics. ie. an exception will be thrown on
+ * any failure.
+ * If there is no error, the buffer is cleared.
+ */
+ template<typename CommonGatewayRequest>
+ void flush(CommonGatewayRequest& req)
+ {
+ /*
+ if (!headers_sent_)
+ {
+ ostream_<< "Content-type: text/plain\r\n\r\n";
+ headers_sent_ = true;
+ }
+ */
+ ::cgi::write(req, headers_);
+ ::cgi::write(req, rdbuf()->data());
+ // the above function will throw on an error
+ clear();
+ }
+
+ /// Synchronously flush the data via the supplied request
+ /**
+ * This call uses error_code semantics. ie. ec is set if an error occurs.
+ * If there is no error, the buffer is cleared.
+ */
+ template<typename CommonGatewayRequest>
+ boost::system::error_code&
+ flush(CommonGatewayRequest& req, boost::system::error_code& ec)
+ {
+ /*
+ if (!headers_sent_)
+ {
+ ostream_<< "Content-type: text/plain\r\n\r\n";
+ headers_sent_ = true;
+ }
+ */
+ if(!::cgi::write(req, rdbuf()->data(), ec))
+ clear();
+ return ec;
+ }
+
+ // Class for doing post-flush housekeeping (ie. clearing the stream data)
+ template<typename Handler>
+ class flush_handler
+ {
+ public:
+ flush_handler(response& os, Handler handler)
+ : ostream_(os)
+ , handler_(handler)
+ {
+ }
+
+ void operator()(boost::system::error_code& ec)
+ {
+ if(!ec) ostream_.clear();
+ handler_(ec);
+ }
+ private:
+ response& ostream_;
+ Handler handler_;
+ };
+
+ /// Asynchronously flush the data through the supplied request
+ /**
+ * If there is no error, the buffer is cleared *after* the write has
+ * finished.
+ */
+ template<typename CommonGatewayRequest, typename Handler>
+ void async_flush(CommonGatewayRequest& req, Handler handler)
+ {
+ /*
+ if (!headers_sent_)
+ {
+ ostream_<< "Content-type: text/plain\r\n\r\n";
+ headers_sent_ = true;
+ }
+ */
+ ::cgi::async_write(req, rdbuf()->data()
+ , flush_handler<Handler>
+ (*this, handler, boost::arg<1>()));
+ }
+
+
+ /// Synchronously send the reply to the default request
+ /**
+ * Note: The data in the stream isn't cleared after this call, but the
+ * request held in the ostream is removed. ie. send() can't be called
+ * twice without an arguement (unless you add another request - something
+ * not possible yet).
+ */
+ //void send()
+ //{
+ // BOOST_ASSERT(request_ != NULL);
+ // send(*request_);
+ // request_ = NULL;
+ //}
+
+ /// Synchronously send the reply to the default request
+ /**
+ * Note: The data in the stream isn't cleared after this call. If the send
+ * is sucessful, the request held in the ostream is removed. ie. send()
+ * can't be called twice without an arguement (unless you add another
+ * request - something not possible yet).
+ */
+ //boost::system::error_code& send(boost::system::error_code& ec)
+ //{
+ // BOOST_ASSERT(request_ != NULL);
+ // if(!send(*request_, ec))
+ // request_ = NULL;
+ // return ec;
+ //}
+
+
+ /// Synchronously send the data via the supplied request
+ /**
+ * This call uses throwing semantics. ie. an exception will be thrown on
+ * any failure.
+ * Note: The data in the stream isn't cleared after this call.
+ */
+ template<typename CommonGatewayRequest>
+ void send(CommonGatewayRequest& req)
+ {
+ /*
+ if (!headers_sent_)
+ {
+ ostream_<< "Content-type: text/plain\r\n\r\n";
+ headers_sent_ = true;
+ }
+ */
+ ::cgi::write(req.client(), rdbuf()->data());
+ req.set_status(http_status_);
+ }
+
+ /// Synchronously send the data via the supplied request
+ /**
+ * This call uses error_code semantics. ie. ec is set if an error occurs.
+ * 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)
+ {
+ /*
+ if (!headers_sent_)
+ {
+ ostream_<< "Content-type: text/plain\r\n\r\n";
+ headers_sent_ = true;
+ }
+ */
+ ::cgi::write(req.client(), rdbuf()->data(), ec);
+ req.set_status(http_status_);
+ return ec;
+ }
+
+ /// Asynchronously send the data through the supplied request
+ /**
+ * Note: The data in the stream isn't cleared after this call.
+ */
+ template<typename CommonGatewayRequest, typename Handler>
+ void async_send(CommonGatewayRequest& req, Handler handler)
+ {
+ req.set_status(http_status_);
+ /*
+ if (!headers_sent_)
+ {
+ ostream_<< "Content-type: text/plain\r\n\r\n";
+ headers_sent_ = true;
+ }
+ */
+ ::cgi::async_write(req, rdbuf()->data(), handler);
+ }
+
+ /// Get the buffer associated with the stream
+ ::cgi::streambuf*
+ rdbuf()
+ {
+ return static_cast<::cgi::streambuf*>(ostream_.rdbuf());
+ }
+
+ void set_status(const http::status_code& num)
+ {
+ http_status_ = num;
+ }
+
+ http::status_code& get_status()
+ {
+ return http_status_;
+ }
+
+ void set_header(const std::string& value)
+ {
+ headers_.push_back(value);
+ }
+
+ void set_header(const std::string& name, const std::string& value)
+ {
+ headers_.push_back(name + ": " + value + "\r\n");
+ }
+ protected:
+ std::vector<std::string> headers_;
+ boost::shared_ptr<::cgi::streambuf> buffer_;
+ std::ostream ostream_;
+ http::status_code http_status_;
+ bool headers_sent_;
+
+ template<typename T>
+ friend response& operator<<(response& resp, const T& t);
+
+ //template<typename T>
+ //friend response& operator<<(response& resp, T t);
+
     /// Some helper functions for the basic CGI 1.1 meta-variables
 // void auth_type(const std::string& value)
 // {
@@ -58,9 +334,6 @@
 // this->headers_.push_back(cgi::buffer(str.c_str(), str.size()));
 // }
 
- private:
- template<typename T>
- friend response& operator<<(response& resp, const T& t);
   };
 
   template<typename T>
@@ -70,11 +343,23 @@
     return resp;
   }
 
- template<>
+ //template<typename T>
+ //response& operator<<(response& resp, T t)
+ //{
+ // resp.ostream_<< t;
+ // return resp;
+ //}
+
+ template<typename T>
   response& operator<<(response& resp, const header& hdr)
   {
- resp.headers_sent_ = true;
- return resp<< hdr.content;
+ if (hdr.content.empty()) {
+ resp.headers_sent_ = true;
+ return resp<< "\r\n";
+ }else{
+ resp.headers_.push_back(hdr.content);
+ return resp;
+ }
   }
 
   template<typename T>
@@ -88,6 +373,6 @@
 
 } // namespace cgi
 
-#include "detail/pop_options.hpp"
+#include "boost/cgi/detail/pop_options.hpp"
 
 #endif // CGI_RESPONSE_HPP_INCLUDED__

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-11-07 13:08:24 EST (Wed, 07 Nov 2007)
@@ -9,6 +9,10 @@
 #ifndef CGI_TAGS_HPP_INCLUDED__
 #define CGI_TAGS_HPP_INCLUDED__
 
+#if _MSC_VER > 1020
+#pragma once
+#endif
+
 namespace cgi {
 
   /// SCGI (note, this must be removed)

Deleted: sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/doc/cgi.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/acceptor_work/libs/cgi/doc/cgi.qbk 2007-11-07 13:08:24 EST (Wed, 07 Nov 2007)
+++ (empty file)
@@ -1,47 +0,0 @@
-[/
- / Copyright (c) 2007 Darren Garvey
- /
- / 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)
- /]
-
-[article CGI
- [quickbook 1.3]
- [version 0.01]
- [id cgi]
- [dirname the_document_dir]
- [copyright 2007 Darren Garvey]
- [purpose Thoughts about CGI implementation]
- [authors [Garvey, Darren]]
- [license
- 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])
- ]
-]
-
-[def __cgi__ [@http://en.wikipedia.org/wiki/Common_Gateway_Interface CGI]]
-[def __scgi__ [@http://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface SCGI]]
-[def __fcgi__ [@http://en.wikipedia.org/wiki/FastCGI FastCGI]]
-
-[def __asio__ [@http://asio.sourceforge.net Asio]]
-
-[def __reading_the_docs__ [link cgi.intro.reading_the_docs reading the docs]]
-[def __naming conventions__ [link cgi.intro.naming_conventions naming conventions]]
-
-[include preface.qbk]
-
-[include introduction.qbk]
-
-[section Tutorial]
-
-The tutorial is broken up into several parts, corresponding to the different protocols you can use.
-
-[include tutorial.qbk]
-
-[endsect]
-
-
-[xinclude autodoc.boostbook]
-
-[include reference.qbk]


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