Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61438 - in sandbox/SOC/2007/cgi/trunk: boost/cgi boost/cgi/common boost/cgi/connections boost/cgi/fcgi boost/cgi/fwd boost/cgi/impl boost/cgi/utility libs/cgi/build/msvc/9.0/Boost.CGI libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookies libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser_debug libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world libs/cgi/build/msvc/9.0/Boost.CGI/cgi_quickstart libs/cgi/build/msvc/9.0/Boost.CGI/cgi_sessions libs/cgi/build/msvc/9.0/Boost.CGI/cgi_stencil libs/cgi/build/msvc/9.0/Boost.CGI/cgi_upload libs/cgi/build/msvc/9.0/Boost.CGI/fastcgi_quickstart libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_async_echo libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_stencil libs/cgi/doc/src libs/cgi/doc/src/overview libs/cgi/doc/src/overview/requests libs/cgi/doc/src/tutorial libs/cgi/doc/src/utilities libs/cgi/doc/src/utilities/sessions libs/cgi/example/cgi/DebugServer2 libs/cgi/example/cgi/cookies libs/cgi/example/cgi/stencil libs/cgi/example/cgi/upload libs/cgi/example/fcgi/amortization libs/cgi/example/fcgi/charts libs/cgi/example/fcgi/echo libs/cgi/example/fcgi/file_browser libs/cgi/example/fcgi/hello_world libs/cgi/example/fcgi/stencil libs/cgi/example/fcgi/upload libs/cgi/test/run
From: lists.drrngrvy_at_[hidden]
Date: 2010-04-20 16:54:41


Author: drrngrvy
Date: 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
New Revision: 61438
URL: http://svn.boost.org/trac/boost/changeset/61438

Log:
* Default initialisation for FastCGI on Windows. Works with mod_fcgid and Apache 2.2.
* Updated the examples to match.
* Also some other code cleanups and refactoring.
Added:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/anonymous_pipe.hpp (contents, props changed)
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/win32_acceptor_service_impl.hpp (contents, props changed)
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/utilities/
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/utilities/sessions/
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/utilities/sessions/sessions_quickstart.cpp (contents, props changed)
Removed:
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/0-old-fastcgi_quickstart.cpp
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/Copy of fastcgi_quickstart.cpp
Text files modified:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp | 30 ++++---------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp | 9 +--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp | 35 ++++++++--------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/protocol_traits.hpp | 34 ++++++++++------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp | 3
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp | 1
   sandbox/SOC/2007/cgi/trunk/boost/cgi/config.hpp | 17 ++++---
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp | 2
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp | 12 +----
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/error.hpp | 19 ++++++++
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp | 40 ++++++++++++-------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp | 3
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp | 30 ++++---------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/sessions_fwd.hpp | 1
   sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp | 81 ++++++++++++++++++++++++++-------------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/sessions.hpp | 1
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln | 6 ++
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookies/cgi_cookies.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/cgi_ctemplate_cookie_game.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser_debug/cgi_file_browser_debug.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_quickstart/cgi_quickstart.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_sessions/cgi_sessions.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_stencil/cgi_stencil.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_upload/cgi_upload.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fastcgi_quickstart/fastcgi_quickstart.vcproj | 2
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_async_echo/fcgi_async_echo.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo/fcgi_echo.vcproj | 6 +-
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_stencil/fcgi_stencil.vcproj | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/cgi.qbk | 2
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/introduction.qbk | 6 +-
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/requests/loading.qbk | 7 ++
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/responses.qbk | 9 +++
   sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/fastcgi_quickstart.cpp | 5 -
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp | 2
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/main.cpp | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/main.cpp | 2
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/upload/main.cpp | 2
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/main.cpp | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/charts/main.cpp | 2
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp | 11 +---
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/file_browser/main.cpp | 6 --
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp | 9 ----
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/main.cpp | 4
   sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/upload/main.cpp | 2
   sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2 | 16 ++++---
   53 files changed, 263 insertions(+), 230 deletions(-)

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -15,7 +15,11 @@
 #include "boost/cgi/common/protocol_traits.hpp"
 #include "boost/cgi/common/role_type.hpp"
 #include "boost/cgi/common/request_status.hpp"
-#include "boost/cgi/connections/tcp_socket.hpp"
+#if defined(BOOST_WINDOWS)
+# include "boost/cgi/connections/anonymous_pipe.hpp"
+#else
+# include "boost/cgi/connections/tcp_socket.hpp"
+#endif // defined(BOOST_WINDOWS)
 #include "boost/cgi/detail/throw_error.hpp"
 #include "boost/cgi/error.hpp"
 #include "boost/cgi/http/status_code.hpp"
@@ -111,8 +115,6 @@
      */
     bool set_connection(connection_type* conn)
     {
- // make sure there isn't already a connection associated with the client
- //if (!connection_) return false;
       connection_.reset(conn);
       return true;
     }
@@ -125,9 +127,6 @@
      */
     bool set_connection(const typename connection_type::pointer& conn)
     {
- // make sure there isn't already a connection associated with the client
- //if (!connection_) return false;
- //BOOST_ASSERT(conn != NULL);
       connection_ = conn;
       return true;
     }
@@ -158,20 +157,11 @@
     std::size_t read_some(const MutableBufferSequence& buf
                          , boost::system::error_code& ec)
     {
- //if (boost::asio::buffer_size(buf) > bytes_left_)
- //{
- std::size_t bytes_read = connection_->read_some(buf, ec);
- bytes_left_ -= bytes_read;
- if (ec == boost::asio::error::eof)
- ec = boost::system::error_code();
- return bytes_left_ > 0 ? bytes_read : (bytes_read + bytes_left_);
- //}
- //else
- //{
- //
- // ec = boost::asio::error::eof;
- // return 0;
- //}
+ std::size_t bytes_read = connection_->read_some(buf, ec);
+ bytes_left_ -= bytes_read;
+ if (ec == boost::asio::error::eof)
+ ec = boost::system::error_code();
+ return bytes_left_ > 0 ? bytes_read : (bytes_read + bytes_left_);
     }
 
     /// Asynchronously write some data to the client.

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -179,8 +179,6 @@
       
     ~basic_request()
     {
- //if (is_open())
- // close(http::internal_server_error, 0);
 #ifdef BOOST_CGI_ENABLE_SESSIONS
       try {
           if (!session.id().empty())
@@ -193,6 +191,9 @@
     
 #ifdef BOOST_CGI_ENABLE_SESSIONS
     /// Start a session, or load the session from a cookie.
+ /**
+ * This starts a session.
+ */
     void start_session()
     {
       if (!session.loaded())
@@ -381,8 +382,6 @@
       boost::system::error_code ec;
       this->service.close(this->implementation, http_status,
           program_status, ec);
- // Clear the request data so the object can be reused.
- //clear();
       detail::throw_error(ec);
       return program_status;
     }
@@ -410,8 +409,6 @@
     }
 
     /// Clear the data for the request, for reusing this object.
- // I'd imagine clearing and re-loading a request is quicker than
- // destroying/re-creating one. **Unverified claims** **FIXME**
     void clear()
     {
       this->service.clear(this->implementation);

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -23,33 +23,32 @@
  namespace common {
 
   /// The interface class for any *BOOST_CGI_NAMESPACE::acceptor.
- template<typename RequestAcceptorService>
+ template<typename Protocol>
   class basic_request_acceptor
- : public boost::asio::basic_io_object<RequestAcceptorService>
+ //: public boost::asio::basic_io_object<RequestAcceptorService>
+ : public boost::asio::basic_io_object<
+ typename protocol_traits<Protocol>::acceptor_service
+ >
     //, private boost::noncopyable
   {
   public:
     // typedef impl_type;
- typedef RequestAcceptorService service_type;
- typedef typename service_type::protocol_type protocol_type;
- typedef
- typename service_type::implementation_type::port_number_type
- port_number_type;
- typedef typename
- service_type::acceptor_service_type next_layer_type;
- typedef typename
- service_type::endpoint_type endpoint_type;
- typedef typename service_type::native_type native_type;
- typedef typename
- service_type::protocol_service_type protocol_service_type;
+ typedef Protocol protocol_type;
+ typedef protocol_traits<protocol_type> traits;
+ typedef typename traits::acceptor_service service_type;
+ typedef typename traits::port_number_type port_number_type;
+ typedef typename traits::endpoint_type endpoint_type;
+ typedef typename traits::native_type native_type;
+ typedef typename traits::protocol_service_type protocol_service_type;
+
     typedef typename
- service_type::accept_handler_type accept_handler_type;
+ service_type::accept_handler_type accept_handler_type;
 
     template<typename IoServiceProvider>
     explicit basic_request_acceptor(
           common::basic_protocol_service<protocol_type, IoServiceProvider>& ps,
           port_number_type port_num = 0)
- : boost::asio::basic_io_object<RequestAcceptorService>(ps.get_io_service())
+ : boost::asio::basic_io_object<service_type>(ps.get_io_service())
     {
       this->service.set_protocol_service(this->implementation, ps);
       this->implementation.port_num_ = port_num;
@@ -84,7 +83,7 @@
           common::basic_protocol_service<protocol_type, IoServiceProvider>& ps,
           const boost::asio::ip::basic_endpoint<InternetProtocol>& endpoint,
           bool reuse_addr = true)
- : boost::asio::basic_io_object<RequestAcceptorService>(ps.get_io_service())
+ : boost::asio::basic_io_object<service_type>(ps.get_io_service())
     {
       this->service.set_protocol_service(this->implementation, ps);
 
@@ -104,7 +103,7 @@
           common::basic_protocol_service<protocol_type, IoServiceProvider>& ps,
           const InternetProtocol& ip,
           const native_type& native_acceptor)
- : boost::asio::basic_io_object<RequestAcceptorService>(ps.get_io_service())
+ : boost::asio::basic_io_object<service_type>(ps.get_io_service())
     {
       this->service.set_protocol_service(this->implementation, ps);
       boost::system::error_code ec;

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/protocol_traits.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/protocol_traits.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/protocol_traits.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -12,6 +12,7 @@
 #include <boost/asio/ip/tcp.hpp>
 #include <boost/none.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/config.hpp>
 ///////////////////////////////////////////////////////////
 #include "boost/cgi/common/parse_options.hpp"
 #include "boost/cgi/common/role_type.hpp"
@@ -21,11 +22,9 @@
 #include "boost/cgi/fwd/basic_connection_fwd.hpp"
 #include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/fwd/basic_request_fwd.hpp"
-//#include "boost/cgi/fwd/data_map_proxy_fwd.hpp"
 #include "boost/cgi/fwd/form_parser_fwd.hpp"
 #ifdef BOOST_CGI_ENABLE_SESSIONS
 # include "boost/cgi/fwd/sessions_fwd.hpp"
-# include <boost/uuid/uuid_generators.hpp>
 #endif // BOOST_CGI_ENABLE_SESSIONS
 
 BOOST_CGI_NAMESPACE_BEGIN
@@ -36,6 +35,7 @@
   namespace fcgi
   {
   class fcgi_service_impl;
+ template<typename Protocol>
   class fcgi_request_service;
   class fcgi_acceptor_service;
   }
@@ -52,6 +52,8 @@
   class fcgi_service_impl;
 
   class fcgi_acceptor_service;
+ template<typename Protocol>
+ class fcgi_request_acceptor_service;
 
   class cgi_request_service;
   class fcgi_request_service;
@@ -78,17 +80,17 @@
       typedef cgi_request_service request_service_impl;
       typedef cgi_request_service service_type;
       typedef common::basic_protocol_service<
- tags::cgi
+ protocol_type
> protocol_service_type;
       typedef basic_request<
- tags::cgi
+ protocol_type
> request_type;
       typedef cgi_service_impl service_impl_type;
       typedef basic_connection<
                   tags::async_stdio
> connection_type;
       typedef basic_client<
- tags::cgi
+ protocol_type
> client_type;
       typedef form_parser form_parser_type;
       typedef boost::none_t header_type;
@@ -98,7 +100,7 @@
       typedef boost::array<unsigned char, 8> header_buffer_type;
       typedef boost::asio::const_buffers_1 const_buffers_type;
       typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
- typedef role_type role_type;
+ typedef common::role_type role_type;
       typedef boost::shared_ptr<request_type> pointer;
 #ifdef BOOST_CGI_ENABLE_SESSIONS
       typedef basic_session<
@@ -121,20 +123,26 @@
     {
       typedef protocol_traits<tags::fcgi> type;
       typedef tags::fcgi protocol_type;
- typedef fcgi::fcgi_request_service request_service_impl;
- typedef fcgi::fcgi_request_service service_type;
+ typedef fcgi::fcgi_request_service<protocol_type> request_service_impl;
+ typedef fcgi::fcgi_request_service<protocol_type> service_type;
       typedef basic_protocol_service<
- tags::fcgi
+ protocol_type
> protocol_service_type;
- typedef basic_request<
- tags::fcgi
- > request_type;
+ typedef basic_request<protocol_type> request_type;
       typedef boost::shared_ptr<request_type> request_ptr;
       typedef fcgi::fcgi_service_impl service_impl_type;
+ typedef fcgi_request_acceptor_service<protocol_type> acceptor_service;
       typedef fcgi::fcgi_acceptor_service acceptor_service_impl;
+#if defined(BOOST_WINDOWS)
+ typedef basic_connection<
+ tags::anonymous_pipe
+ > connection_type;
+ //typedef anonymous_pipe connection_type;
+#else
       typedef basic_connection<
                   tags::shareable_tcp_socket
> connection_type;
+#endif // defined(BOOST_WINDOWS)
       typedef boost::asio::ip::tcp native_protocol_type;
       typedef boost::asio::socket_acceptor_service<
                   native_protocol_type
@@ -144,7 +152,7 @@
       typedef acceptor_service_type::native_type native_type;
       typedef unsigned short port_number_type;
       typedef boost::asio::ip::tcp::endpoint endpoint_type;
- typedef basic_client<tags::fcgi> client_type;
+ typedef basic_client<protocol_type> client_type;
       typedef form_parser form_parser_type;
       typedef fcgi::spec::header header_type;
       typedef fcgi::spec_detail::role_types role_type;

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -223,8 +223,7 @@
     
     /// Return the connection associated with the request
     template<typename ImplType>
- typename ImplType::client_type&
- client(ImplType& impl)
+ client_type& client(ImplType& impl)
     {
       return impl.client_;
     }

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -40,6 +40,7 @@
     struct tcp_socket {};
     // A shareable tcp_socket (ie. one that can be locked)
     struct shareable_tcp_socket {};
+ struct anonymous_pipe {};
 
   } // namespace tags
  } // namespace common

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/config.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/config.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/config.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -65,18 +65,21 @@
 # endif // NDEBUG
 #endif // BOOST_CGI_ASSERT
 
+/// Shortcut macro for defining custom protocols based on existing ones.
 #ifndef BOOST_CGI_OVERRIDE_PROTOCOL
-# define BOOST_CGI_OVERRIDE_PROTOCOL(p, tag, brace_enclosed_traits) \
+# define BOOST_CGI_OVERRIDE_PROTOCOL(protocol, tag, brace_enclosed_traits) \
+ struct tag##;\
     namespace boost { namespace cgi { namespace common {\
- \
       template<>\
       struct protocol_traits<tag>\
- : protocol_traits<tags::cgi>\
+ : protocol_traits<tags::##protocol>\
         brace_enclosed_traits\
- ; } } } \
- typedef boost::cgi::common::basic_request_acceptor<tag> acceptor;\
- typedef boost::cgi::common::basic_request<tag> request;\
- typedef boost::cgi::common::basic_protocol_service<tag> service;
+ ; } } } \
+ struct tag##{\
+ typedef boost::cgi::common::basic_request_acceptor<tag> acceptor;\
+ typedef boost::cgi::common::basic_request<tag> request;\
+ typedef boost::cgi::common::basic_protocol_service<tag> service;\
+ };
 #endif // BOOST_CGI_OVERRIDE_PROTOCOL
 
 #endif // BOOST_CGI_CONFIG_HPP_INCLUDED__

Added: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/anonymous_pipe.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/anonymous_pipe.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -0,0 +1,159 @@
+// -- anonymous_pipe.hpp --
+//
+// Copyright (c) Darren Garvey 2009.
+// 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 BOOST_CGI_ANONYMOUS_PIPE_INCLUDED_20100204
+#define BOOST_CGI_ANONYMOUS_PIPE_INCLUDED_20100204
+
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include "boost/cgi/error.hpp"
+#include "boost/cgi/common/tags.hpp"
+#include "boost/cgi/basic_connection.hpp"
+#include "boost/cgi/import/io_service.hpp"
+#include "boost/cgi/detail/push_options.hpp"
+#include "boost/cgi/common/connection_base.hpp"
+
+#include "boost/cgi/common/protocol_traits.hpp"
+
+//////////////////////////////////////////////////////////////////////////
+
+BOOST_CGI_NAMESPACE_BEGIN
+ namespace common {
+
+ /// Specialisation of basic_connection for anonymous pipes on Windows.
+ /**
+ * For default initialisation of FastCGI to work on Windows with mod_fcgid
+ * and Apache, we need to support anonymous pipes. This class is used to
+ * allow the support.
+ */
+ template<>
+ class basic_connection<tags::anonymous_pipe>
+ : public connection_base
+ {
+ enum { max_buffers = 64 };
+ public:
+ typedef basic_connection<tags::anonymous_pipe> self_type;
+ typedef boost::shared_ptr<self_type> pointer;
+
+ basic_connection(boost::asio::io_service& ios)
+ : io_service(ios)
+ , file_handle(INVALID_HANDLE_VALUE)
+ {
+ }
+
+ static pointer create(boost::asio::io_service& ios) {
+ return pointer(new self_type(ios));
+ }
+
+ bool is_open() { return file_handle != INVALID_HANDLE_VALUE; }
+
+ int close()
+ {
+ /*
+ * Make sure that the client (ie. a Web Server in this case) has
+ * read all data from the pipe before we disconnect.
+ */
+ if (!::FlushFileBuffers(file_handle)) return -1;
+ if (!::DisconnectNamedPipe(file_handle)) return -1;
+ file_handle = INVALID_HANDLE_VALUE;
+ return 0;
+ }
+
+ template<typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers)
+ {
+ boost::system::error_code ec;
+ std::size_t bytes_read = read_some(buffers, ec);
+ detail::throw_error(ec);
+ return bytes_read;
+ }
+
+ template<typename MutableBufferSequence>
+ std::size_t read_some(const MutableBufferSequence& buffers
+ , boost::system::error_code& ec)
+ {
+ ec = boost::system::error_code();
+ typename MutableBufferSequence::const_iterator iter = buffers.begin();
+ typename MutableBufferSequence::const_iterator end = buffers.end();
+ DWORD i = 0;
+ size_t buffer_size = 0;
+ size_t bytes_transferred = 0;
+ size_t total_bytes_transferred = 0;
+ for (; !ec && iter != end && i < max_buffers; ++iter, ++i)
+ {
+ boost::asio::mutable_buffer buffer(*iter);
+ buffer_size = boost::asio::buffer_size(buffer);
+ bytes_transferred = read_some(
+ boost::asio::buffer_cast<char*>(buffer), buffer_size , ec);
+ if (bytes_transferred < buffer_size)
+ return bytes_transferred;
+ total_bytes_transferred += buffer_size;
+ }
+ return total_bytes_transferred;
+ }
+
+ std::size_t read_some(char* buf, std::size_t len
+ , boost::system::error_code& ec)
+ {
+ ec = boost::system::error_code();
+ DWORD bytesRead;
+ int ret = -1;
+
+ if (::ReadFile(file_handle, buf, len, &bytesRead, NULL))
+ ret = bytesRead;
+ else
+ ec = boost::system::error_code(
+ ::GetLastError(), boost::system::system_category);
+
+ return ret;
+ }
+
+ template<typename ConstBufferSequence>
+ std::size_t write_some(ConstBufferSequence& buf
+ , boost::system::error_code& ec)
+ {
+ ec = boost::system::error_code();
+ std::size_t bytes_transferred(0);
+ for(typename ConstBufferSequence::const_iterator i = buf.begin(),
+ end (buf.end())
+ ; !ec && i != end; ++i)
+ {
+ std::size_t buf_len = boost::asio::buffer_size(*i);
+ bytes_transferred += write_some(boost::asio::buffer_cast<const char *>(*i), buf_len, ec);
+ }
+ return bytes_transferred;
+ }
+
+ std::size_t write_some(const char* buf, std::size_t len
+ , boost::system::error_code& ec)
+ {
+ ec = boost::system::error_code();
+ DWORD bytesWritten;
+ int ret = -1;
+
+ if (::WriteFile(file_handle, buf, len, &bytesWritten, NULL))
+ ret = bytesWritten;
+ else
+ ec = boost::system::error_code(
+ ::GetLastError(), boost::system::system_category);
+
+ return ret;
+ }
+
+ boost::asio::io_service& io_service;
+ HANDLE file_handle;
+ };
+
+ } // namespace common
+BOOST_CGI_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+#include "boost/cgi/detail/pop_options.hpp"
+
+#endif // BOOST_CGI_ANONYMOUS_PIPE_INCLUDED_20100204

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -18,7 +18,7 @@
    /// Typedef for common usage (FCGI)
    typedef
      ::BOOST_CGI_NAMESPACE::common::basic_request_acceptor<
- fcgi_request_acceptor_service<>
+ ::BOOST_CGI_NAMESPACE::common::tags::fcgi
>
    acceptor;
 

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -107,13 +107,9 @@
        typedef typename traits::protocol_service_type protocol_service_type;
        typedef typename traits::native_protocol_type native_protocol_type;
        typedef typename traits::request_type request_type;
- typedef boost::asio::socket_acceptor_service<
- native_protocol_type
- > acceptor_service_type;
- typedef typename
- acceptor_service_type::implementation_type acceptor_impl_type;
- typedef typename traits::port_number_type port_number_type;
- typedef typename traits::endpoint_type endpoint_type;
+ typedef typename traits::acceptor_service_type acceptor_service_type;
+ typedef typename traits::port_number_type port_number_type;
+ typedef typename traits::endpoint_type endpoint_type;
 
        acceptor_impl_type acceptor_;
        boost::mutex mutex_;
@@ -243,7 +239,6 @@
        if (!new_request->is_open() && !new_request->client().keep_connection())
        {
          // ...otherwise accept a new connection.
- //std::cerr<< "Accepting a new connection." << std::endl;
          acceptor_service_.async_accept(impl.acceptor_,
              new_request->client().connection()->next_layer(), 0,
              strand_.wrap(
@@ -255,7 +250,6 @@
        }
        else
        {
- //std::cerr<< "Reusing existing connection." << std::endl;
          impl.service_->post(
            strand_.wrap(
              boost::bind(&self_type::handle_accept

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/error.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/error.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/error.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -53,6 +53,15 @@
 
   invalid_socket,
 
+ // On Windows, attempting to call DuplicateHandle on STDIN failed.
+ unable_to_duplicate_handle,
+
+ // On Windows, a call to SetStdHandle failed.
+ failed_to_redirect_stdin,
+
+ // On Windows, TCP connections aren't supported.
+ unsupported_handle_type,
+
   // The CONTENT_TYPE for form data wasn't recognised.
   invalid_form_type,
 
@@ -104,11 +113,17 @@
     case already_closed:
       return "The client has already been closed.";
     case multiplexing_not_supported:
- return "Multiplexing connections are not yet supported.";
+ return "Multiplexing connections are not yet fully supported.";
+ case unable_to_duplicate_handle:
+ return "A call to DuplicateHandle failed while trying to duplicate the FastCGI HANDLE.";
+ case failed_to_redirect_stdin:
+ return "A call to SetStdHandle failed while trying to redirect the FastCGI HANDLE.";
+ case unsupported_handle_type:
+ return "An unsupported connection type was used to communicate with the FastCGI application.";
     //case empty_packet_read:
     // return "An empty FastCGI packet was read (eg. STDIN or GET_PARAM data has been read).";
     default:
- return "(FastCGI) BOOM!!!";
+ return "An unknown FastCGI error occurred.";
     }
   }
 };

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -15,7 +15,11 @@
 #include "boost/cgi/common/tags.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
 #include "boost/cgi/detail/service_base.hpp"
-#include "boost/cgi/fcgi/acceptor_service_impl.hpp"
+#if defined(BOOST_WINDOWS)
+# include "boost/cgi/fcgi/win32_acceptor_service_impl.hpp"
+#else
+# include "boost/cgi/fcgi/acceptor_service_impl.hpp"
+#endif // defined(BOOST_WINDOWS)
 #include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/import/io_service.hpp"
 
@@ -29,21 +33,28 @@
    * constructor which takes a ProtocolService (**LINK**). If the protocol
    * isn't async then the class can be used without a ProtocolService.
    */
- template<typename Protocol_ = common::tags::fcgi>
+ template<typename Protocol = common::tags::fcgi>
   class fcgi_request_acceptor_service
- : public detail::service_base<fcgi_request_acceptor_service<Protocol_> >
+ : public detail::service_base<fcgi_request_acceptor_service<Protocol> >
   {
   public:
     //typedef typename service_impl_type::impl_type impl_type;
 
- typedef fcgi::acceptor_service_impl<> service_impl_type;
- typedef service_impl_type::implementation_type implementation_type;
- typedef service_impl_type::native_type native_type;
- typedef service_impl_type::protocol_service_type protocol_service_type;
- typedef service_impl_type::accept_handler_type accept_handler_type;
- typedef implementation_type::protocol_type protocol_type;
- typedef implementation_type::endpoint_type endpoint_type;
- typedef implementation_type::acceptor_service_type acceptor_service_type;
+ typedef Protocol protocol_type;
+ typedef common::protocol_traits<protocol_type> traits;
+ typedef typename traits::endpoint_type endpoint_type;
+ typedef typename traits::acceptor_service_type acceptor_service_type;
+ typedef typename traits::protocol_service_type protocol_service_type;
+
+#if defined(BOOST_WINDOWS)
+ typedef fcgi::win32_acceptor_service_impl<Protocol> service_impl_type;
+#else
+ typedef fcgi::acceptor_service_impl<Protocol> service_impl_type;
+#endif // defined(BOOST_WINDOWS)
+
+ typedef typename service_impl_type::implementation_type implementation_type;
+ typedef typename service_impl_type::native_type native_type;
+ typedef typename service_impl_type::accept_handler_type accept_handler_type;
 
     /// The unique service identifier
     //static boost::asio::io_service::id id;
@@ -69,7 +80,7 @@
       service_impl_.shutdown_service();
     }
 
- service_impl_type::protocol_service_type&
+ protocol_service_type&
       protocol_service(implementation_type const& impl) const
     {
       return service_impl_.service(impl);
@@ -154,7 +165,7 @@
       impl.service_ = &ps;
     }
 
- typename implementation_type::endpoint_type
+ endpoint_type
       local_endpoint(implementation_type& impl, boost::system::error_code& ec)
     {
       return service_impl_.local_endpoint(impl, ec);
@@ -168,8 +179,7 @@
       return service_impl_.assign(impl, protocol, native_acceptor, ec);
     }
 
- service_impl_type::native_type
- native(implementation_type& impl)
+ native_type native(implementation_type& impl)
     {
       return service_impl_.native(impl);
     }

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -15,9 +15,10 @@
   namespace fcgi {
 
     typedef service service_t;
+ template<typename Protocol>
     class fcgi_request_service;
 
- typedef basic_request<fcgi_request_service, service_t> request;
+ typedef basic_request<fcgi_request_service<common::tags::fcgi>, service_t> request;
 
   } // namespace fcgi
 BOOST_CGI_NAMESPACE_END

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -32,16 +32,17 @@
  namespace fcgi {
  
   /// The IoObjectService class for a FCGI basic_request<>s
+ template<typename Protocol>
   class fcgi_request_service
- : public common::request_base<common::tags::fcgi>
- , public detail::service_base<fcgi_request_service>
+ : public common::request_base<Protocol>
+ , public detail::service_base<fcgi_request_service<Protocol> >
   {
   public:
     /// The actual implementation date for an FCGI request.
     struct implementation_type
       : base_type::impl_base
     {
- typedef client_type::header_buffer_type header_buffer_type;
+ typedef typename client_type::header_buffer_type header_buffer_type;
       typedef spec_detail::Header header_type;
 
       implementation_type()
@@ -70,14 +71,12 @@
       }
      };
 
- typedef fcgi_request_service self_type;
- typedef fcgi_request_service full_type;
- typedef self_type::implementation_type::protocol_type protocol_type;
- typedef self_type::implementation_type::string_type string_type;
- typedef self_type::implementation_type::request_type request_type;
+ typedef fcgi_request_service<Protocol> self_type;
+ typedef fcgi_request_service<Protocol> full_type;
+ typedef typename traits::header_buffer_type header_buffer_type;
 
     fcgi_request_service(::BOOST_CGI_NAMESPACE::common::io_service& ios)
- : detail::service_base<fcgi_request_service>(ios)
+ : detail::service_base<fcgi_request_service<Protocol> >(ios)
       , strand_(ios)
     {
     }
@@ -135,7 +134,7 @@
       return common::responder;
     }
 
- implementation_type::client_type&
+ client_type&
       client(implementation_type& impl)
     {
       return impl.client_;
@@ -255,15 +254,6 @@
     boost::system::error_code
     read_env_vars(implementation_type& impl, boost::system::error_code& ec);
 
- // Mammoth typedef corresponding to function signature of process_*
- // functions.
- //typedef boost::system::error_code
- // ( full_type::* proc_func_t)
- // (implementation_type& impl, boost::uint16_t, const unsigned char*
- // , boost::uint32_t, boost::system::error_code&);
-
- //const proc_func_t proc_funcs[8];
-
     boost::system::error_code
       parse_packet(implementation_type& impl, boost::system::error_code& ec);
       
@@ -280,7 +270,7 @@
 
     boost::system::error_code
       begin_request_helper(implementation_type& impl
- , implementation_type::header_buffer_type& header
+ , header_buffer_type& header
                           , boost::system::error_code& ec);
                           
   private:

Added: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/win32_acceptor_service_impl.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/win32_acceptor_service_impl.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -0,0 +1,506 @@
+// -- fcgi/win32_acceptor_service_impl.hpp --
+//
+// Copyright (c) Darren Garvey 2007-2009.
+// 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_FCGI_WIN32_ACCEPTOR_SERVICE_IMPL_HPP_INCLUDED_
+#define CGI_FCGI_WIN32_ACCEPTOR_SERVICE_IMPL_HPP_INCLUDED_
+
+#include "boost/cgi/detail/push_options.hpp"
+
+#include <boost/ref.hpp>
+#include <boost/bind.hpp>
+#include <boost/asio.hpp>
+#include <boost/thread.hpp>
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/system/error_code.hpp>
+///////////////////////////////////////////////////////////
+#include "boost/cgi/common/protocol_traits.hpp"
+#include "boost/cgi/fcgi/error.hpp"
+#include "boost/cgi/fcgi/request.hpp"
+#include "boost/cgi/import/io_service.hpp"
+#include "boost/cgi/detail/throw_error.hpp"
+#include "boost/cgi/detail/service_base.hpp"
+#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
+
+BOOST_CGI_NAMESPACE_BEGIN
+
+ namespace detail {
+
+ /// Helper functions for async_accept operation.
+ template<typename T, typename Handler>
+ struct accept_handler
+ {
+ accept_handler(T& t, typename T::implementation_type& impl
+ , typename T::implementation_type::request_type& req
+ , Handler& hnd)
+ : type(t)
+ , implementation(impl)
+ , request(req)
+ , handler(hnd)
+ {}
+
+ void operator()()
+ {
+ type.check_for_waiting_request(implementation, request, handler);
+ }
+
+ T& type;
+ typename T::implementation_type& implementation;
+ typename T::implementation_type::request_type& request;
+ Handler handler;
+ };
+
+
+ template<typename Pipe>
+ boost::system::error_code
+ accept_named_pipe(HANDLE& listen_handle, Pipe& pipe, boost::system::error_code& ec)
+ {
+ OVERLAPPED overlapped;
+ ::ZeroMemory(&overlapped, sizeof(overlapped));
+ overlapped.hEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
+ if (!overlapped.hEvent)
+ ec = boost::system::error_code(::GetLastError(), boost::system::system_category);
+ if (! ::ConnectNamedPipe(listen_handle, &overlapped))
+ {
+ switch(::GetLastError())
+ {
+ case ERROR_IO_PENDING:
+ if (::WaitForSingleObject(overlapped.hEvent, INFINITE) == WAIT_FAILED)
+ {
+ ::CloseHandle(overlapped.hEvent);
+ ec = boost::system::error_code(::GetLastError(), boost::system::system_category);
+ }
+ break;
+ case ERROR_PIPE_CONNECTED:
+ // ok, a valid connection.
+ break;
+ default:
+ ::CloseHandle(overlapped.hEvent);
+ ec = boost::system::error_code(::GetLastError(), boost::system::system_category);
+ }
+ }
+ ::CloseHandle(overlapped.hEvent);
+
+ pipe.file_handle = listen_handle;
+ if (!pipe.is_open())
+ ::DisconnectNamedPipe(listen_handle);
+
+ return ec;
+ }
+
+
+ } // namespace detail
+
+ namespace fcgi {
+
+ /// The service_impl class for FCGI 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 = common::tags::fcgi>
+ class win32_acceptor_service_impl
+ : public detail::service_base<
+ ::BOOST_CGI_NAMESPACE::fcgi::win32_acceptor_service_impl<Protocol>
+ >
+ {
+ public:
+
+ typedef win32_acceptor_service_impl<Protocol> self_type;
+ typedef Protocol protocol_type;
+ typedef common::protocol_traits<Protocol> traits;
+ typedef typename traits::protocol_service_type protocol_service_type;
+ typedef typename traits::native_protocol_type native_protocol_type;
+ typedef typename traits::native_type native_type;
+ typedef typename traits::request_type request_type;
+ typedef typename traits::pointer request_ptr;
+ typedef typename traits::acceptor_service_type acceptor_service_type;
+ typedef typename traits::acceptor_impl_type acceptor_impl_type;
+ typedef typename traits::port_number_type port_number_type;
+ typedef typename traits::endpoint_type endpoint_type;
+ typedef std::pair<
+ typename std::set<request_ptr>::iterator, bool> request_iter;
+ typedef boost::function<int (request_type&)> accept_handler_type;
+
+ struct implementation_type
+ {
+ typedef Protocol protocol_type;
+ typedef common::protocol_traits<Protocol> traits;
+ typedef typename traits::protocol_service_type protocol_service_type;
+ typedef typename traits::native_protocol_type native_protocol_type;
+ typedef typename traits::request_type request_type;
+ typedef typename traits::acceptor_service_type acceptor_service_type;
+ typedef typename traits::port_number_type port_number_type;
+ typedef typename traits::endpoint_type endpoint_type;
+
+ acceptor_impl_type acceptor_;
+ boost::mutex mutex_;
+ std::queue<boost::shared_ptr<request_type> > waiting_requests_;
+ std::set<request_ptr> running_requests_;
+ protocol_service_type* service_;
+ port_number_type port_num_;
+ endpoint_type endpoint_;
+
+ };
+
+ explicit win32_acceptor_service_impl(::BOOST_CGI_NAMESPACE::common::io_service& ios)
+ : detail::service_base< ::BOOST_CGI_NAMESPACE::fcgi::win32_acceptor_service_impl<Protocol> >(ios)
+ , acceptor_service_(boost::asio::use_service<acceptor_service_type>(ios))
+ , strand_(ios)
+ , listen_handle(INVALID_HANDLE_VALUE)
+ , is_cgi_(false)
+ {
+ }
+
+ protocol_service_type&
+ service(implementation_type const& impl) const
+ {
+ return *impl.service_;
+ }
+
+ /// Default-initialize the acceptor.
+ boost::system::error_code
+ default_init(implementation_type& impl, boost::system::error_code& ec)
+ {
+ //
+ if((::GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) &&
+ (::GetStdHandle(STD_ERROR_HANDLE) == INVALID_HANDLE_VALUE) &&
+ (::GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE) )
+ {
+ DWORD pipe_mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT;
+ HANDLE stdin_handle = ::GetStdHandle(STD_INPUT_HANDLE);
+
+ if (!::DuplicateHandle(::GetCurrentProcess(), stdin_handle,
+ ::GetCurrentProcess(), &listen_handle,
+ 0, TRUE, DUPLICATE_SAME_ACCESS))
+ ec = error::unable_to_duplicate_handle;
+ else
+ if (!::SetStdHandle(STD_INPUT_HANDLE, listen_handle))
+ ec = error::failed_to_redirect_stdin;
+ else
+ {
+ ::CloseHandle(stdin_handle);
+ if (::SetNamedPipeHandleState(listen_handle, &pipe_mode, NULL, NULL))
+ {
+ // Synchronous pipe.
+ is_cgi_ = false;
+ }
+ else
+ {
+ // error, a TCP socket is being used, which isn't supported
+ // on Windows for now.
+ is_cgi_ = false;
+ ec = error::unsupported_handle_type;
+ }
+ }
+ }
+ else
+ is_cgi_ = true;
+
+ return ec;
+ }
+
+ void set_protocol_service(implementation_type& impl
+ , protocol_service_type& ps)
+ {
+ impl.protocol_service_ = &ps;
+ }
+
+ protocol_service_type&
+ get_protocol_service(implementation_type& impl)
+ {
+ BOOST_CGI_ASSERT(impl.service_ != NULL);
+ return *impl.service_;
+ }
+
+ void construct(implementation_type& impl)
+ {
+ acceptor_service_.construct(impl.acceptor_);
+ }
+
+ void destroy(implementation_type& impl)
+ {
+ // close/reject all the waiting requests
+ acceptor_service_.destroy(impl.acceptor_);
+ }
+
+ void shutdown_service()
+ {
+ acceptor_service_.shutdown_service();
+ }
+
+ /// Check if the given implementation is open.
+ bool is_open(implementation_type& impl)
+ {
+ return listen_handle != INVALID_HANDLE_VALUE;
+ }
+
+ /// Open a new *socket* acceptor implementation.
+ boost::system::error_code
+ open(implementation_type& impl, const native_protocol_type& protocol
+ , boost::system::error_code& ec)
+ {
+ return acceptor_service_.open(impl.acceptor_, protocol, ec);
+ }
+
+ template<typename Endpoint>
+ boost::system::error_code
+ bind(implementation_type& impl, const Endpoint& endpoint
+ , boost::system::error_code& ec)
+ {
+ acceptor_service_.set_option(impl.acceptor_,
+ boost::asio::socket_base::reuse_address(true), ec);
+ return acceptor_service_.bind(impl.acceptor_, endpoint, ec);
+ }
+
+ /// Assign an existing native acceptor to a *socket* acceptor.
+ boost::system::error_code
+ assign(implementation_type& impl, const native_protocol_type& protocol
+ , const native_type& native_acceptor
+ , boost::system::error_code& ec)
+ {
+ return acceptor_service_.assign(impl.acceptor_, protocol
+ , native_acceptor, ec);
+ }
+
+ boost::system::error_code
+ listen(implementation_type& impl, int backlog, boost::system::error_code& ec)
+ {
+ return acceptor_service_.listen(impl.acceptor_, backlog, ec);
+ }
+
+ void do_accept(implementation_type& impl
+ , accept_handler_type handler)
+ {
+ request_ptr new_request;
+
+ if (impl.waiting_requests_.empty())
+ {
+ // Accepting on new request.
+ new_request = request_type::create(*impl.service_);
+ }
+ else
+ {
+ // Accepting on existing request.
+ new_request = impl.waiting_requests_.front();
+ impl.waiting_requests_.pop();
+ }
+
+ impl.running_requests_.insert(new_request);
+
+ // The waiting request may be open if it is a multiplexed request.
+ // If we can reuse this request's connection, return.
+ if (!new_request->is_open() && !new_request->client().keep_connection())
+ {
+ // ...otherwise accept a new connection.
+ detail::accept_named_pipe(listen_handle, *new_request->client().connection(), ec);
+ strand_.post(
+ boost::bind(&self_type::handle_accept
+ , this, boost::ref(impl), new_request, handler, _1
+ )
+ );
+ }
+ else
+ {
+ strand_.post(
+ boost::bind(&self_type::handle_accept
+ , this, boost::ref(impl), new_request, handler, boost::system::error_code()
+ )
+ );
+ }
+ }
+
+ void handle_accept(
+ implementation_type& impl, request_ptr new_request,
+ accept_handler_type handler, const boost::system::error_code& ec
+ )
+ {
+ new_request->status(common::accepted);
+ int status = handler(*new_request);
+ impl.running_requests_.erase(impl.running_requests_.find(new_request));
+ if (new_request->is_open()) {
+ new_request->close(http::ok, status);
+ }
+ new_request->clear();
+ impl.waiting_requests_.push(new_request);
+ }
+
+ /// Accepts a request and runs the passed handler.
+ void async_accept(implementation_type& impl
+ , accept_handler_type handler)
+ {
+ strand_.post(
+ boost::bind(&self_type::do_accept,
+ this, boost::ref(impl), handler)
+ );
+ }
+
+ int accept(implementation_type& impl, accept_handler_type handler
+ , endpoint_type* endpoint, boost::system::error_code& ec)
+ {
+ typedef typename std::set<request_ptr>::iterator iter_t;
+ typedef std::pair<iter_t, bool> pair_t;
+
+ request_ptr new_request;
+ pair_t insert_result;
+
+ if (impl.waiting_requests_.empty())
+ {
+ // Accepting on new request.
+ new_request = request_type::create(*impl.service_);
+ }
+ else
+ {
+ // Accepting on existing request.
+ new_request = impl.waiting_requests_.front();
+ impl.waiting_requests_.pop();
+ }
+
+ insert_result = impl.running_requests_.insert(new_request);
+
+ // The waiting request may be open if it is a multiplexed request.
+ if (!new_request->is_open())
+ {
+ // If we can reuse this request's connection, return.
+ if (!new_request->client().keep_connection())
+ {
+ // ...otherwise accept a new connection.
+ detail::accept_named_pipe(listen_handle, *new_request->client().connection(), ec);
+ }
+ }
+ new_request->status(common::accepted);
+ int status = handler(*new_request);
+
+ impl.running_requests_.erase(insert_result.first);
+ if (new_request->is_open()) {
+ new_request->close(http::ok, status);
+ }
+ new_request->clear();
+ impl.waiting_requests_.push(new_request);
+
+ return status;
+ }
+
+ /// Accepts one request.
+ template<typename CommonGatewayRequest>
+ boost::system::error_code
+ accept(implementation_type& impl, CommonGatewayRequest& request
+ , endpoint_type* endpoint, boost::system::error_code& ec)
+ {
+ BOOST_ASSERT
+ ( ! request.is_open()
+ && "Error: Calling accept on open request (close it first?)."
+ );
+
+ // If the client is open, make sure the request is clean.
+ // ie. don't leak data from one request to another!
+ if (request.client().is_open())
+ {
+ request.clear();
+ }
+
+ // If we can reuse this request's connection, return.
+ if (request.client().keep_connection())
+ return ec;
+
+ detail::accept_named_pipe(listen_handle, *request.client().connection(), ec);
+
+ if (!ec)
+ request.status(common::accepted);
+ return ec;
+ }
+
+ /// Asynchronously accepts one request.
+ template<typename Handler>
+ void async_accept(implementation_type& impl
+ , typename implementation_type::request_type& request
+ , Handler handler)
+ {
+ strand_.post(
+ detail::accept_handler<self_type, Handler>(*this, impl, request, handler)
+ );
+ }
+
+ /// Close the acceptor (not implemented yet).
+ boost::system::error_code
+ close(implementation_type& impl, boost::system::error_code& ec)
+ {
+ return boost::system::error_code(348, boost::system::system_category);
+ }
+
+ typename implementation_type::endpoint_type
+ local_endpoint(implementation_type& impl, boost::system::error_code& ec)
+ {
+ return acceptor_service_.local_endpoint(impl.acceptor_, ec);
+ }
+
+ native_type
+ native(implementation_type& impl)
+ {
+ return acceptor_service_.native(impl.acceptor_);
+ }
+
+ bool
+ is_cgi(implementation_type& impl)
+ {
+ return is_cgi_;
+ }
+
+ public:
+ template<typename CommonGatewayRequest, typename Handler>
+ int check_for_waiting_request(implementation_type& impl
+ , CommonGatewayRequest& request
+ , Handler handler)
+ {
+ // We can't call accept on an open request (close it first).
+ if (request.is_open())
+ return handler(error::accepting_on_an_open_request);
+
+ // If the client is open, make sure the request is clean.
+ // ie. don't leak data from one request to another!
+ if (request.client().is_open())
+ {
+ request.clear();
+ }
+
+ // If we can reuse this request's connection, return.
+ if (request.client().keep_connection())
+ return handler(boost::system::error_code());
+
+ // ...otherwise accept a new connection (asynchronously).
+ acceptor_service_.async_accept(impl.acceptor_,
+ request.client().connection()->next_layer(), 0, handler);
+ return 0;
+ }
+
+ public:
+ /// The underlying socket acceptor service.
+ acceptor_service_type& acceptor_service_;
+ boost::asio::io_service::strand strand_;
+ HANDLE listen_handle;
+ bool is_cgi_;
+ };
+
+ } // namespace fcgi
+BOOST_CGI_NAMESPACE_END
+
+#include "boost/cgi/detail/pop_options.hpp"
+
+#endif // CGI_FCGI_WIN32_ACCEPTOR_SERVICE_IMPL_HPP_INCLUDED_

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/sessions_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/sessions_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/sessions_fwd.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -3,6 +3,7 @@
 #define BOOST_CGI_FWD_SESSIONS_HPP_INCLUDED_
 
 #include "boost/cgi/config.hpp"
+#include <boost/uuid/uuid_generators.hpp>
 
 BOOST_CGI_NAMESPACE_BEGIN
   namespace common {

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -79,8 +79,9 @@
   namespace fcgi {
  
     /// Close the request.
+ template<typename Protocol>
     BOOST_CGI_INLINE int
- fcgi_request_service::close(
+ fcgi_request_service<Protocol>::close(
         implementation_type& impl
       , ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
       , int program_status)
@@ -91,8 +92,9 @@
       return program_status;
     }
 
+ template<typename Protocol>
     BOOST_CGI_INLINE int
- fcgi_request_service::close(
+ fcgi_request_service<Protocol>::close(
         implementation_type& impl
       , ::BOOST_CGI_NAMESPACE::common::http::status_code&
       , int program_status
@@ -116,8 +118,9 @@
       return program_status;
     }
 
+ template<typename Protocol>
     BOOST_CGI_INLINE void
- fcgi_request_service::clear(implementation_type& impl)
+ fcgi_request_service<Protocol>::clear(implementation_type& impl)
     {
       impl.post_buffer_.clear();
       impl.param_buffer_.clear();
@@ -142,8 +145,9 @@
      * packet for this request arrives from the server.
      *
      */
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::load(
+ fcgi_request_service<Protocol>::load(
         implementation_type& impl, common::parse_options opts
       , boost::system::error_code& ec)
     {
@@ -235,9 +239,10 @@
       return ec;
     }
     
+ template<typename Protocol>
     template<typename Handler>
     BOOST_CGI_INLINE
- void fcgi_request_service::do_load(
+ void fcgi_request_service<Protocol>::do_load(
         implementation_type& impl, common::parse_options opts,
         Handler handler, boost::system::error_code& ec
       )
@@ -249,9 +254,10 @@
 
     }
     
+ template<typename Protocol>
     template<typename Handler>
     BOOST_CGI_INLINE
- void fcgi_request_service::handle_read_header(
+ void fcgi_request_service<Protocol>::handle_read_header(
         implementation_type& impl,
         common::parse_options opts,
         Handler handler,
@@ -297,9 +303,10 @@
       }
     }
         
+ template<typename Protocol>
     template<typename Handler>
     BOOST_CGI_INLINE
- void fcgi_request_service::handle_begin_request_header(
+ void fcgi_request_service<Protocol>::handle_begin_request_header(
         implementation_type& impl,
         common::parse_options opts,
         Handler handler,
@@ -349,8 +356,9 @@
     }
 
     // **FIXME**
+ template<typename Protocol>
     template<typename Handler> BOOST_CGI_INLINE
- void fcgi_request_service::async_load(
+ void fcgi_request_service<Protocol>::async_load(
         implementation_type& impl, common::parse_options opts, Handler handler)
     {
       /*
@@ -367,15 +375,17 @@
     }
 
     /// Check if the params have been read (ie. FCGI_PARAMS packets)
+ template<typename Protocol>
     BOOST_CGI_INLINE
- bool fcgi_request_service::params_read(implementation_type& impl)
+ bool fcgi_request_service<Protocol>::params_read(implementation_type& impl)
     {
       return impl.client_.status() >= common::params_read;
     }
 
     /// Read and parse the cgi POST meta variables (greedily)
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code&
- fcgi_request_service::parse_post_vars(
+ fcgi_request_service<Protocol>::parse_post_vars(
         implementation_type& impl
       , boost::system::error_code& ec)
     {
@@ -391,9 +401,10 @@
     }
 
     /// Read and parse a single cgi POST meta variable (greedily)
+ template<typename Protocol>
     template<typename RequestImpl> BOOST_CGI_INLINE
     boost::system::error_code&
- fcgi_request_service::parse_one_post_var(
+ fcgi_request_service<Protocol>::parse_one_post_var(
         implementation_type& impl, boost::system::error_code& ec)
     {
       //# error "Not implemented"
@@ -402,9 +413,10 @@
 
     // **FIXME**
     /// Read some data from the client.
+ template<typename Protocol>
     template<typename MutableBufferSequence>
     BOOST_CGI_INLINE std::size_t
- fcgi_request_service::read_some(
+ fcgi_request_service<Protocol>::read_some(
         implementation_type& impl, const MutableBufferSequence& buf
       , boost::system::error_code& ec)
     {
@@ -424,8 +436,9 @@
 
     /// Read in the FastCGI (env) params
     // **FIXME**
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::read_env_vars(
+ fcgi_request_service<Protocol>::read_env_vars(
         implementation_type& impl, boost::system::error_code& ec)
     {
       while(!ec && !(status(impl) & common::env_read))
@@ -468,8 +481,9 @@
     }
 
     /// Read a single header, but do nothing with it.
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::read_header(
+ fcgi_request_service<Protocol>::read_header(
         implementation_type& impl
       , boost::system::error_code& ec)
     {
@@ -483,9 +497,10 @@
       return ec;
     }
 
+ template<typename Protocol>
     template<typename Handler>
     BOOST_CGI_INLINE void
- fcgi_request_service::async_read_header(
+ fcgi_request_service<Protocol>::async_read_header(
         implementation_type& impl
       , common::parse_options opts
       , Handler handler
@@ -511,23 +526,26 @@
      * better place to live ***/
 
     // **FIXME**
+ template<typename Protocol>
     BOOST_CGI_INLINE void
- fcgi_request_service::handle_admin_request(implementation_type& /* impl */)
+ fcgi_request_service<Protocol>::handle_admin_request(implementation_type& /* impl */)
     {
       //std::cerr<< std::endl << "**FIXME** " << __FILE__ << ":" << __LINE__
       // << " handle_admin_request()" << std::endl;
     }
 
     // **FIXME**
+ template<typename Protocol>
     BOOST_CGI_INLINE void
- fcgi_request_service::handle_other_request_header(implementation_type& /* impl */)
+ fcgi_request_service<Protocol>::handle_other_request_header(implementation_type& /* impl */)
     {
       //std::cerr<< std::endl << "**FIXME** " << __FILE__ << ":" << __LINE__
       // << " handle_other_request_header()" << std::endl;
     }
 
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::process_abort_request(
+ fcgi_request_service<Protocol>::process_abort_request(
         implementation_type& impl, boost::uint16_t id
       , const unsigned char* buf, boost::uint32_t
       , boost::system::error_code& ec)
@@ -547,8 +565,9 @@
       return ec;
     }
 
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::process_params(
+ fcgi_request_service<Protocol>::process_params(
         implementation_type& impl, boost::uint16_t id
       , const unsigned char* buf, boost::uint32_t len
       , boost::system::error_code& ec)
@@ -604,9 +623,9 @@
       return ec;
     }
 
-
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::process_stdin(
+ fcgi_request_service<Protocol>::process_stdin(
         implementation_type& impl, boost::uint16_t id
       , const unsigned char* buf, boost::uint32_t len
       , boost::system::error_code& ec)
@@ -620,8 +639,9 @@
     }
 
     /// Parse the current header
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::tribool
- fcgi_request_service::parse_header(implementation_type& impl)
+ fcgi_request_service<Protocol>::parse_header(implementation_type& impl)
     {
       BOOST_ASSERT(fcgi::spec::get_version(impl.header_buf_) == 1
                    && "This library is only compatible with FastCGI 1.0");
@@ -654,8 +674,9 @@
       }
     }
 
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::parse_packet(
+ fcgi_request_service<Protocol>::parse_packet(
         implementation_type& impl, boost::system::error_code& ec)
     {
       if (this->read_header(impl, ec))
@@ -690,9 +711,10 @@
     }
 
     /// Read the body of the current packet; do nothing with it.
+ template<typename Protocol>
     template<typename MutableBuffersType> BOOST_CGI_INLINE
     boost::system::error_code
- fcgi_request_service::read_body(
+ fcgi_request_service<Protocol>::read_body(
         implementation_type& impl, const MutableBuffersType& buf
       , boost::system::error_code& ec)
     {
@@ -705,9 +727,10 @@
       return ec;
     }
 
+ template<typename Protocol>
     template<typename MutableBuffersType> BOOST_CGI_INLINE
     boost::system::error_code
- fcgi_request_service::parse_body(
+ fcgi_request_service<Protocol>::parse_body(
         implementation_type& impl, const MutableBuffersType& buf
       , boost::system::error_code& ec)
     {
@@ -734,10 +757,11 @@
       return ec;
     }
 
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::begin_request_helper(
+ fcgi_request_service<Protocol>::begin_request_helper(
         implementation_type& impl
- , implementation_type::header_buffer_type& header
+ , header_buffer_type& header
       , boost::system::error_code& ec)
     {
        impl.client_.request_id_ = fcgi::spec::get_request_id(header);
@@ -770,8 +794,9 @@
 BOOST_CGI_NAMESPACE_BEGIN
  namespace fcgi {
 
+ template<typename Protocol>
     BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::process_begin_request(
+ fcgi_request_service<Protocol>::process_begin_request(
         implementation_type& impl, boost::uint16_t id
       , const unsigned char* buf, boost::uint32_t
       , boost::system::error_code& ec)

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/sessions.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/sessions.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/sessions.hpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -14,6 +14,7 @@
 #include <boost/serialization/utility.hpp>
 #include <boost/serialization/map.hpp>
 #include <boost/noncopyable.hpp>
+#include <boost/uuid/uuid.hpp>
 ///////////////////////////////////////////////////////////
 #include "boost/cgi/import/write.hpp"
 #include "boost/cgi/common/header.hpp"

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -45,6 +45,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cgi_custom_sessions", "cgi_custom_sessions\cgi_custom_sessions.vcproj", "{FF4B6C26-B292-47FF-89B6-F2930AAA020B}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sessions_quickstart", "sessions_quickstart\sessions_quickstart.vcproj", "{F254F24F-5249-4A73-A6DA-61DF9BFDC489}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -139,6 +141,10 @@
                 {FF4B6C26-B292-47FF-89B6-F2930AAA020B}.Debug|Win32.Build.0 = Debug|Win32
                 {FF4B6C26-B292-47FF-89B6-F2930AAA020B}.Release|Win32.ActiveCfg = Release|Win32
                 {FF4B6C26-B292-47FF-89B6-F2930AAA020B}.Release|Win32.Build.0 = Release|Win32
+ {F254F24F-5249-4A73-A6DA-61DF9BFDC489}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F254F24F-5249-4A73-A6DA-61DF9BFDC489}.Debug|Win32.Build.0 = Debug|Win32
+ {F254F24F-5249-4A73-A6DA-61DF9BFDC489}.Release|Win32.ActiveCfg = Release|Win32
+ {F254F24F-5249-4A73-A6DA-61DF9BFDC489}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookies/cgi_cookies.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookies/cgi_cookies.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookies/cgi_cookies.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -89,7 +89,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\index.html&quot; &quot;c:\code\c++\boost.cgi\templates\index.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\main.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\main.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\style.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\style.css&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\index.html&quot; &quot;c:\code\c++\boost.cgi\stencils\index.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
                 <Configuration
@@ -167,7 +167,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\index.html&quot; &quot;c:\code\c++\boost.cgi\templates\index.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\main.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\main.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\style.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\style.css&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies\index.html&quot; &quot;c:\code\c++\boost.cgi\stencils\index.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/cgi_ctemplate_cookie_game.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/cgi_ctemplate_cookie_game.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/cgi_ctemplate_cookie_game.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -88,7 +88,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\style.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\style.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\main.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\main.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\index.html&quot; &quot;c:\code\c++\boost.cgi\templates\index.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\style.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\style.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\main.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\main.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\index.html&quot; &quot;c:\code\c++\boost.cgi\stencils\index.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
                 <Configuration
@@ -164,7 +164,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\style.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\style.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\main.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\main.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\index.html&quot; &quot;c:\code\c++\boost.cgi\templates\index.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\style.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\style.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\main.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\main.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\cookies2\index.html&quot; &quot;c:\code\c++\boost.cgi\stencils\index.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\debug_view.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\debug_view.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.html&quot; &quot;c:\code\c++\boost.cgi\templates\debug_view.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\default_view.html&quot; &quot;c:\code\c++\boost.cgi\templates\default_view.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\debug_view.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\debug_view.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.html&quot; &quot;c:\code\c++\boost.cgi\stencils\debug_view.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\default_view.html&quot; &quot;c:\code\c++\boost.cgi\stencils\default_view.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
                 <Configuration
@@ -163,7 +163,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\debug_view.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\debug_view.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.html&quot; &quot;c:\code\c++\boost.cgi\templates\debug_view.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\default_view.html&quot; &quot;c:\code\c++\boost.cgi\templates\default_view.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\debug_view.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\debug_view.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\debug_view.html&quot; &quot;c:\code\c++\boost.cgi\stencils\debug_view.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\DebugServer2\default_view.html&quot; &quot;c:\code\c++\boost.cgi\stencils\default_view.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -165,7 +165,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -162,7 +162,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser_debug/cgi_file_browser_debug.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser_debug/cgi_file_browser_debug.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser_debug/cgi_file_browser_debug.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -162,7 +162,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -162,7 +162,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_quickstart/cgi_quickstart.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_quickstart/cgi_quickstart.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_quickstart/cgi_quickstart.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -85,7 +85,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -160,7 +160,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_sessions/cgi_sessions.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_sessions/cgi_sessions.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_sessions/cgi_sessions.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -85,7 +85,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -160,7 +160,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_stencil/cgi_stencil.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_stencil/cgi_stencil.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_stencil/cgi_stencil.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -89,7 +89,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.html&quot; &quot;c:\code\c++\boost.cgi\templates\cgi_stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.include.html&quot; &quot;c:\code\c++\boost.cgi\templates\cgi_stencil.include.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.html&quot; &quot;\code\c++\boost.cgi\stencils\cgi_stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.include.html&quot; &quot;\code\c++\boost.cgi\stencils\cgi_stencil.include.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
                 <Configuration
@@ -166,7 +166,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.html&quot; &quot;c:\code\c++\boost.cgi\templates\cgi_stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.include.html&quot; &quot;c:\code\c++\boost.cgi\templates\cgi_stencil.include.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.html&quot; &quot;\code\c++\boost.cgi\stencils\cgi_stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\stencil\stencil.include.html&quot; &quot;\code\c++\boost.cgi\stencils\cgi_stencil.include.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_upload/cgi_upload.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_upload/cgi_upload.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_upload/cgi_upload.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -88,7 +88,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\upload\upload.html&quot; &quot;c:\code\c++\boost.cgi\templates\cgi_upload.html&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\upload\upload.html&quot; &quot;c:\code\c++\boost.cgi\stencils\cgi_upload.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
                 <Configuration
@@ -164,7 +164,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\upload\upload.html&quot; &quot;c:\code\c++\boost.cgi\templates\cgi_upload.html&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\cgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\cgi\upload\upload.html&quot; &quot;c:\code\c++\boost.cgi\stencils\cgi_upload.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fastcgi_quickstart/fastcgi_quickstart.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fastcgi_quickstart/fastcgi_quickstart.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fastcgi_quickstart/fastcgi_quickstart.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -86,6 +86,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -160,6 +161,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -90,7 +90,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\amortization.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\amortization.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;c:\code\c++\boost.cgi\templates\amortization.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;$(ProjectDir)\templates\amortization.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.css&quot; &quot;\code\c++\boost.cgi\htdocs\css\amortization.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.js&quot; &quot;\code\c++\boost.cgi\htdocs\js\amortization.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;\code\c++\boost.cgi\stencils\amortization.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;$(ProjectDir)\stencils\amortization.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
                 <Configuration
@@ -166,7 +166,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\amortization.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\amortization.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;c:\code\c++\boost.cgi\templates\amortization.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;$(ProjectDir)\templates\amortization.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.css&quot; &quot;\code\c++\boost.cgi\htdocs\css\amortization.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.js&quot; &quot;\code\c++\boost.cgi\htdocs\js\amortization.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;\code\c++\boost.cgi\stencils\amortization.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;$(ProjectDir)\stencils\amortization.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_async_echo/fcgi_async_echo.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_async_echo/fcgi_async_echo.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_async_echo/fcgi_async_echo.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -161,7 +161,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo/fcgi_echo.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo/fcgi_echo.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo/fcgi_echo.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -116,7 +116,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="3"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE; _SCL_SECURE_NO_WARNINGS"
                                 RuntimeLibrary="2"
                                 EnableFunctionLevelLinking="true"
                                 UsePrecompiledHeader="0"
@@ -161,7 +161,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -162,7 +162,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -87,7 +87,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -164,7 +164,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -85,7 +85,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
                 <Configuration
@@ -159,7 +159,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_stencil/fcgi_stencil.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_stencil/fcgi_stencil.vcproj (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_stencil/fcgi_stencil.vcproj 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -89,7 +89,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;mkdir &quot;$(ProjectDir)\templates&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.html&quot; &quot;$(ProjectDir)\templates\stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.include.html&quot; &quot;$(ProjectDir)\templates\stencil.include.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;mkdir &quot;$(ProjectDir)\templates&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.html&quot; &quot;$(ProjectDir)\stencils\stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.include.html&quot; &quot;$(ProjectDir)\stencils\stencil.include.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
                 <Configuration
@@ -166,7 +166,7 @@
                         />
                         <Tool
                                 Name="VCPostBuildEventTool"
- CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;mkdir &quot;$(ProjectDir)\templates&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.html&quot; &quot;$(ProjectDir)\templates\stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.include.html&quot; &quot;$(ProjectDir)\templates\stencil.include.html&quot;&#x0D;&#x0A;"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;mkdir &quot;$(ProjectDir)\templates&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.html&quot; &quot;$(ProjectDir)\stencils\stencil.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\stencil\stencil.include.html&quot; &quot;$(ProjectDir)\stencils\stencil.include.html&quot;&#x0D;&#x0A;"
                         />
                 </Configuration>
         </Configurations>

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/cgi.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/cgi.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/cgi.qbk 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -7,7 +7,7 @@
 
 [library CGI
     [quickbook 1.5]
- [version 0.02]
+ [version 0.6]
     [dirname the_document_dir]
     [copyright 2007-2009 Darren Garvey]
     [purpose Documentation for CGI / FastCGI Library]

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/introduction.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/introduction.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/introduction.qbk 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -17,9 +17,9 @@
   response resp;
 
   resp<< "Hello there, Universe. "
- << "-- " << req[get]["name"];
+ << "-- " << req.get["name"];
 
- return_(req, resp, 0); // write the response and 'return 0;' to the OS
+ return commit(req, resp); // write the response
 }
 ``
 
@@ -34,7 +34,7 @@
 
 ``
 
-This CGI library is a reasonably high-level library for creating CGI, FastCGI or SCGI programs. Its scope is intentionally limited to the ''controller'' portion of the Model-View-Controller idiom. In other words, XML/HTML templates are not addressed, even if their use is highly recommended.
+This CGI library is a reasonably high-level library for creating CGI or FastCGI programs. Its scope is intentionally limited to the ''controller'' portion of the Model-View-Controller idiom. In other words, XML/HTML templates are not addressed, even if their use is highly recommended.
 
 [tip
   The __amort_example__ example uses Google cTemplate for dealing with HTML templates. Consider having a look at it, or at the upcoming ''Karma'' part of Boost.Spirit.

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/requests/loading.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/requests/loading.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/requests/loading.qbk 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -46,7 +46,8 @@
 
   // ...
 
- // Load the request now (including parsing stdin)
+ // Load the request now (including parsing stdin).
+ // Passing an `error_code` argument stops exceptions being thrown.
   boost::system::error_code& ec;
   request.load(cgi::parse_all, ec);
 
@@ -70,8 +71,10 @@
 
 int handler(fcgi::request& request)
 {
+ // It is undefined behaviour to use a request without loading it.
     request.load(fcgi::parse_env); // minimal parsing.
     
+ // Create a Response
     fcgi::response response;
     response<< "Hello, world.";
     return fcgi::commit(request, response);
@@ -82,7 +85,7 @@
   // Create a ProtocolService
   fcgi::service service;
 
- // Create an acceptor
+ // Create a RequestAcceptor
   fcgi::acceptor acceptor(service);
 
   int status(0);

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/responses.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/responses.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/overview/responses.qbk 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -3,9 +3,14 @@
 
 ['[*TODO]: Document using Responses]
 
-While you may sometimes want to respond to a request by writing directly back to the client, more often that not it is preferable to buffer your response. You can never tell how successful a request is going to be from the start(or when an exception is going to be throw), so being able to rewrite your response at any time is a requirement.
+While you may sometimes want to respond to a request by writing directly back to the client, more often that not it is preferable to buffer your response. You can never tell how successful a request is going to be from the start, or whether an exception is going to be throw. Being able to rewrite your response at any time is a requirement for real-world applications.
 
-The library provides the [classref cgi::response] class to make buffering your response simpler. Here is an example of using it:
+The library provides the [classref boost::cgi::response response] class to make buffering your response simpler. Here is an example of using it:
+
+[tip
+ If you're keen to use HTML templates, consider looking at the [classref boost::cgi::stencil stencil] class, which uses cTemplate to allow you to write
+maintainable [@http://wikipedia.org/wiki/Model%2Dview%2Dcontroller Model-View-Controller] apps. This class is just a wrapper over cTemplate and is [*currently experimental].
+]
 
 [section:example Short Example]
 

Deleted: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/0-old-fastcgi_quickstart.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/0-old-fastcgi_quickstart.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
+++ (empty file)
@@ -1,119 +0,0 @@
-
-//[fastcgi_main
-
-/*<
-We start off with the following:
->*/
-#include <boost/cgi/fcgi.hpp>
-namespace fcgi = boost::fcgi;
-
-/*<
-Now the body of the FastCGI handler:
->*/
-int main(int,char**)
-{
- fcgi::request req;
-
-/*<
-At this point, the environment variables are accessible. This includes cookie
-and form variables too, which by default are all parsed (this is optional).
-
-The `response` class provides a streaming interface for writing replies. You
-can write to the request object directly, but for now we're going to just
-use the `response`, which works well for most situations.
-
-Writing to a `response` is buffered - whereas writing to the request directly
-isn't - so if an error occurs, you can simply `clear()` the response and send
-an error message, which is much cleaner than sending half a response to the
-client, followed by "... Sorry, I just broke!".
->*/
-
- fcgi::response resp;
-
-/*<
-Let's assume you now want to check if the user has a cookie, "user_name",
-set. We get at it like this:
->*/
-
- std::string user_name( req.cookies["user_name"] );
-
-/*<
-If it's set, we'll be polite and say hello. If you are used to CGI
-programming, you'll notice the lack of any HTTP headers. If you don't want to
-bother with headers, a default header `'Content-type: text/plain'` is sent,
-followed by the usual HTTP end-of-line `'\r\n'` and a blank line which
-indicates the end of the headers and the start of content.
->*/
-
- if (!user_name.empty())
- {
- resp<< "Hello there, " << req.cookies["user_name"] << ". How are you?";
-
-/*<
-That's all we want to say for now, so just send this back and quit.
->*/
- return fcgi::commit(req, resp);
- }
-
-/*<
-If the cookie isn't set, we will check if the user has posted a __GET__/
-__POST__ form with their name.
->*/
- user_name = req.form["user_name"];
-
- if (!user_name.empty())
- {
-/*<
-If they have told us their name, we should set a cookie so we remember it next
-time. Then we can say hello and exit. There are two ways to set a cookie:
-either directly using `req.set_cookie("user_name", user_name)` or the method
-below. You can also send an expiry date and a path for the cookie.[footnote
-See [@http://tools.ietf.org/html/rfc822 RFC822] for more
-]
-
-Note that if you set a cookie with no value, the cookie will be deleted.
-
-Again, the request object isn't buffered, so we are going to keep using the
-`response` in case something breaks and we end up not wanting to set the
-cookie. The cookie we set below will expire when the client closes their
-browser.
-
-This time, we shall send a Date header. If we do this (ie. send a header
-ourselves), we must also set the Content-type header and terminate the
-headers, like below.
->*/
-
- resp<< fcgi::cookie("user_name", user_name)
- << header("Date", "Tue, 15 Nov 1994 08:12:31 GMT")
- << header("Content-type", "text/plain")
- << "Hello there, " << user_name << ". You're new around here.";
-
- return fcgi::commit(req, resp);
- }
-
-/*<
-Now, if we have no idea who they are, we'll send a form asking them for their
-name. As the default `"Content-type"` header is `"text/plain"`, we'll change
-this to `"text/html"` so the user's browser will display the HTML form. You
-can do this using
-``
-set_header(req, "Content-type", "text/html")
-``
-or
-``
-resp<< header("Content-type", "text/html")
-``
-Since writing with raw strings is error-prone, the shortcut below is the recommended way
-to set the content-type:
->*/
-
- resp<< fcgi::content_type("text/html")
- << "Hello there. What's your name?" "<p />"
- "<form method='POST'>"
- "<input type='text' name='user_name' />"
- "<input type='submit' />";
-
- /*< This is all we want to do for now, so we can send the response and exit. >*/
- return fcgi::commit(req, resp);
-}
-//]

Deleted: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/Copy of fastcgi_quickstart.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/Copy of fastcgi_quickstart.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
+++ (empty file)
@@ -1,254 +0,0 @@
-// -- fastcgi_quickstart.cpp --
-//
-// Copyright (c) Darren Garvey 2009.
-// 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)
-//
-////////////////////////////////////////////////////////////////
-
-//[fastcgi_quickstart
-
-#include <iostream> // for std::cerr
-
-/*<
-A catch-all header is available which includes all of the headers you should
-need for CGI.
-
-For the sake of clarity we alias the `boost::fcgi` namespace rather than
-dumping all of the library names with a `using namespace`. This way, you can
-see what comes from the library.
->*/
-#include <boost/cgi/fcgi.hpp>
-namespace cgi = boost::fcgi;
-
-/*<
-The first thing to do is write a handler function which takes a request and a
-response and does all request-specific work. Later, we will look at writing
-the code that calls this function.
->*/
-int handle_request(fcgi::request& req, fcgi::response& resp)
-{
-/*<
-In our request handler, we will assume that the request has been fully-parsed
-and we can access all of the request data. The request data is available using
-`std::map<>`-like public members of a `fcgi::request`.[footnote
-The data is stored internally in a single `fusion::vector<>`]
-
-A FastCGI request has several types of variables available. These are listed
-in the table below, assuming that `req` is an instance of `fcgi::request`:
-
-[table
- [[Source] [Variable] [Description]]
- [
- [Environment] [`req.env`] [The environment of a FastCGI request contains
- most of the information you will need to handle a request. There is a basic
- set of common environment variables that you can expect to be set by most
- HTTP servers around. A list of them is available on the __TODO__ (link)
- variables page.]
- ]
- [
- [GET] [`req.get`] [The variables passed in the query string of an HTTP GET
- request.]
- ]
- [
- [POST] [`req.post`] [The HTTP POST data that is sent in an HTTP request's
- body. File uploads are not stored in this map.]
- ]
- [
- [Cookies] [`req.cookies`] [Cookies are sent in the HTTP_COOKIE environment
- variable. These can store limited amounts session information on the client's
- machine, such as database session ids or tracking information.]
- ]
- [
- [File Uploads] [`req.uploads`] [File uploads, sent in an HTTP POST where
- the body is MIME-encoded as multipart/form-data. Uploaded files are read
- onto the server's file system. The value of an upload variable is the path
- of the file.]
- ]
- [
- [Form] [`req.form`] [The form variables are either the GET variables or
- the POST variables, depending on the request method of the request.]
- ]
-]
-
-Let's assume you now want to check if the user has a cookie, "user_name",
-set. We can check if a user has a cookie set like this:
->*/
- if (req.cookies.count("user_name"))
- {
-/*<
-First, we need to be able to clear the cookie we are setting. We will reset
-the cookie if the user navigates to `"/path/to/script?reset=1"`.
-
-The `reset` variable in the query string is a GET variable. The request data
-is accessed through a proxy class which works just like a `std::map<>` with
-some extra features.
-
-One of them is `pick`, which looks up a key in the map and returns the value
-if it is found. Otherwise it returns a default value, which is the second
-argument.
-
-The default value can be any type that supports
-[@http://boost.org/libs/lexical_cast Boost.Lexical_cast]. If the key isn't
-found in the map, or the value cannot be cast to the type of the default
-value, the default is returned.
->*/
- if (req.get.pick<std::string>("reset", "") == "1")
- {
- resp<< cgi::cookie("user_name") /*<
-Set a cookie with no value to delete it.
->*/
- << cgi::redirect(req, req.script_name()) /*<
-The `cgi::redirect` free function returns a `"Location"` header that will
-redirect the user to the specified URL. This URL can be a relative or absolute
-but an absolute URL is always returned. To perform an internal redirect, use
-`cgi::location` instead.
->*/
- << cgi::content_type("text/plain");
- }
- else
- {
- std::string user_name( req.cookies["user_name"] );
-/*<
-Looking up a request cookie in `req.cookies` really returns a `cgi::cookie`.
-The line above works though because a `cgi::cookie` is implicitly convertible
-to a `std::string`.
-
-The lookup is case-insensitive, so "USER_NAME" and "User_Name" would be
-equivalent lookup keys.
-
-If the cookie is set, we'll be polite and say hello.
->*/
- if (!user_name.empty())
- {
- resp<< cgi::content_type("text/html")
- << "<p>Hello there, " << req.cookies["user_name"]
- << ". How are you?</p>"
- << "<a href=\"" << req.script_name() << "?reset=1\">Reset</a>";
- }
- }
- } else
- if (req.form.count("user_name"))
- {
-/*<
-If the cookie isn't set, we will check if the user has posted a __GET__/
-__POST__ form with their name.
->*/
- std::string user_name (req.form["user_name"]);
-/*<
-If they have told us their name, we should set a cookie so we remember it next
-time. Then we can say hello and exit.
-
-There are two ways to set a cookie: either directly using
-`req.set_cookie("user_name", user_name)` or the method shown. You can also
-send an expiry date and a path for the cookie.[footnote
-See [@http://tools.ietf.org/html/rfc822 RFC822] for more.
-]
-Note that if you set a cookie with no value, the cookie will be deleted.
-
-Again, the request object isn't buffered, so we are going to keep using the
-`response` in case something breaks and we end up not wanting to set the
-cookie. The cookie we set below will expire when the client closes their
-browser.
-
-This time, we shall send a Date header. If we do this (ie. send a header
-ourselves), we must also set the Content-type header, like below.
->*/
- resp<< cgi::cookie("user_name", user_name)
- << cgi::header("Date", "Tue, 15 Nov 1994 08:12:31 GMT")
- << cgi::content_type("text/html")
- << "Hello there, " << user_name << ". You're new around here."
- << "user_name.length() = " << user_name.length() ;
- }
- else
- {
-/*<
-Now, if we have no idea who they are, we'll send a form asking them for their
-name. As the default `"Content-type"` header is `"text/plain"`, we'll change
-this to `"text/html"` so the user's browser will display the HTML form. You
-can do this using
- `set_header(req, "Content-type", "text/html")`
-or
- `resp<< header("Content-type", "text/html")`.
-Since writing with raw strings is error-prone, the shortcut below is available.
->*/
- resp<< cgi::content_type("text/html")
- << "Hello there. What's your name?" "<p />"
- "<form method='POST'>"
- "<input type='text' name='user_name' />"
- "<input type='submit' />";
-
- }
-/*<
-Finally, send the response back and close the request.
->*/
- return cgi::commit(req, resp);
-}
-
-/*<
-We now have a request handler in all of it's contrived glory.
-
-The program's `main` function needs to parse the request, call the request
-handler defined above, and finally send the response.
->*/
-int main(int, char**)
-{
- cgi::service service;
-/*<
-An `Acceptor` handles accepting requests and little else.
->*/
- cgi::acceptor acceptor(service, 8010);
-/*<
-The `response` class provides a streaming interface for writing replies. You
-can write to the request object directly, but for now we're going to just
-use the `response`, which works well for most situations.
-
-Writing to a `response` is buffered. If an error occurs, you can simply
-`clear()` the response and send an error message instead. Buffered writing
-may not always suit your use-case (eg. returning large files), but when memory
-is not at a real premium, buffering the response is highly preferable.
-
-Not only does buffering avoid network latency issues, but being able to cancel
-the response and send another is much cleaner than sending half a response,
-followed by "...Ooops". A `cgi::response` is not tied to a request, so the
-same response can be reused across multiple requests.
-
-When sending a response that is large relative to the amount of memory
-available to the program, you may want to write unbuffered.
->*/
- cgi::response response;
- int status;
-
-/*<
-Keep accepting requests until the handler returns an error.
->*/
- do {
-/*<
-The function `boost::fcgi::acceptor::accept` has a few overloads. The one used
-here takes a function or function object with the signature:
-``
-boost::function<int (boost::fcgi::request&)>
-``
-ie. A function that takes a reference to a `request` and returns an `int`.
-The returned `int` should be non-zero if the request was handled with
-an error.
-
-Since our handler has been defined to take references to a `request` and a
-`response`, we can use [@http://boost.org/libs/bind Boost.Bind] to wrap our
-function to give it the signature we need. See the documentation of Boost.Bind
-and [@http://boost.org/libs/function Boost.Function] for more information .
->*/
- status = acceptor.accept(boost::bind(&handle_request, _1, boost::ref(response)));
- if (status) {
- std::cerr
- << "Request handled with error. Exit code: " << status << std::endl
- << "Response body follows: " << std::endl
- << response << std::endl;
- }
- response.clear();
- } while (!status);
- return status;
-}
-
-//]

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/fastcgi_quickstart.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/fastcgi_quickstart.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/tutorial/fastcgi_quickstart.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -192,9 +192,8 @@
 A Service handles asynchronous operations and some of the protocol-specific
 bits.
>*/
- fcgi::acceptor acceptor(service, 8008); /*<
-An `Acceptor` handles accepting requests and little else. The `8008` argument
-is the port on the localhost to listen on.
+ fcgi::acceptor acceptor(service); /*<
+An `Acceptor` handles accepting requests and little else.
>*/
   fcgi::response response; /*<
 The `response` class provides a streaming interface for writing replies. You

Added: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/utilities/sessions/sessions_quickstart.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/utilities/sessions/sessions_quickstart.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -0,0 +1,241 @@
+
+/*<
+This example demonstrates using custom session types to carry around
+data suited to your app. In this case, we'll make a dummy authenticated
+CGI app that users can log into.
+
+Note that the example uses cTemplate to construct the page, for the sake
+of clarity. You will need to install cTemplate to compile the example
+yourself.
+>*/
+
+//[sessions_quickstart
+
+/*<
+Session support is an optional component of the library. To use sessions,
+just define `BOOST_CGI_ENABLE_SESSIONS` before including the library
+headers.
+
+Sessions are supported by using Boost.Serialization, so you'll need to
+link to the library. On Windows, the linking should be done automatically.
+>*/
+#define BOOST_CGI_ENABLE_SESSIONS
+#include <boost/cgi/cgi.hpp>
+#include <boost/cgi/utility/stencil.hpp>
+#include <boost/date_time/posix_time/time_serialize.hpp>
+
+using namespace std;
+namespace cgi = boost::cgi;
+
+/// A basic class that hold site user's information.
+class user
+{
+public:
+ string id;
+ string name;
+ string email;
+ string location;
+
+ // This class is Serializable.
+ template<typename Archive>
+ void serialize(Archive& ar, const unsigned /* version */)
+ {
+ ar & id & name & email & location;
+ }
+};
+
+/// The user_manager class checks credentials and logs users in.
+/*<
+For the purposes of this example, this class is just a stub that
+knows about one user: guest.
+
+In reality this would do more thorough validation on the authentication
+information and look to a database to check the user's credentials and
+retrieve their user information.
+>*/
+class user_manager
+{
+public:
+ /// A dummy implementation of a login function.
+ /*<
+ For this example, we just have one user, "guest" with a password
+ of "password".
+ >*/
+ template<typename RequestData>
+ bool login(RequestData& data, user& usr)
+ {
+ if (data.count("name") && data.count("pass")) {
+ if (data["name"] == "guest" && data["pass"] == "password") {
+ usr.id = "1";
+ usr.name = "guest";
+ usr.email = "\"Guest\" <guest_at_[hidden]>";
+ usr.location = "Liverpool, England, UK";
+ return true;
+ }
+ }
+ return false;
+ }
+};
+
+/// Our custom session class.
+/*< This class must be both DefaultConstructible and Serializable. >*/
+struct my_session
+{
+ /// Your session class must be DefaultConstrutible.
+ my_session()
+ : last_accessed(boost::posix_time::microsec_clock::universal_time())
+ {
+ }
+
+ /// The last-accessed time for the user. Defaults to now.
+ boost::posix_time::ptime last_accessed;
+
+ /// User information.
+ user info;
+
+ /// Your session class must be Serializable.
+ template<typename Archive>
+ void serialize(Archive& ar, const unsigned /* version */)
+ {
+ ar & last_accessed & info;
+ }
+};
+
+/*<
+The library uses tag-dispatching to determine which types to use
+internally to make things work. You can specialise the `protocol_traits`
+class template to customise parts of the library at compile-time.
+The `protocol_traits` template is specialised for the protocols
+supported by the library (ie. CGI and FastCGI).
+
+To define a custom type to use for sessions, you can define a
+"tag" (just an empty struct) and then specialise `protocol_traits`
+for this tag. You should put this specialisation into the
+`boost::cgi::common` namespace so it can be found via ADL.
+
+In general, you will inherit most of the characteristics of either
+CGI or FastCGI and override one or two types. You can do this by
+inheriting from either `protocol_traits<tags::cgi>` or
+`protocol_traits<tags::fcgi>`.
+
+eg. This is overriding a protocol the long way.
+
+struct mycgi; // The protocol tag
+
+namespace boost { namespace cgi { namespace common {
+
+ template<>
+ struct protocol_traits<mycgi>
+ : protocol_traits<tags::cgi>
+ {
+ // some custom traits.
+ };
+
+}}} // namespace boost::cgi::common
+
+// Then add typedefs to use the custom tag struct.
+struct mycgi {
+ typedef boost::cgi::common::basic_protocol_service<mycgi> service;
+ typedef boost::cgi::common::basic_request_acceptor<mycgi> acceptor;
+ typedef boost::cgi::common::basic_request<mycgi> my_request;
+};
+
+ The `BOOST_CGI_OVERRIDE_PROTOCOL` macro is available as a shortcut
+ for the above. You pass the protocol as the first argument, the
+ name of your "tag" as the second and the third is a brace-enclosed
+ list of traits. The code between the braces is actually the body of
+ the specialised `protocol_traits<>` class template.
+
+ When you use `BOOST_CGI_OVERRIDE_PROTOCOL`, you will end up with a
+ struct with nested typedefs for `request`, `service` and `acceptor`.
+>*/
+
+/// Declare a custom protocol `mycgi`.
+BOOST_CGI_OVERRIDE_PROTOCOL(cgi, mycgi, {
+ typedef basic_session<my_session> session_type;
+ static const bool auto_start_session = false;
+})
+
+int main(int, char**)
+{
+ try
+ {
+ mycgi::request req; // Our custom request type.
+ cgi::stencil resp; // A basic wrapper over cTemplate.
+ user_manager user_mgr;
+
+ resp.set("last_accessed",
+ boost::posix_time::to_simple_string(req.session.last_accessed));
+
+ if (req.form.count("login"))
+ {
+ if (user_mgr.login(req.form, req.session.info)) {
+ // Mark the request so when you call `commit`, the session is saved.
+ req.start_session();
+ // Redirect them back to where they started.
+ resp<< cgi::redirect(req, req.script_name());
+ } else {
+ resp.set("user_name", req.form["name"]);
+ // Show the HAS_ERROR section and set the {{error}} token.
+ resp.set("error", "Login failed.", "HAS_ERROR");
+ // Show all LOGIN_FORM sections.
+ resp.show("LOGIN_FORM");
+ }
+ }
+ else
+ if (req.form.count("logout"))
+ {
+ /*<
+ We call `stop_session` to close the session. This call deletes the
+ session data stored on the server, but leaves the session object
+ stored in memory as is. The session cookie itself is only removed
+ when you call `commit`, later.
+ req.stop_session();
+ Redirect the user. This causes a "Location" header to be added to
+ the response.
+ >*/
+ resp<< cgi::redirect(req, req.script_name());
+ }
+ else
+ if (!req.session.info.name.empty())
+ {
+ resp.set("user_name", req.session.info.name);
+ resp.set("user_email", req.session.info.email);
+ resp.set("user_location", req.session.info.location);
+ resp.show("AUTHENTICATED_PAGE");
+ }
+ else
+ {
+ resp.show("DEFAULT_PAGE");
+ resp.show("LOGIN_FORM");
+ }
+
+ /*<
+ This is where the response is actually built up, using the specified
+ stencil: In this case we send back an HTML page. This could easily
+ be turned into an AJAX-style page by constructing a stencil that looks
+ like JSON when expanded and setting the content-type to
+ `"application/json"`.
+
+ Note that if the template looks like JSON, cTemplate can be very
+ clever and auto-escape the content so you get valid JSON. For more
+ info, take a look at the ctemplate documentation:
+ @ http://code.google.com/p/google-ctemplate/
+ >*/
+ resp.expand("../stencils/login.html");
+ resp<< cgi::content_type("text/html");
+
+ req.session.last_accessed = boost::posix_time::microsec_clock::universal_time();
+
+ // Send the response and save session data.
+ return cgi::commit(req, resp);
+
+ } catch (std::exception& e) {
+ cerr<< "Error: " << e.what() << endl;
+ } catch (...) {
+ cerr<< "Unknown error" << endl;
+ }
+
+ cout<< "Content-type: text/html\r\n\r\nAn error occurred.";
+}
+//]
\ No newline at end of file

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -1,7 +1,7 @@
 #include "TracebackServer.hpp"
 #include <boost/chrono/chrono.hpp>
 
-#define TBS_TEMPLATE__DEBUG_VIEW "../templates/debug_view.html"
+#define TBS_TEMPLATE__DEBUG_VIEW "../stencils/debug_view.html"
 
 namespace detail {
 

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -137,11 +137,11 @@
     dict.SetValue("SCRIPT_NAME", req.script_name());
     // pick() looks up the key in the map, returns a default value
     // (ie. anonymous) if the key isn't found.
- dict.SetValue("COOKIE_NAME", req.form.pick("name", "anonymous"));
+ dict.SetValue("COOKIE_NAME", req.form["name"]);
     dict.SetValue("COOKIE_VALUE", req.form["value"]);
 
     // Load the HTML stencil now from the index.html file.
- stencil_type* stencil = get_stencil("../templates/index.html");
+ stencil_type* stencil = get_stencil("../stencils/index.html");
 
     // Expand the stencil with the the given dictionary into `output`.
     std::string output;

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -22,7 +22,7 @@
   
   // Construct a response that uses Google cTemplate. Also sets the root
   // directory where the stencils are found.
- stencil resp("../templates/");
+ stencil resp("../stencils/");
 
   //// Test 1.
 

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/upload/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/upload/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/upload/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -22,7 +22,7 @@
   // as well as cookies.
   cgi::request req;
   // Using a response is the simplest way to write data back to the client.
- cgi::stencil resp("../templates/");
+ cgi::stencil resp("../stencils/");
   
   resp<< cgi::content_type("text/html");
   resp.set("filename", req.post["file"]);

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -106,7 +106,7 @@
   fill_amortization_dictionary(dict, req);
 
   ctemplate::Template* tmpl
- = ctemplate::Template::GetTemplate("../templates/amortization.html", ctemplate::STRIP_WHITESPACE);
+ = ctemplate::Template::GetTemplate("../stencils/amortization.html", ctemplate::STRIP_WHITESPACE);
 
   std::string h("Content-type: text/html\r\n\r\n");
   write(req.client(), buffer(h));
@@ -175,7 +175,7 @@
   try{
 
     service s;
- acceptor a(s, 8010); // Listen on port 8010.
+ acceptor a(s);
 
     for(;;)
     {

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/charts/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/charts/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/charts/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -24,7 +24,7 @@
   
   // Construct a response that uses Google cTemplate. Also sets the root
   // directory where the stencils are found.
- stencil resp("templates/");
+ stencil resp("stencils/");
 
   //// Test 1.
 

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -120,10 +120,10 @@
            "Process ID = " << process_id() << "<br />"
            "<form method=post enctype=\"multipart/form-data\">"
              "<input type=text name=name value='"
- << req.post["name"] << "' />"
+ << req.post.pick("name", "") << "' />"
              "<br />"
              "<input type=text name=hello value='"
- << req.post["hello"] << "' />"
+ << req.post.pick("hello", "") << "' />"
              "<br />"
              "<input type=file name=user_file />"
              "<input type=hidden name=cmd value=multipart_test />"
@@ -161,23 +161,18 @@
 {
 try {
 
- std::cerr<< "*** Ping! ***" << '\n';
   // Make a `service` (more about this in other examples).
   service s;
   
   // Make an `acceptor` for accepting requests through.
-#if defined (BOOST_WINDOWS)
- acceptor a(s, 8009); // Accept requests on port 8009.
-#else
   acceptor a(s);
-#endif // defined (BOOST_WINDOWS)
 
   //
   // After the initial setup, we can enter a loop to handle one request at a
   // time until there's an error of some sort.
   //
   int ret(0);
- for (;;)
+ for (int i(5);i;--i)
   {
     //
     // An acceptor can take a request handler as an argument to `accept` and it

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/file_browser/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/file_browser/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/file_browser/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -337,11 +337,7 @@
   // Make a `service` (more about this in other examples).
   service s;
   
- using boost::asio::ip::tcp;
-
- // Accept requests on port 8001. You should configure your HTTP
- // server to try to connect on this port.
- acceptor a(s, 8001);
+ acceptor a(s);
 
   int ret(0);
   for (;;)

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -58,16 +58,7 @@
   try
   {
     service s; // This becomes useful with async operations.
-#if defined (BOOST_WINDOWS)
- // On Windows, set up an external server to listen on port 8008.
- // You will need to set your HTTP server to use port 8008.
- acceptor a(s, 8008);
-#else
- // On Linux, you can do the above, or just accept on the default
- // socket. This means setup of your HTTP server is simpler and
- // FastCGI processes can be started automatically by your server.
     acceptor a(s);
-#endif // defined (BOOST_WINDOWS)
 
     for (;;)
     {

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -22,7 +22,7 @@
   
   // Construct a response that uses Google cTemplate. Also sets the root
   // directory where the stencils are found.
- stencil resp("templates/");
+ stencil resp("stencils/");
 
   //// Test 1.
 
@@ -116,7 +116,7 @@
 {
 try {
   service s;
- acceptor a(s, 8018);
+ acceptor a(s);
   
   // Handle requests (one at a time) until the counter overflows.
   for(unsigned count(1);count;++count)

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/upload/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/upload/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/upload/main.cpp 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -24,7 +24,7 @@
   // as well as cookies.
   cgi::request req(service);
   
- cgi::acceptor acceptor(service, 8050);
+ cgi::acceptor acceptor(service);
   
   int ret(0);
   

Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2 2010-04-20 16:54:35 EDT (Tue, 20 Apr 2010)
@@ -7,7 +7,8 @@
   : requirements
     <library>/boost/test//boost_unit_test_framework/
     <library>/boost/system/
- <linkflags>-pthread
+ <library>/boost/serialization//boost_serialization/
+ #<os>:<linkflags>-pthread
     #<library>/boost/thread/
     #<library>/boost/regex/
   ;
@@ -29,14 +30,15 @@
     #[ run name_test.cpp ]
     #[ run map_test.cpp ]
     #[ run parse_options.cpp ]
- [ run data_map_proxy.cpp ]
+ #[ run data_map_proxy.cpp ]
+ [ run sessions.cpp ]
     #[ run has_key.cpp ]
   ;
 
-test-suite wget_test
- :
+#test-suite wget_test
+# :
     #[ run wget.cpp : "--log_level=message" ]
- [ run hello_world.cpp /boost/filesystem/ ]
- ;
+# [ run hello_world.cpp /boost/filesystem/ ]
+# ;
 
-explicit wget_test ;
+#explicit wget_test ;


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