Boost logo

Boost-Commit :

From: lists.drrngrvy_at_[hidden]
Date: 2008-05-21 08:25:53


Author: drrngrvy
Date: 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
New Revision: 45605
URL: http://svn.boost.org/trac/boost/changeset/45605

Log:
More refactorings. Plus a couple of minor bug fixes (like multiple-definition of things in url_decode.hpp
Added:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp
      - copied, changed from r45579, /sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service_fwd.hpp
      - copied, changed from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service_fwd.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp
      - copied, changed from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider_fwd.hpp
      - copied, changed from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider_fwd.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/role_type.hpp
      - copied unchanged from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/role_type.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/form_parser.ipp
      - copied unchanged from r45556, /sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.ipp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/import/
   sandbox/SOC/2007/cgi/trunk/boost/cgi/import/#
      - copied unchanged from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/write.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/import/buffer.hpp
      - copied unchanged from r45579, /sandbox/SOC/2007/cgi/trunk/boost/cgi/common/buffer.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/import/io_service.hpp
      - copied unchanged from r45579, /sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/import/read.hpp
      - copied unchanged from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/read.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/import/streambuf.hpp
      - copied unchanged from r45579, /sandbox/SOC/2007/cgi/trunk/boost/cgi/common/streambuf.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/import/write.hpp (contents, props changed)
Removed:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_gateway.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_gateway_fwd.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service_fwd.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/buffer.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.ipp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/streambuf.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider_fwd.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/map.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/read.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/request.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/request_base.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/request_ostream.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/response.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/role_type.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/status_type.hpp
   sandbox/SOC/2007/cgi/trunk/boost/cgi/write.hpp
Text files modified:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi.hpp | 7 ---
   sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_impl.hpp | 2 +
   sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_service.hpp | 6 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/service.hpp | 6 +--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp | 4 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp | 27 +++++++------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp | 4 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_fwd.hpp | 9 ++--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_impl.hpp | 4 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/service.hpp | 2
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp | 6 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service_fwd.hpp | 5 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp | 2
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp | 2 +
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp | 18 ++++----
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider_fwd.hpp | 7 ++-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp | 3 +
   sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp | 2
   sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp | 5 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp | 4 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_request_impl_base.hpp | 8 ++--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_service_impl_base.hpp | 4 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp | 15 +++----
   sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp | 3 +
   sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp | 10 +++--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp | 78 +++++----------------------------------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp | 14 +++---
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp | 8 ++--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp | 6 +-
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp | 18 ++++----
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp | 2
   sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp | 7 +--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/request_service.hpp | 8 +--
   33 files changed, 125 insertions(+), 181 deletions(-)

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -9,15 +9,8 @@
 #ifndef CGI_ACGI_HPP_INCLUDED__
 #define CGI_ACGI_HPP_INCLUDED__
 
-// #include all acgi-related headers only
 #include "boost/cgi/acgi/service.hpp"
 #include "boost/cgi/acgi/request.hpp"
-//#include "boost/cgi/acgi/request_service.hpp"
-//#include "boost/cgi/acgi/request_impl.hpp"
-//#include "gateway_impl/acgi_gateway_impl.hpp"
-//#include "gateway_service/acgi_gateway_service.hpp"
-
-// Include headers common to all protocols
 #include "boost/cgi/detail/common_headers.hpp"
 
 namespace cgi {

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_impl.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -11,6 +11,7 @@
 
 #include "boost/cgi/acgi/service.hpp"
 #include "boost/cgi/basic_client.hpp"
+#include "boost/cgi/common/status_type.hpp"
 #include "boost/cgi/connections/async_stdio.hpp"
 #include "boost/cgi/detail/cgi_request_impl_base.hpp"
 
@@ -47,3 +48,4 @@
 } // namespace cgi
 
 #endif // CGI_ASYNC_CGI_REQUEST_IMPL_HPP_INCLUDED__
+

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/request_service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -9,14 +9,14 @@
 #ifndef CGI_ACGI_SERVICE_IMPL_HPP_INCLUDED__
 #define CGI_ACGI_SERVICE_IMPL_HPP_INCLUDED__
 
-#include "boost/cgi/acgi/request_impl.hpp"
 #include "boost/cgi/tags.hpp"
-#include "boost/cgi/io_service.hpp"
 #include "boost/cgi/common/map.hpp"
-#include "boost/cgi/detail/cgi_service_impl_base.hpp"
+#include "boost/cgi/acgi/request_impl.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/detail/service_base.hpp"
 #include "boost/cgi/detail/extract_params.hpp"
 #include "boost/cgi/connections/async_stdio.hpp"
+#include "boost/cgi/detail/cgi_service_impl_base.hpp"
 
 namespace cgi {
 

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -9,10 +9,8 @@
 #ifndef CGI_CGI_SERVICE_HPP_INCLUDED__
 #define CGI_CGI_SERVICE_HPP_INCLUDED__
 
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp" // order matters
 #include "boost/cgi/tags.hpp"
-//#include "boost/cgi/gateway_impl/acgi_gateway_impl.hpp"
-//#include "boost/cgi/gateway_service/acgi_gateway_service.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
 
@@ -46,6 +44,6 @@
 
 } // namespace cgi
 
-#include "boost/cgi/basic_protocol_service.hpp"
+#include "boost/cgi/common/basic_protocol_service.hpp"
 
 #endif // CGI_CGI_SERVICE_HPP_INCLUDED__

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 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -12,8 +12,8 @@
 #include <boost/shared_ptr.hpp>
 ///////////////////////////////////////////////////////////
 #include "boost/cgi/common/map.hpp"
-#include "boost/cgi/role_type.hpp"
-#include "boost/cgi/status_type.hpp"
+#include "boost/cgi/common/role_type.hpp"
+#include "boost/cgi/common/status_type.hpp"
 #include "boost/cgi/http/status_code.hpp"
 #include "boost/cgi/connections/tcp_socket.hpp"
 

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_gateway.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_gateway.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,192 +0,0 @@
-// -- basic_gateway.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_BASIC_GATEWAY_HPP_INCLUDED__
-#define CGI_BASIC_GATEWAY_HPP_INCLUDED__
-
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include "basic_protocol_service_fwd.hpp"
-//#include "basic_connection.hpp"
-#include "detail/protocol_traits.hpp"
-
-namespace cgi {
-
- /// The gateway class manages connections
- /**
- * New connections are accepted through here, via a call to accept();
- * used/corrupted connections are closed via a call to stop(conn_ptr);
- * all connections are closed via a call to stop_all().
- *
- * If you want to use the gateway after a call to stop_all(), you must
- * call reset() and pass it the maximum number of connections the gateway
- * can take.
- */
- template<typename Protocol>
- class basic_gateway
- {
- public:
- //typedef CommonGatewayService service_type;
- //typedef typename CommonGatewayService::protocol_type protocol_type;
- typedef Protocol protocol_type;
- typedef basic_protocol_service<protocol_type> protocol_service_type;
-
- typedef detail::protocol_traits<protocol_type> traits;
- typedef typename traits::connection_type connection_type;
- typedef typename traits::gateway_impl_type impl_type;
- typedef typename traits::gateway_service_type service_type;
- typedef boost::shared_ptr<connection_type> conn_ptr;
-
- /// Constructors
- explicit basic_gateway(protocol_service_type& pservice)
- : service_(pservice)
- {
- service_.construct(impl_);
- }
-
- explicit basic_gateway()
- {
- service_.construct(impl_);
- }
-
- /// Destructor
- ~basic_gateway()
- {
- service_.destroy(impl_);
- }
-
- /// Start a sychronous accept
- /**
- * This returns false unless the connection is already established. This is
- * true with standard CGI, for example, where the connection is simply a
- * wrapper over standard input/output.
- *
- * If there is a need to differentiate between a fail and a 'waiting' accept
- * then a tribool could be returned from here.
- */
-/* ** NOT BELONGING HERE ** (should be encapsulated in the acceptor classes)
- template<typename Request>
- boost::system::error_code&
- accept(Request& request, boost::system::error_code& ec)
- {
- if( service_.accept(request.connection(), ec) )
- {
- connections_.insert(request.connection());
- }
-
- return ec;
-
- //conn_ptr new_conn(connection_type::create());
- //acceptor_.accept(new_conn->socket()
- // , boost::bind(&cgi::gateway::handle_accept
- // , this, new_conn
- // , boost::placeholders::error));
- //return false;
- }
-
- /// Start an asynchronous accept
- template<typename Handler>
- void async_accept(conn_ptr conn, Handler handler)
- {
- service_.async_accept(handler);
- }
-*/
- /// Cleanly start the connection
- void start(conn_ptr cptr)
- {
- service_.start(impl_, cptr);
- //cptr->start();
- //protocol_service_.connections_.insert(cptr);
- }
-
- /// Cleanly stop the connection
- void stop(conn_ptr cptr)
- {
- //service_.stop(impl_, cptr);
- //BOOST_ASSERT(protocol_service_.connections_.find(cptr));
-
- //cptr->stop();
- //protocol_service_.connections_.erase(cptr);
- }
-
- /// Cleanly stop all connections
- void stop()
- {
- service_.stop(impl_);
- //std::for_each(protocol_service_.connection_.begin()
- // , protocol_service_.connections_.end()
- // , boost::bind(&connection_type::stop, _1));
- //protocol_service_.connections_.clear();
- }
-
- /// Reset the gateway
- /**
- * All connections are gracefully closed and then the gateway is set up for
- * reuse.
- *
- * @param max_connections the available slots is reset to this value
- */
- void reset(int max_connections)
- {
- service_.reset(impl_);
- //stop();
- //available_slots_ = max_connections;
- }
-
- private:
- //protocol_service_type& protocol_service_;
- service_type service_;
- impl_type impl_;
- //std::set<conn_ptr> connections_;
- };
-
-
-
- //template<>
- //class gateway<cgi_service>
- //{
- //public:
- // gateway()
- // {
- // }
- //private:
- //
- //};
-
- /*
- template<>
- class gateway::acceptor<tags::fastcgi>
- {
- public:
- gateway::acceptor
- {
- }
- private:
- boost::asio::ip::tcp::acceptor<
- };
- */
-
-} // namespace cgi
-
-#endif // CGI_BASIC_GATEWAY_HPP_INCLUDED__
-
-/*
- * Notes:
- *
- * 1. A FastCGI server doesn't have to use tcp sockets: it can use pipes
- * instead. Support for these will only come in when Boost.Asio supports them.
- *
- * 2. For now each request object could hold a pointer/reference to the
- * connection that it's associated with. For the forseable future that's going
- * to be enough. However, since the FastCGI spec doesn't say otherwise,
- * eventually it could happen that the response can be sent back via ANY open
- * connection. In that case, the request would have to query the gateway to
- * find an available connection before sending through it. For now, that's
- * unneccesary.
- */

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_gateway_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_gateway_fwd.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,19 +0,0 @@
-// -- basic_gateway_fwd.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_BASIC_GATEWAY_FWD_HPP_INCLUDED__
-#define CGI_BASIC_GATEWAY_FWD_HPP_INCLUDED__
-
-namespace cgi {
-
- template<typename>
- class basic_gateway;
-
-} // namespace cgi
-
-#endif // CGI_BASIC_GATEWAY_FWD_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,153 +0,0 @@
-// -- basic_protocol_service.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_BASIC_PROTOCOL_SERVICE_HPP_INCLUDED__
-#define CGI_BASIC_PROTOCOL_SERVICE_HPP_INCLUDED__
-
-#include <set>
-#include <queue>
-///////////////////////////////////////////////////////////
-#include <boost/shared_ptr.hpp>
-#include <boost/asio/strand.hpp>
-#include <boost/detail/workaround.hpp>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/common/io_service.hpp"
-#include "boost/cgi/io_service_provider.hpp"
-#include "boost/cgi/basic_request_fwd.hpp"
-#include "boost/cgi/detail/protocol_traits.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
-
-namespace cgi {
- namespace common {
-
- /// Basic Protocol Service
- /**
- * Holds the request queue and the connection queue.
- * It is also a wrapper around asio::io_service
- */
- template<typename Protocol, typename IoServiceProvider>
- class basic_protocol_service
- //: public protocol_traits<Protocol> // do this!
- {
- public:
- typedef Protocol protocol_type;
- typedef IoServiceProvider ios_provider_type;
- typedef typename detail::protocol_traits<Protocol>::type traits;
- typedef typename traits::request_type request_type;
- typedef typename boost::shared_ptr<request_type> request_ptr;
- typedef std::set<request_ptr> set_type;
- //typename boost::mpl::if_<
- // boost::is_same<protocol_type, tags::acgi>::value
- // , request_type::pointer
- // , std::set<request_type::pointer>
- // >::type
-
- typedef std::queue<request_ptr> queue_type;
-
- basic_protocol_service(int pool_size_hint = 1)
- : ios_provider_(pool_size_hint)
- //, strand_(ios_provider_.io_service())
- //, gateway_(*this)
- {
- }
-
- basic_protocol_service(boost::asio::io_service& ios)
- : ios_provider_(ios)
- //, strand_(ios)
- //, gateway_(*this)
- {
- }
-
- ~basic_protocol_service()
- {
- //gateway_.stop();
- }
-
- /// Run all the io_services contained by this service
- /**
- * This is equivalent to calling run() on each of the io_services held by
- * ios_provider_
- */
- void run()
- {
- ios_provider_.run();
- }
-
- /// Stop all the io_services contained by this service
- /**
- * This is equivalent to calling stop() on each of the io_services held by
- * ios_provider_
- */
- void stop()
- {
- //gateway_.stop();
- ios_provider_.stop();
- }
-
- /// Reset all the io_services contained by this service
- /**
- * This deletes the request queue(s), aborts all running requests and then
- * calls reset() on each of the io_services held by ios_provider_. There is
- * no guarantee that requests will terminate immediately.
- */
- void reset()
- {
- request_queue_.clear();
- //std::for_each(request_set_.begin(), request_set_.end()
- // , boost::bind(&request_type::abort, boost::arg<1>()));
- request_set_.clear();
- ios_provider_.reset();
- }
-
- /// Return an available io_service from the IoServiceProvider
- /**
- * The order in which the underlying io_services are returned is determined
- * by what policy the IoServiceProvider uses.
- */
- ::cgi::io_service& io_service()
- {
- return ios_provider_.get_io_service();
- }
-
- /// Post the handler through an available io_service
- template<typename Handler>
- void post(Handler handler)
- {
- ios_provider_.get_io_service().post(handler);
- }
-
- /// Dispatch a handler through an available io_service
- template<typename Handler>
- void dispatch(Handler handler)
- {
- ios_provider_.get_io_service().dispatch(handler);
- }
-
- private:
- ios_provider_type ios_provider_;
-
- /// A strand is used for guaranteeing handlers are dispatched sequentially
- //boost::asio::strand strand_;
-
- /// A std::set of all the requests.
- set_type request_set_;
- /// A std::queue of the waiting (ie. not-being-handled) requests.
- queue_type request_queue_;
-
-#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400))
- friend typename traits::request_type;//typename request_type;
-#else
- friend class traits::request_type;
-#endif
- //friend class request_type;
- };
-
- } // namespace common
-} // namespace cgi
-
-#endif // CGI_BASIC_PROTOCOL_SERVICE_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service_fwd.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,30 +0,0 @@
-// -- basic_protocol_service_fwd.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_BASIC_PROTOCOL_SERVICE_FWD_HPP_INCLUDED__
-#define CGI_BASIC_PROTOCOL_SERVICE_FWD_HPP_INCLUDED__
-
-#if _MSC_VER > 1020
-#pragma once
-#endif
-
-#include "boost/cgi/io_service_provider.hpp"
-
-namespace cgi {
- namespace common {
-
- template<
- typename Protocol,
- typename IoServiceProvider = io_service_provider<>
- >
- class basic_protocol_service;
-
- } // namespace common
-} // namespace cgi
-
-#endif // CGI_BASIC_PROTOCOL_SERVICE_FWD_HPP_INCLUDED__

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 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -16,29 +16,30 @@
 
 #include "boost/cgi/detail/push_options.hpp"
 
-#include <boost/noncopyable.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/assert.hpp>
-#include <boost/system/error_code.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
 #include <boost/asio/io_service.hpp>
+#include <boost/system/error_code.hpp>
 #include <boost/asio/basic_io_object.hpp>
-
-#include "boost/cgi/detail/throw_error.hpp"
-#include "boost/cgi/detail/protocol_traits.hpp"
-#include "boost/cgi/request_base.hpp"
-#include "boost/cgi/role_type.hpp"
-#include "boost/cgi/common/source_enums.hpp"
-#include "boost/cgi/status_type.hpp"
+///////////////////////////////////////////////////////////
+// **FIXME** Half of these are probably useless
 #include "boost/cgi/is_async.hpp"
+#include "boost/cgi/common/map.hpp"
+//#include "boost/cgi/request_base.hpp"
 #include "boost/cgi/connection_base.hpp"
-#include "boost/cgi/http/status_code.hpp"
 #include "boost/cgi/request_service.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/basic_io_object.hpp"
+#include "boost/cgi/common/role_type.hpp"
+#include "boost/cgi/http/status_code.hpp"
 #include "boost/cgi/basic_request_fwd.hpp"
+#include "boost/cgi/detail/throw_error.hpp"
+#include "boost/cgi/common/status_type.hpp"
+#include "boost/cgi/common/source_enums.hpp"
 #include "boost/cgi/basic_sync_io_object.hpp"
-#include "boost/cgi/basic_io_object.hpp"
-#include "boost/cgi/common/map.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
  namespace common {

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 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -10,13 +10,13 @@
 #define CGI_BASIC_REQUEST_ACCEPTOR_HPP_INCLUDED__
 
 #include <boost/noncopyable.hpp>
+#include <boost/asio/ip/tcp.hpp>
 #include <boost/system/error_code.hpp>
 #include <boost/asio/basic_io_object.hpp>
 #include <boost/asio/ip/basic_endpoint.hpp>
-#include <boost/asio/ip/tcp.hpp>
 ///////////////////////////////////////////////////////////
-#include <boost/cgi/basic_protocol_service.hpp>
 #include "boost/cgi/detail/throw_error.hpp"
+#include <boost/cgi/common/basic_protocol_service.hpp>
 
 namespace cgi {
  namespace common {

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_fwd.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -10,10 +10,10 @@
 #define CGI_BASIC_REQUEST_FWD_HPP_INCLUDED__
 
 #include <memory>
-
-#include "request_service_fwd.hpp"
-#include "role_type.hpp"
-#include "basic_protocol_service_fwd.hpp"
+///////////////////////////////////////////////////////////
+#include "boost/cgi/common/role_type.hpp"
+#include "boost/cgi/request_service_fwd.hpp"
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
  namespace common {
@@ -28,3 +28,4 @@
 } // namespace cgi
 
 #endif // CGI_BASIC_REQUEST_FWD_HPP_INCLUDED__
+

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_impl.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -15,12 +15,12 @@
 #include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
 ///////////////////////////////////////////////////////////
-#include "boost/cgi/role_type.hpp"
 #include "boost/cgi/common/map.hpp"
-#include "boost/cgi/status_type.hpp"
 #include "boost/cgi/basic_client.hpp"
+#include "boost/cgi/common/role_type.hpp"
 #include "boost/cgi/http/status_code.hpp"
 #include "boost/cgi/connections/stdio.hpp"
+#include "boost/cgi/common/status_type.hpp"
 #include "boost/cgi/detail/cgi_request_impl_base.hpp"
 
 // Make this ProtocolService-independent

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -12,7 +12,7 @@
 #include "boost/cgi/tags.hpp"
 #include "boost/cgi/connections/stdio.hpp"
 #include "boost/cgi/connections/async_stdio.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
 

Copied: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp (from r45579, /sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service.hpp)
==============================================================================
--- /sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -16,11 +16,11 @@
 #include <boost/asio/strand.hpp>
 #include <boost/detail/workaround.hpp>
 ///////////////////////////////////////////////////////////
-#include "boost/cgi/common/io_service.hpp"
-#include "boost/cgi/io_service_provider.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/basic_request_fwd.hpp"
 #include "boost/cgi/detail/protocol_traits.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/common/io_service_provider.hpp"
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
  namespace common {

Copied: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service_fwd.hpp (from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service_fwd.hpp)
==============================================================================
--- /sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_protocol_service_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service_fwd.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -13,14 +13,14 @@
 #pragma once
 #endif
 
-#include "boost/cgi/io_service_provider.hpp"
+#include "boost/cgi/common/io_service_provider_fwd.hpp"
 
 namespace cgi {
  namespace common {
 
   template<
     typename Protocol,
- typename IoServiceProvider = io_service_provider<>
+ typename IoServiceProvider = common::io_service_provider<>
>
   class basic_protocol_service;
 
@@ -28,3 +28,4 @@
 } // namespace cgi
 
 #endif // CGI_BASIC_PROTOCOL_SERVICE_FWD_HPP_INCLUDED__
+

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/buffer.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/buffer.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,26 +0,0 @@
-// -- buffer.hpp --
-//
-// Copyright (c) Darren Garvey 2007
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_BUFFER_HPP_INCLUDED__
-#define CGI_BUFFER_HPP_INCLUDED__
-
-#include <boost/asio/buffer.hpp>
-
-namespace cgi {
- namespace common {
-
- /// Import the Boost.Asio overloads.
- using boost::asio::buffer;
-
- } // namespace common
-
- using common::buffer;
-
-} // namespace cgi
-
-#endif // CGI_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -105,7 +105,7 @@
 } // namespace cgi
 
 #ifndef BOOST_CGI_BUILD_LIB
-# include "boost/cgi/common/form_parser.ipp"
+# include "boost/cgi/impl/form_parser.ipp"
 #endif
 
 #endif // CGI_DETAIL_FORM_PARSER_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.ipp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,440 +0,0 @@
-// -- form_parser.ihpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_DETAIL_FORM_PARSER_IPP_INCLUDED__
-#define CGI_DETAIL_FORM_PARSER_IPP_INCLUDED__
-
-#include "boost/cgi/basic_client.hpp"
-#include "boost/cgi/common/form_parser.hpp"
-#include "boost/cgi/detail/url_decode.hpp"
-
-namespace cgi {
- namespace detail {
-
- template<typename T>
- form_parser<T>::form_parser
- (
- implementation_type& impl
- )
- : impl_(impl)
- , bytes_left_(impl.client_.bytes_left_)
- //, stdin_data_read_(impl.stdin_data_read_)
- , offset_(0)
- {
- }
-
- template<typename T>
- boost::system::error_code
- form_parser<T>::parse(boost::system::error_code& ec)
- {
- std::string content_type (env_vars(impl_.vars_)["CONTENT_TYPE"]);
-
- BOOST_ASSERT(!content_type.empty());
-
- if (boost::algorithm::ifind_first(content_type,
- "application/x-www-form-urlencoded"))
- {
- parse_url_encoded_form(ec);
- }
- else
- if (boost::algorithm::ifind_first(content_type,
- "multipart/form-data"))
- {
- parse_multipart_form(ec);
- }
- else
- return ec = error::invalid_form_type;
-
- return ec;
- }
-
- template<typename T>
- boost::system::error_code
- form_parser<T>::parse_url_encoded_form(boost::system::error_code& ec)
- {
- std::string name;
- std::string str;
-
- char ch;
- char ch1;
- while( bytes_left_ )
- {
- ch = getchar();
- --bytes_left_;
-
- switch(ch)
- {
- case '%': // unencode a hex character sequence
- if (bytes_left_ >= 2)
- {
- ch = getchar();
- ch1 = getchar();
- if (std::isxdigit(ch) && std::isxdigit(ch1))
- {
- str.append(1, detail::hex_to_char(ch, ch1));
- }
- else // we don't have a hex sequence
- {
- str.append(1, '%').append(1, ch).append(1, ch1);
- }
- bytes_left_ -= 2;
- }
- else // There aren't enough characters to make a hex sequence
- {
- str.append(1, '%');
- --bytes_left_;
- }
- break;
- case '+':
- str.append(1, ' ');
- break;
- case ' ': // skip spaces
- break;
- case '=': // the name is complete, now get the corresponding value
- name.swap(str);
- break;
- case '&': // we now have the name/value pair, so save it
- // **FIXME** have to have .c_str() ?
- post_vars(impl_.vars_)[name.c_str()] = str;
- str.clear();
- name.clear();
- break;
- default:
- str.append(1, ch);
- }
- }
- // save the last param (it won't have a trailing &)
- if( !name.empty() )
- // **FIXME** have to have .c_str() ?
- post_vars(impl_.vars_)[name.c_str()] = str;
-
- return ec;
- }
-
- /// Parse a multipart form.
- template<typename T>
- boost::system::error_code
- form_parser<T>::parse_multipart_form(boost::system::error_code& ec)
- {
- parse_boundary_marker(ec);
-
- move_to_start_of_first_part(ec);
-
- if (ec && ec != boost::asio::error::eof)
- return ec;
-
- do {
- parse_form_part(ec);
- }while( //!impl_.stdin_parsed_
- impl_.client_.bytes_left_ // != 0
- );//&& ec != boost::asio::error::eof );
-
- return ec;
- }
-
-
- template<typename T>
- boost::system::error_code
- form_parser<T>::parse_form_part(boost::system::error_code& ec)
- {
- if (!parse_form_part_meta_data(ec)
- && !parse_form_part_data(ec))
- return ec;
-
- return ec;
- }
-
- template<typename T>
- boost::system::error_code
- form_parser<T>::parse_form_part_data(boost::system::error_code& ec)
- {
- std::string regex("^(.*?)" // the data
- "\\x0D\\x0A" // CR LF
- "--" "(");
- if (boundary_markers.size() > 1)
- {
- std::list<std::string>::iterator i(boundary_markers.begin());
- regex = regex + "(?:" + *i + ")";
- ++i;
- for(; i != boundary_markers.end(); ++i)
- {
- regex = regex + "|(?:" + *i + ")";
- }
- }
- else
- {
- regex += *boundary_markers.begin();
- }
-
- regex += ")(--)?[ ]*\\x0D\\x0A";
- boost::regex re(regex);
-
- typedef buffer_type::iterator buffer_iter;
-
- boost::match_results<buffer_iter> matches;
-
- std::size_t offset = offset_;
-
- //int runs = 0;
- buffer_iter begin(impl_.buffer_.begin() + offset);
- buffer_iter end(impl_.buffer_.end());
-
- for(;;)
- {
- if (!boost::regex_search(begin, end, matches, re
- , boost::match_default
- | boost::match_partial))
- {
- return boost::system::error_code(345, boost::system::system_category);
- }
- else
- {
- if (matches[1].matched)
- {
- form_parts_.back().buffer_
- // = boost::range_iterator<;
- = std::make_pair(matches[1].first, matches[1].second);
- // **FIXME**
- post_vars(impl_.vars_)[form_parts_.back().name.c_str()] = matches[1];
- //std::ofstream of("c:/cc/log/post_vars.log");
- //of<< "var == " << matches[1] << std::endl;
- offset_ = offset + matches[0].length();
- pos_ = matches[0].second;
-
- if (matches[3].matched)
- {
- impl_.client_.bytes_left_ = 0; // stop reading completely.
- //impl_.stdin_parsed_ = true;
- }
- return ec;
- }
- else
- {
- std::size_t bytes_read = impl_.client_.read_some(prepare(64), ec);
-
- if (bytes_read == 0 && impl_.client_.bytes_left_ == 0) // **FIXME**
- {
- //stdin_data_read_ = true;
- return ec;
- }
-
- begin = impl_.buffer_.begin() + offset;
- end = impl_.buffer_.end();
-
- if (ec)
- return ec;
- }
- }
- }
-
- return ec;
- }
-
- template<typename T>
- boost::system::error_code
- form_parser<T>::parse_form_part_meta_data(boost::system::error_code& ec)
- {
- // Oh dear this is ugly. The move to Boost.Spirit will have to be sooner than planned.
- // (it's a nested, recursive pattern, which regexes don't suit, apparently)
- boost::regex re( "(?:" // [IGNORE] the line may be empty, as meta-data is optional
- "^"
- "([-\\w]+)" // name
- ":[ ^]*" // separator
- "([-/\\w]+)" // optional(?) value
- ""
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?"
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?" // mark the extra n/v pairs optional
- "\\x0D\\x0A"
- ")"
- "(?:"
- "([-\\w]+)" // name
- ":[ ^]*" // separator
- "([-/\\w]+)" // optional(?) value
- ""
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?"
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?" // mark the extra n/v pairs optional
- "\\x0D\\x0A" // followed by the end of the line
- ")?"
- "(\\x0D\\x0A)"); // followed by the 'header termination' line
-
- typedef buffer_type::iterator buffer_iter;
-
- boost::match_results<buffer_iter> matches;
-
- std::size_t offset = offset_;
- pos_ = impl_.buffer_.begin();
- int runs = 0;
-
- std::size_t bytes_read = 0;
- for(;;)
- {
- buffer_iter begin(impl_.buffer_.begin() + offset);
- buffer_iter end(impl_.buffer_.end());
-
- if (!boost::regex_search(begin, end, matches, re
- , boost::match_default | boost::match_partial))
- {
- impl_.stdin_parsed_ = true;
- return ec;
- }
- if (matches[0].matched)
- {
- common::form_part part;
- for ( unsigned int i = 1
- ; i < matches.size()
- && matches[i].matched
- && !matches[i].str().empty()
- ; i+=2)
- {
- if (matches[i].str() == "name")
- {
- part.name = matches[i+1];
- }
- else
- {
- part.meta_data_[matches[i]]
- = std::make_pair(matches[i+1].first, matches[i+1].second);
- }
- form_parts_.push_back(part);
- }
-
- if (matches[13].str() == "\r\n")
- {
- offset_ = offset + matches[0].length();
- offset += matches[0].length();
- pos_ = matches[0].second;
-
- return ec;
- }
- else
- {
- throw std::runtime_error("Invalid POST data (header wasn't terminated as expected)");
- }
-
- }else{
- bytes_read = impl_.client_.read_some(prepare(64), ec);
- if (ec)
- return ec;
- if (++runs > 40)
- {
- std::cerr<< "Done 40 runs; bailing out" << std::endl;
- break;
- }
- }
- }
-
- return ec;
- }
-
- template<typename T>
- boost::system::error_code
- form_parser<T>::move_to_start_of_first_part(boost::system::error_code& ec)
- {
- boost::regex re("((?:.*)?" // optional leading characters
- //"(?:\\x0D\\x0A)|^" // start of line
- "[\\x0D\\x0A^]*?"
- "("
- "--" + boundary_markers.front() + // two dashes and our marker
- ")"
- "(--)?" // optional two dashes (not sure if this is allowed)
- " *\\x0D\\x0A)");
- // on the first marker.
-
- typedef buffer_type::iterator buffer_iter;
- //std::cerr<< "Regex := " << re << std::endl;
-
- boost::match_results<buffer_iter> matches;
-
- // get data into our buffer until we reach the first boundary marker.
- int runs = 0;
- std::size_t offset = 0;
- std::size_t bytes_read = 0;
- for(;;)
- {
- bytes_read = impl_.client_.read_some(prepare(32), ec);
- if (ec || (bytes_read == 0))
- return ec;
- buffer_iter begin(impl_.buffer_.begin());// + offset);
- buffer_iter end(impl_.buffer_.end());
- if (!boost::regex_search(begin, end //impl.buffer_.begin(), impl.buffer_.end()
- , matches, re, boost::match_default | boost::match_partial))
- {
- offset = impl_.buffer_.size();
- continue;
- }
- else
- {
- if (matches[2].matched)
- {
- impl_.buffer_.erase(impl_.buffer_.begin(), matches[0].second);
- offset_ = 0;
- pos_ = impl_.buffer_.begin();
- return ec;
- }
- else
- {
- if (++runs > 10)
- return ec;
- continue;
- }
- }
- }
- // skip that line and then erase the buffer
- return ec;
- }
-
- template<typename T>
- boost::system::error_code
- form_parser<T>::parse_boundary_marker(boost::system::error_code& ec)
- {
- // get the meta-data appended to the content_type
- std::string content_type_(env_vars(impl_.vars_)["CONTENT_TYPE"]);
- //BOOST_ASSERT(!content_type.empty());
-
- boost::regex re("; ?boundary=\"?([^\"\n\r]+)\"?");
- boost::smatch match_results;
- if (!boost::regex_search(content_type_, match_results, re))
- return boost::system::error_code(666, boost::system::system_category);
-
- boundary_marker = match_results[1].str();
- // New boundary markers are added to the front of the list.
- boundary_markers.push_front(match_results[1].str());
-
- return ec;
- }
-
-
- } // namespace detail
-} // namespace cgi
-
-#endif // CGI_DETAIL_FORM_PARSER_IPP_INCLUDED__
-

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -15,6 +15,8 @@
 namespace cgi {
  namespace common {
 
+ template<typename CharT> class basic_cookie; // **FIXME** (maybe)
+
   // **FIXME** (could include response_fwd.hpp really)...
   template<typename CharT> class basic_response;
 

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,31 +0,0 @@
-// -- common/io_service.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_COMMON_IO_SERVICE_HPP_INCLUDED__
-#define CGI_COMMON_IO_SERVICE_HPP_INCLUDED__
-
-//#if _MSC_VER > 1020
-//#pragma once
-//#endif
-
-#include <boost/asio/io_service.hpp>
-
-namespace cgi {
- namespace common {
-
- using boost::asio::io_service;
-
- } // namespace common
-
- // This should go?
- using boost::asio::io_service;
-
-} // namespace cgi
-
-#endif // CGI_COMMON_IO_SERVICE_HPP_INCLUDED__
-

Copied: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp (from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp)
==============================================================================
--- /sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -15,18 +15,13 @@
 
 #include "boost/cgi/detail/push_options.hpp"
 
-//#include <list>
-//#include <boost/ref.hpp>
-//#include <boost/bind.hpp>
-//#include <boost/thread.hpp>
-//#include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
-
-#include "boost/cgi/io_service.hpp"
-#include "boost/cgi/io_service_provider_fwd.hpp"
-
+///////////////////////////////////////////////////////////
+#include "boost/cgi/import/io_service.hpp"
+#include "boost/cgi/common/io_service_provider_fwd.hpp"
 
 namespace cgi {
+ namespace common {
 
   /// Hold a set number of io_services and return them based on the Policy
   /**
@@ -269,9 +264,14 @@
     //boost::asio::io_service::strand strand_;
   };
       */
+ } // namespace common
 
+ // **FIXME**
+ using common::io_service_provider;
+
 } // namespace cgi
 
 #include "boost/cgi/detail/pop_options.hpp"
 
 #endif // CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__
+

Copied: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider_fwd.hpp (from r43960, /sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider_fwd.hpp)
==============================================================================
--- /sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider_fwd.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -16,10 +16,13 @@
 #include "boost/cgi/tags.hpp"
 
 namespace cgi {
+ namespace common {
 
- template<typename = tags::single_service>
- class io_service_provider;
+ template<typename = tags::single_service>
+ class io_service_provider;
 
+ } // namespace common
 } // namespace cgi
 
 #endif // CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
+

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -15,11 +15,12 @@
 ///////////////////////////////////////////////////////////
 #include <boost/bind.hpp>
 #include <boost/foreach.hpp>
+#include <boost/shared_ptr.hpp>
 ///////////////////////////////////////////////////////////
 #include "boost/cgi/common/cookie.hpp"
 #include "boost/cgi/common/header.hpp"
 #include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/common/streambuf.hpp"
+#include "boost/cgi/import/streambuf.hpp"
 #include "boost/cgi/basic_request_fwd.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
 

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/streambuf.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/streambuf.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,25 +0,0 @@
-// -- streambuf.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_STREAMBUF_HPP_INCLUDED__
-#define CGI_STREAMBUF_HPP_INCLUDED__
-
-#include <boost/asio/streambuf.hpp>
-
-namespace cgi {
- namespace common {
-
- using boost::asio::streambuf;
-
- } // namespace common
-
- using common::streambuf;
-
-} // namespace cgi
-
-#endif // CGI_STREAMBUF_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -15,7 +15,7 @@
 #include <boost/enable_shared_from_this.hpp>
 
 #include "boost/cgi/connections/stdio.hpp"
-#include "boost/cgi/io_service.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/tags.hpp"
 
 namespace cgi {

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -11,17 +11,18 @@
 
 #include <map>
 #include <set>
+///////////////////////////////////////////////////////////
 #include <boost/asio.hpp>
 #include <boost/cstdint.hpp>
 #include <boost/foreach.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/thread.hpp>
-
+///////////////////////////////////////////////////////////
 #include "boost/cgi/tags.hpp"
 #include "boost/cgi/error.hpp"
-#include "boost/cgi/io_service.hpp"
 #include "boost/cgi/connection_base.hpp"
 #include "boost/cgi/basic_connection.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/detail/push_options.hpp"
 
 //#include "boost/cgi/fcgi/client_fwd.hpp"

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -11,11 +11,11 @@
 
 #include <boost/shared_ptr.hpp>
 #include <boost/asio/ip/tcp.hpp>
-
+///////////////////////////////////////////////////////////
 #include "boost/cgi/tags.hpp"
-#include "boost/cgi/io_service.hpp"
 #include "boost/cgi/connection_base.hpp"
 #include "boost/cgi/basic_connection.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/detail/push_options.hpp"
 
 namespace cgi {

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_request_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_request_impl_base.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_request_impl_base.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -17,11 +17,11 @@
 #include <boost/fusion/support.hpp>
 #include <boost/fusion/include/vector.hpp>
 ///////////////////////////////////////////////////////////
-#include "boost/cgi/role_type.hpp"
 #include "boost/cgi/common/map.hpp"
-#include "boost/cgi/status_type.hpp"
+#include "boost/cgi/common/role_type.hpp"
 #include "boost/cgi/http/status_code.hpp"
 #include "boost/cgi/connections/stdio.hpp"
+#include "boost/cgi/common/status_type.hpp"
 
 namespace cgi {
  namespace detail {
@@ -60,7 +60,7 @@
 
     bool stdin_parsed() { return stdin_parsed_; }
     common::http::status_code& http_status() { return http_status_; }
- status_type& status() { return request_status_; }
+ common::status_type& status() { return request_status_; }
 
     conn_ptr& connection() { return connection_; }
 
@@ -76,7 +76,7 @@
   protected:
 
     common::http::status_code http_status_;
- status_type request_status_;
+ common::status_type request_status_;
 
     conn_ptr connection_;
   };

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_service_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_service_impl_base.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_service_impl_base.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -21,12 +21,12 @@
 #include <boost/system/error_code.hpp>
 #include <boost/algorithm/string/find.hpp>
 ///////////////////////////////////////////////////////////
-#include "boost/cgi/role_type.hpp"
 #include "boost/cgi/common/map.hpp"
-#include "boost/cgi/status_type.hpp"
 #include "boost/cgi/basic_client.hpp"
+#include "boost/cgi/common/role_type.hpp"
 #include "boost/cgi/common/form_part.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
+#include "boost/cgi/common/status_type.hpp"
 #include "boost/cgi/common/form_parser.hpp"
 #include "boost/cgi/common/request_base.hpp"
 #include "boost/cgi/detail/extract_params.hpp"

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -12,18 +12,17 @@
 // #include all protocol-independent headers only. Protocol-specific
 // headers can just include this after other headers.
 
-#include "boost/cgi/common/buffer.hpp"
+//#include "boost/cgi/logger.hpp"
 #include "boost/cgi/common/map.hpp"
-#include "boost/cgi/io_service.hpp"
-#include "boost/cgi/common/streambuf.hpp"
+#include "boost/cgi/import/read.hpp"
+#include "boost/cgi/import/write.hpp"
 #include "boost/cgi/basic_request.hpp"
-//#include "boost/cgi/basic_request_acceptor.hpp"
-#include "boost/cgi/common/response.hpp"
-//#include "boost/cgi/logger.hpp"
-#include "boost/cgi/read.hpp"
-#include "boost/cgi/write.hpp"
+#include "boost/cgi/import/buffer.hpp"
 #include "boost/cgi/common/header.hpp"
 #include "boost/cgi/common/return.hpp"
+#include "boost/cgi/common/response.hpp"
+#include "boost/cgi/import/streambuf.hpp"
 #include "boost/cgi/http/status_code.hpp"
+#include "boost/cgi/import/io_service.hpp"
 
 #endif // CGI_CGI_CGI_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -17,10 +17,11 @@
 #define CGI_REQUEST_TRAITS_HPP_INCLUDED__
 
 #include <boost/shared_ptr.hpp>
+///////////////////////////////////////////////////////////
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/tags.hpp"
 #include "boost/cgi/basic_request_fwd.hpp"
 #include "boost/cgi/basic_connection_fwd.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
 

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -15,9 +15,11 @@
 
 //#endif
 
-#if defined(BOOST_CGI_BUILD_LIB)
-# define BOOST_CGI_INLINE
-#else
-# define BOOST_CGI_INLINE inline
+#if !defined(BOOST_CGI_INLINE)
+# if defined(BOOST_CGI_BUILD_LIB)
+# define BOOST_CGI_INLINE
+# else
+# define BOOST_CGI_INLINE inline
+# endif
 #endif
 

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -9,89 +9,31 @@
 #ifndef CGI_DETAIL_URL_DECODE_HPP_INCLUDED__
 #define CGI_DETAIL_URL_DECODE_HPP_INCLUDED__
 
+#include "boost/cgi/detail/push_options.hpp"
+
 #include <string>
 
 namespace cgi {
  namespace detail {
 
    /// Convert a char into a hexadecimal value
- std::string char_to_hex(char const& ch)
- {
- return std::string();
- }
+ BOOST_CGI_INLINE std::string char_to_hex(char const& ch);
 
    /// Convert two characters into a single, hex-encoded character
- char hex_to_char(char const& c1, char const& c2)
- {
- int ret ( ( std::isalpha(c1)
- ? ((c1 & 0xdf) - 'A') + 10
- : (c1 - '0')
- ) << 4
- );
-
- ret += ( std::isalpha(c2)
- ? ((c2 & 0xdf) - 'A') + 10
- : (c2 - '0')
- );
-
- return static_cast<char>(ret);
- }
+ BOOST_CGI_INLINE char hex_to_char(char const& c1, char const& c2);
 
    /// Take two characters (a hex sequence) and return a char
    // **DEPRECATED**
- char url_decode( const char& c1, const char& c2 )
- {
- int ret = ( (c1 >= 'A' && c1 <= 'Z') || (c1 >= 'a' && c1 <= 'z')
- ? ((c1 & 0xdf) - 'A') + 10
- : (c1 - '0')
- ) << 4;
-
- ret += ( (c2 >= 'A' && c2 <= 'Z') || (c2 >= 'a' && c2 <= 'z')
- ? ((c2 & 0xdf) - 'A') + 10
- : (c2 - '0')
- );
-
- return static_cast<char>(ret);
- }
+ BOOST_CGI_INLINE char url_decode( const char& c1, const char& c2 );
 
    /// URL-decode a string
- std::string url_decode( const std::string& str )
- {
- std::string ret;
-
- for( std::string::const_iterator iter = str.begin(), end = str.end()
- ; iter != end; ++iter )
- {
- switch( *iter )
- {
- case ' ':
- break;
- case '+':
- ret.append(1, ' ');
- break;
- case '%':
- if (std::distance(iter, end) >= 2
- && std::isxdigit(*(iter+1))
- && std::isxdigit(*(iter+2)))
- {
- char ch = *++iter; // need this because order of function arg
- // evaluation is UB.
- ret.append(1, hex_to_char(ch, *++iter));
- }
- else // we're not dealing with a properly encoded hex value.
- {
- ret.append(1, '%');
- }
- break;
- default:
- ret.append(1, *iter);
- }
- }
-
- return ret;
- }
+ BOOST_CGI_INLINE std::string url_decode( const std::string& str );
 
  } // namespace detail
 } // namespace cgi
 
+#include "boost/cgi/detail/url_decode.ipp"
+
+#include "boost/cgi/detail/pop_options.hpp"
+
 #endif // CGI_DETAIL_URL_DECODE_HPP_INCLUDED__

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 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -12,20 +12,20 @@
 #include "boost/cgi/detail/push_options.hpp"
 
 #include <boost/ref.hpp>
-#include <boost/static_assert.hpp>
 #include <boost/bind.hpp>
-#include <boost/asio.hpp>
-#include <boost/shared_ptr.hpp>
+#include <boost/asio.hpp> // **FIXME**
 #include <boost/thread.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/io_service.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/protocol_traits.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/detail/service_base.hpp"
-#include "boost/cgi/fcgi/request.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
    

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -16,12 +16,12 @@
 #include <boost/asio/buffer.hpp>
 ///////////////////////////////////////////////////////////
 #include "boost/cgi/tags.hpp"
-#include "boost/cgi/read.hpp"
 #include "boost/cgi/error.hpp"
 #include "boost/cgi/common/map.hpp"
+#include "boost/cgi/import/read.hpp"
 #include "boost/cgi/basic_client.hpp"
-#include "boost/cgi/common/buffer.hpp"
-#include "boost/cgi/common/io_service.hpp"
+#include "boost/cgi/import/buffer.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/basic_request_fwd.hpp"
 #include "boost/cgi/fcgi/specification.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
@@ -47,7 +47,7 @@
   class basic_client<common::shareable_tcp_connection, Protocol>
   {
   public:
- typedef ::cgi::io_service io_service_type;
+ typedef ::cgi::common::io_service io_service_type;
     typedef ::cgi::common::map map_type;
     typedef Protocol protocol_type;
     typedef common::shareable_tcp_connection connection_type;

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 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -12,12 +12,12 @@
 
 #include <boost/utility/enable_if.hpp>
 ///////////////////////////////////////////////////////////
-#include "boost/cgi/common/io_service.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
-#include "boost/cgi/detail/protocol_traits.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/detail/service_base.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
 #include "boost/cgi/fcgi/acceptor_service_impl.hpp"
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 
 namespace cgi {
 

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 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -14,12 +14,12 @@
 #include <boost/fusion/include/vector.hpp>
 ////////////////////////////////////////////////////////////////
 #include "boost/cgi/tags.hpp"
-#include "boost/cgi/read.hpp"
-#include "boost/cgi/role_type.hpp"
 #include "boost/cgi/common/map.hpp"
 #include "boost/cgi/fcgi/client.hpp"
+#include "boost/cgi/import/read.hpp"
 #include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/common/io_service.hpp"
+#include "boost/cgi/common/role_type.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
 #include "boost/cgi/common/source_enums.hpp"
 #include "boost/cgi/common/request_base.hpp"
@@ -83,7 +83,7 @@
         : client_()
         , stdin_parsed_(false)
         , http_status_(::cgi::common::http::no_content)
- , request_status_(unloaded)
+ , request_status_(common::unloaded)
         , request_role_(spec_detail::ANY)
         , all_done_(false)
       {
@@ -95,7 +95,7 @@
 
       bool stdin_parsed_;
       ::cgi::common::http::status_code http_status_;
- status_type request_status_;
+ common::status_type request_status_;
       fcgi::spec_detail::role_t request_role_;
 
       bool all_done_;
@@ -198,8 +198,8 @@
       common::cookie_vars(impl.vars_).clear();
       common::env_vars(impl.vars_).clear();
       impl.stdin_parsed_ = false;
- impl.http_status_ = http::no_content;
- impl.request_status_ = null;
+ impl.http_status_ = common::http::no_content;
+ impl.request_status_ = common::null;
       impl.request_role_ = spec_detail::ANY;
       impl.all_done_ = false;
 
@@ -260,7 +260,7 @@
 
       while(!ec
         && impl.client_.status() < completion_condition
- && impl.request_status_ != loaded)
+ && impl.request_status_ != common::loaded)
       {
         //impl.client_.parse_packet(impl, ec);
         parse_packet(impl, ec);
@@ -411,7 +411,7 @@
     {
       if (id == fcgi::spec::get_request_id(impl.header_buf_))
       {
- impl.request_status_ = aborted;
+ impl.request_status_ = common::aborted;
         return ec;
       }
       try {

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -10,7 +10,7 @@
 #define CGI_FCGI_SERVICE_HPP_INCLUDED__
 
 #include "boost/cgi/tags.hpp"
-#include "boost/cgi/basic_protocol_service.hpp"
+#include "boost/cgi/common/basic_protocol_service.hpp"
 
 namespace cgi {
 

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -19,12 +19,12 @@
 #include <boost/foreach.hpp>
 #include <boost/bind.hpp>
 ///////////////////////////////////////////////////////////
-#include "boost/cgi/write.hpp"
-#include "boost/cgi/common/buffer.hpp"
+#include "boost/cgi/import/write.hpp"
+#include "boost/cgi/import/buffer.hpp"
 #include "boost/cgi/common/cookie.hpp"
 #include "boost/cgi/common/header.hpp"
 #include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/common/streambuf.hpp"
+#include "boost/cgi/import/streambuf.hpp"
 #include "boost/cgi/basic_request_fwd.hpp"
 #include "boost/cgi/detail/throw_error.hpp"
 

Added: sandbox/SOC/2007/cgi/trunk/boost/cgi/import/write.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/import/write.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -0,0 +1,27 @@
+// -- write.hpp --
+//
+// Copyright (c) Darren Garvey 2007.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+////////////////////////////////////////////////////////////////
+#ifndef CGI_WRITE_HPP_INCLUDED
+#define CGI_WRITE_HPP_INCLUDED
+
+#include <boost/asio/write.hpp>
+
+namespace cgi {
+ namespace common {
+
+ using boost::asio::write;
+ using boost::asio::async_write;
+
+ } // namespace common
+
+ //using common::write;
+ //using common::async_write;
+
+} // namespace cgi
+
+#endif // CGI_WRITE_HPP_INCLUDED

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,14 +0,0 @@
-// -- io_service.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_IO_SERVICE_HPP_INCLUDED__
-#define CGI_IO_SERVICE_HPP_INCLUDED__
-
-#include "boost/cgi/common/io_service.hpp"
-
-#endif // CGI_IO_SERVICE_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,277 +0,0 @@
-// -- io_service_provider.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__
-#define CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__
-
-#if _MSC_VER > 1020
-#pragma once
-#endif
-
-#include "boost/cgi/detail/push_options.hpp"
-
-//#include <list>
-//#include <boost/ref.hpp>
-//#include <boost/bind.hpp>
-//#include <boost/thread.hpp>
-//#include <boost/shared_ptr.hpp>
-#include <boost/noncopyable.hpp>
-
-#include "boost/cgi/io_service.hpp"
-#include "boost/cgi/io_service_provider_fwd.hpp"
-
-
-namespace cgi {
-
- /// Hold a set number of io_services and return them based on the Policy
- /**
- * Contains six member functions:
- * io_service() - returns a reference to an io_service
- * stop() - stops all io_services
- * run() - runs all io_services
- * reset() - resets all io_services
-
- * (strike) stop_one() - stops one (running) io_service
- * (strike) run_one() - runs one (not-yet-started/reset) io_service
- *
- * It can also be set up so that only required io_services are run:
- * each call to io_service() can get an io_service, call io_service::run() on
- * it and then return it.
- */
- template<typename PoolingPolicy>
- class io_service_provider
- : private boost::noncopyable
- {
- public:
- io_service_provider(int)
- : io_service_()
- {
- }
-
- io_service_provider()
- : io_service_()
- {
- }
-
- ::cgi::common::io_service&
- get_io_service()
- {
- return io_service_;
- }
-
- void run()
- {
- io_service_.run();
- }
-
- void stop()
- {
- io_service_.stop();
- }
-
- void reset()
- {
- io_service_.reset();
- }
- private:
- ::cgi::common::io_service io_service_;
- };
-
-
- /*
- template<>
- class io_service_provider<tags::service_pool>
- {
- public:
- typedef std::list<cgi::io_service> impl_type;
-
- io_service_provider(int pool_size)
- : io_services_(pool_size)
- , current_(io_services_.begin())
- {
- }
-
- cgi::io_service& io_service()
- {
- return boost::ref(*current_++);
- }
-
- void run()
- {
- std::for_each(io_services_.begin(), io_services_.end()
- , boost::bind(&cgi::io_service::run, boost::ref(_1)));
- }
-
- void stop()
- {
- std::for_each(io_services_.begin(), io_services_.end()
- , boost::bind(&cgi::io_service::stop, boost::ref(_1)));
- }
-
- void reset()
- {
- std::for_each(io_services_.begin(), io_services_.end()
- , boost::bind(&cgi::io_service::reset, boost::ref(_1)));
- }
-
- impl_type& impl()
- {
- return io_services_;
- }
-
- private:
- impl_type io_services_;
- impl_type::iterator current_;
- };
- */
-
- /// Specialization for multi-queue/single-io_service strategy
- /**
- * Holds a reference to a passed in io_service. Use of this requires the
- * user passes in an io_service on construction of the
- * basic_protocol_service<>.
- */
-/********************************
- template<typename Policy>
- class io_service_provider<0, Policy>
- : private boost::noncopyable
- {
- public:
- io_service_provider(boost::asio::io_service& ios)
- : io_service_(ios)
- {
- }
-
- boost::asio:io_service& io_service()
- {
- return io_service_;
- }
-
- void run()
- {
- io_service_.run();
- }
-
- void stop()
- {
- io_service_.stop();
- }
-
- void reset()
- {
- io_service_.reset();
- }
- private:
- boost::asio::io_service& io_service_;
- };
-********************************/
-
- /*
- /// Specialization for io_service-per-queue strategy
- template<typename Policy>
- class io_service_provider<1, Policy>//tags::>
- : private boost::noncopyable
- {
- public:
- io_service_provider(int)
- : io_service_()
- , work_(io_service_)
- {
- }
-
- io_service_provider()
- : io_service_()
- , work_(io_service_)
- {
- }
-
- boost::asio::io_service& io_service()
- {
- return io_service_;
- }
- private:
- boost::asio::io_service io_service_;
- boost::asio::io_service::work work_;
- };
-
-
-
- /// Specialization for a variable number of io_services
- template<typename Policy>
- class io_service_provider<-1, Policy>//tags::round_robin_pool>
- : private boost::noncopyable
- {
- typedef boost::shared_ptr<boost::asio::io_service> io_service_ptr;
- typedef boost::shared_ptr<boost::asio::io_service::work> work_ptr;
-
- public:
- io_service_provider(int pool_size = 7)
- : pos_(0)
- , io_services_()
-// , strand_(io_services_[0])
- {
- if (pool_size == 0)
- throw std::runtime_error("io_service_pool size is 0");
-
- // Give all the io_services work to do so that their run() functions will
- // not exit until they are explicitly stopped.
- for (std::size_t i = 0; i < pool_size; ++i)
- {
- io_service_ptr io_service(new boost::asio::io_service);
- work_ptr work(new boost::asio::io_service::work(*io_service));
- io_services_.push_back(io_service);
- work_.push_back(work);
- }
- }
-
- void run()
- {
- // Create a pool of threads to run all of the io_services.
- std::vector<boost::shared_ptr<boost::thread> > threads;
- for (std::size_t i = 0; i < io_services_.size(); ++i)
- {
- boost::shared_ptr<boost::thread>
- thread(new boost::thread(boost::bind(&boost::asio::io_service::run
- , io_services_[i])));
- threads.push_back(thread);
- }
-
- // Wait for all threads in the pool to exit.
- for (std::size_t i = 0; i < threads.size(); ++i)
- threads[i]->join();
- }
-
- void stop()
- {
- // Explicitly stop all io_services.
- for (std::size_t i = 0; i < io_services_.size(); ++i)
- io_services_[i]->stop();
- }
-
- // NOT THREAD-SAFE (but should be)
- boost::asio::io_service& io_service()
- {
- boost::asio::io_service& io_service = *io_services_[pos_];
- if (++pos_ == io_services_.size())
- pos_ = 0;
- return io_service;
- }
- private:
- int pos_;
- std::vector<io_service_ptr> io_services_;
- std::vector<work_ptr> work_;
-
- //boost::asio::io_service::strand strand_;
- };
- */
-
-} // namespace cgi
-
-#include "boost/cgi/detail/pop_options.hpp"
-
-#endif // CGI_IO_SERVICE_PROVIDER_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/io_service_provider_fwd.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,25 +0,0 @@
-// -- io_service_provider_fwd.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
-#define CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
-
-#if _MSC_VER > 1020
-#pragma once
-#endif
-
-#include "boost/cgi/tags.hpp"
-
-namespace cgi {
-
- template<typename = tags::single_service>
- class io_service_provider;
-
-} // namespace cgi
-
-#endif // CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/map.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/map.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,16 +0,0 @@
-// -- map.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_MAP_HPP_INCLUDED__
-#define CGI_MAP_HPP_INCLUDED__
-
-#warning This file is deprecated, use common/map.hpp instead.
-
-#include "boost/cgi/common/map.hpp"
-
-#endif // CGI_MAP_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/read.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/read.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,24 +0,0 @@
-// -- read.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_READ_HPP_INCLUDED
-#define CGI_READ_HPP_INCLUDED
-
-#include <boost/asio/read.hpp>
-
-namespace cgi {
- namespace common {
-
- using boost::asio::read;
- using boost::asio::async_read;
-
- } // namespace common
-} // namespace cgi
-
-#endif // CGI_READ_HPP_INCLUDED
-

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/request.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,21 +0,0 @@
-// -- request.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_REQUEST_HPP_INCLUDED__
-#define CGI_REQUEST_HPP_INCLUDED__
-
-#include "basic_request.hpp"
-#include "tags.hpp"
-
-namespace cgi {
-
- typedef basic_request<tags::cgi> request;
-
-} // namespace cgi
-
-#endif // CGI_REQUEST_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/request_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/request_base.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,103 +0,0 @@
-#ifndef CGI_REQUEST_BASE_HPP_INCLUDE_
-#define CGI_REQUEST_BASE_HPP_INCLUDE_
-
-//#include "role_type.hpp"
-
-namespace cgi {
-
- /// ABC that defines the basic interface for cgi::basic_cgi_request<>s
- /**
- * This class also allows for the general (rather than generic) verision
- * of cgi::request, which can take any type of request.
- */
- class request_base
- {
- public:
- /// Notify the server that the request has been handled
- /**
- * Under normal circumstances {{ideally}}, this won't be called internally
- * but a user may safely call it anyway, if (for example) they have a lot
- * of post-request-handling housekeeping to do but want the server to
- * finish with that request.
- *
- * @param return_code This is equivalent to the return value from main() in
- * a standard cgi library, or sub_main() in the provided examples. 0 should
- * denote success, anything else an error, however the number will
- * generally be ignored by the server.
- */
- //virtual void end( int return_code ) = 0;
-
- /// Returns the number of bytes available in the read buffer
- //virtual std::size_t available() = 0;
-
- /// Get the streambuf associated with the request
- /**
- * You may want to construct your own i/ostream instead of using the
- * request directly.
- *
- * @note You should NOT use std::cout/std::cin for writes, as they are
- * not thread aware and in some cases won't exist (eg. in a strict fastcgi
- * impletentation).
- *
- * {{should this return an asio::streambuf instead?}}
- */
- //virtual std::streambuf* rdbuf() = 0;
-
- /// Flush the output buffer now
- /**
- * Since the output for a request is buffered until the request has
- * completed (see Design notes), under low-memory or large-output
- * conditions, incrementally flushing the buffer may be necessary
- *
- * @note If something goes awry after calling this, the user will
- * be left with half a reply, rather than a (cleaner) error page.
- */
- //virtual void flush() = 0;
-
- /// Write a message to the error output
- /**
- * In a standard cgi program, this is equivalent to writing to std::cerr,
- * which should be closed in fastcgi (although many implementations leave
- * it writable). In order to write an error message in a cross-platform
- * way, you should use this function.
- *
- * @note On Apache and lighttpd the messages are appended to the server
- * log file, although there is no guarantee that other platforms will
- * recognise it.
- */
- //virtual void log( const std::string& error_message ) = 0;
-
- /// Get the role of the current request
- /**
- * The FastCGI 1.0 protocol specifies three types of request:
- *
- * @li Responder: the familiar type
- *
- * @li Authorizer: the server provides client information and the
- * application responds with a true/false response, plus optional data
- * about where to redirect the client and with what extra variables
- *
- * @li Filter: the program is provided with data and a file, which it is
- * expected to 'filter' and then return to the server. This is poorly
- * supported in production servers {{AFAIK}}
- */
- //virtual role_type role() = 0;
-
- /* SyncReadStream function */
- //template<typename MutableBufferSequence>
- //virtual std::size_t read_some(MutableBufferSequence) = 0;
-
- //template<typename MutableBufferSequence>
- //virtual std::size_t read_some(MutableBufferSequence, error_code&) = 0;
-
- protected:
- /// Prevent deletion through this type
- ~request_base()
- {
- }
- };
-
-} // namespace cgi
-
-#endif // CGI_REQUEST_BASE_HPP_INCLUDE_
-

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/request_ostream.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/request_ostream.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,368 +0,0 @@
-// -- request_ostream.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_REQUEST_OSTREAM_HPP_INCLUDED__
-#define CGI_REQUEST_OSTREAM_HPP_INCLUDED__
-
-#if 0
-
-// THIS FILE ISN'T USED!
-// **FIXME**
-
-/*********************************
-ISSUES:
--------
-* async_flush()
-The other flush() functions clear the buffer after flushing the data to the
-request. It's trickier with async_flush(), but for now the buffer is still
-cleared after the flush completes. This means you can't write to the ostream
-until an async_flush completes; that's probably true of any async operation
-however so it seems a reasonable restriction.
-
-* Is ostream the best name for this? request_ostream?
-
-* This class could do more: the functions basic_request<>::write() could write
-to the request unbuffered. ie. a write call would instantly wrap the supplied
-buffer in suitable headers and send it straight away, rather than buffering it
-first. That would also mean the ostream class is of more use than it is now.
-
-* This should probably derive from std::ostream, as users would probably expect
-that.
-*********************************/
-
-#include "detail/push_options.hpp"
-
-#include <ostream>
-#include <sstream>
-#include <vector>
-//#include <streambuf>
-#include <boost/assert.hpp>
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/system/error_code.hpp>
-#include <boost/asio.hpp>
-
-#include "streambuf.hpp"
-#include "buffer.hpp"
-#include "write.hpp"
-#include "tags.hpp"
-#include "data_sink.hpp"
-#include "request_base.hpp"
-#include "basic_request.hpp"
-#include "http/status_code.hpp"
-//#include "detail/take_buffer.hpp"
-
-namespace cgi {
-
- /* Notes
- * -----
- *
- * The constructor could take an additional bool which determines
- * if any default headers are prepended to the message on sending
- * eg. 'Content-type: text/plain' could by default be added, making
- * the entry barrier lower and testing simpler.
- */
-
-
- /// The ostream class: a stream interface for writing to requests
- /**
- * This is simply a wrapper around an ostream with a few extra details that
- * aid writing to a request's output or error sinks.
- *
- * This is a generalisation of the cgi::reply and cgi::logger classes.
- */
- class request_ostream
- // derive from std::ostream? (yes, basically)
- {
- public:
- /// Default constructor
- request_ostream(http::status_code sc = http::ok)
- : buffer_(new ::cgi::streambuf())
- , ostream_(buffer_.get())
- , http_status_(sc)
- , headers_sent_(false)
- {
- }
-
- /// Construct with a particular buffer
- /**
- * Takes the buffer and uses it internally, does nothing with it on
- * destruction.
- */
- request_ostream(::cgi::streambuf* buf, http::status_code sc = http::ok)
- : /*request_(NULL)
- , */ostream_(buf)
- , http_status_(sc)
- {
- }
-
- /// Construct, taking a buffer from an external source
- /**
- * Gets a buffer from the request/protocol service held by the request.
- * <strike>
- * Takes a buffer from T (can be a model of ProtocolService or
- * CommonGatewayRequest) to use internally.
- * </strike>
- */
-// template<typename CommonGatewayRequest>
-// request_ostream(CommonGatewayRequest& req, http::status_code sc = http::ok)
-// : request_(&req)
-// , buffer_(new cgi::streambuf())
-// , ostream_(buffer_.get()) //detail::take_buffer(req))
-// , http_status_(sc)
-//// , destination_(destination)
-// {
-// }
-
- ~request_ostream()
- {
- //if (request_) send();
- }
-
- void clear()
- {
- ostream_.clear();
- headers_.clear();
- }
-
- // provide this too?
- std::size_t write(const char* str, std::size_t len)
- {
- ostream_.write(str, len);
- return len;
- }
-
- std::size_t write(const std::string& str)
- {
- return write(str.c_str(), str.size());
- }
-
- template<typename ConstBufferSequence>
- std::size_t write(const ConstBufferSequence& buf)
- {
- //ostream_.write(buf.data(), buf.size());
- return buf.size();
- }
-
- /// Synchronously flush the data to the current request
- /**
- * If there is no error, the buffer is cleared.
- */
- //void flush()
- //{
- // BOOST_ASSERT(request_ != NULL);
- // flush(*request_);
- //}
-
- /// Synchronously flush the data to the supplied request
- /**
- * This call uses throwing semantics. ie. an exception will be thrown on
- * any failure.
- * If there is no error, the buffer is cleared.
- */
- template<typename CommonGatewayRequest>
- void flush(CommonGatewayRequest& req)
- {
- if (!headers_sent_)
- {
- ostream_<< "Content-type: text/plain\r\n\r\n";
- headers_sent_ = true;
- }
- ::cgi::write(req, headers_);
- ::cgi::write(req, rdbuf()->data());
- // the above function will throw on an error
- clear();
- }
-
- /// Synchronously flush the data via the supplied request
- /**
- * This call uses error_code semantics. ie. ec is set if an error occurs.
- * If there is no error, the buffer is cleared.
- */
- template<typename CommonGatewayRequest>
- boost::system::error_code&
- flush(CommonGatewayRequest& req, boost::system::error_code& ec)
- {
- if (!headers_sent_)
- {
- ostream_<< "Content-type: text/plain\r\n\r\n";
- headers_sent_ = true;
- }
- if(!::cgi::write(req, rdbuf()->data(), ec))
- clear();
- return ec;
- }
-
- // Class for doing post-flush housekeeping (ie. clearing the stream data)
- template<typename Handler>
- class flush_handler
- {
- public:
- flush_handler(request_ostream& os, Handler handler)
- : ostream_(os)
- , handler_(handler)
- {
- }
-
- void operator()(boost::system::error_code& ec)
- {
- if(!ec) ostream_.clear();
- handler_(ec);
- }
- private:
- request_ostream& ostream_;
- Handler handler_;
- };
-
- /// Asynchronously flush the data through the supplied request
- /**
- * If there is no error, the buffer is cleared *after* the write has
- * finished.
- */
- template<typename CommonGatewayRequest, typename Handler>
- void async_flush(CommonGatewayRequest& req, Handler handler)
- {
- if (!headers_sent_)
- {
- ostream_<< "Content-type: text/plain\r\n\r\n";
- headers_sent_ = true;
- }
- ::cgi::async_write(req, rdbuf()->data()
- , flush_handler<Handler>
- (*this, handler, boost::arg<1>()));
- }
-
-
- /// Synchronously send the reply to the default request
- /**
- * Note: The data in the stream isn't cleared after this call, but the
- * request held in the ostream is removed. ie. send() can't be called
- * twice without an arguement (unless you add another request - something
- * not possible yet).
- */
- //void send()
- //{
- // BOOST_ASSERT(request_ != NULL);
- // send(*request_);
- // request_ = NULL;
- //}
-
- /// Synchronously send the reply to the default request
- /**
- * Note: The data in the stream isn't cleared after this call. If the send
- * is sucessful, the request held in the ostream is removed. ie. send()
- * can't be called twice without an arguement (unless you add another
- * request - something not possible yet).
- */
- //boost::system::error_code& send(boost::system::error_code& ec)
- //{
- // BOOST_ASSERT(request_ != NULL);
- // if(!send(*request_, ec))
- // request_ = NULL;
- // return ec;
- //}
-
-
- /// Synchronously send the data via the supplied request
- /**
- * This call uses throwing semantics. ie. an exception will be thrown on
- * any failure.
- * Note: The data in the stream isn't cleared after this call.
- */
- template<typename CommonGatewayRequest>
- void send(CommonGatewayRequest& req)
- {
- if (!headers_sent_)
- {
- ostream_<< "Content-type: text/plain\r\n\r\n";
- headers_sent_ = true;
- }
- ::cgi::write(req.client(), rdbuf()->data());
- req.set_status(http_status_);
- }
-
- /// Synchronously send the data via the supplied request
- /**
- * This call uses error_code semantics. ie. ec is set if an error occurs.
- * Note: The data in the stream isn't cleared after this call.
- */
- template<typename CommonGatewayRequest>
- boost::system::error_code&
- send(CommonGatewayRequest& req, boost::system::error_code& ec)
- {
- if (!headers_sent_)
- {
- ostream_<< "Content-type: text/plain\r\n\r\n";
- headers_sent_ = true;
- }
- ::cgi::write(req.client(), rdbuf()->data(), ec);
- req.set_status(http_status_);
- return ec;
- }
-
- /// Asynchronously send the data through the supplied request
- /**
- * Note: The data in the stream isn't cleared after this call.
- */
- template<typename CommonGatewayRequest, typename Handler>
- void async_send(CommonGatewayRequest& req, Handler handler)
- {
- req.set_status(http_status_);
- if (!headers_sent_)
- {
- ostream_<< "Content-type: text/plain\r\n\r\n";
- headers_sent_ = true;
- }
- ::cgi::async_write(req, rdbuf()->data(), handler);
- }
-
- /// Get the buffer associated with the stream
- ::cgi::streambuf*
- rdbuf()
- {
- return static_cast<::cgi::streambuf*>(ostream_.rdbuf());
- }
-
- void set_status(const http::status_code& num)
- {
- http_status_ = num;
- }
-
- http::status_code& get_status()
- {
- return http_status_;
- }
-
- protected:
- std::vector<boost::asio::const_buffer> headers_;
- boost::shared_ptr<::cgi::streambuf> buffer_;
- std::ostream ostream_;
- http::status_code http_status_;
- bool headers_sent_;
-
- template<typename T>
- friend request_ostream& operator<<(request_ostream&, const T&);
- };
-
-
-
- /// Operator<< overload for basic outputting ability
- template<typename T>
- request_ostream& operator<<(request_ostream& os, const T& t)
- {
- os.ostream_<< t;
- return os;
- }
-
-} // namespace cgi
-
-#include "boost/cgi/detail/pop_options.hpp"
-
-#endif
-
-#endif // CGI_REQUEST_OSTREAM_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/request_service.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
@@ -12,13 +12,11 @@
 #include "boost/cgi/detail/push_options.hpp"
 
 #include <boost/utility/enable_if.hpp>
-
-//#include "is_async.hpp"
-#include "boost/cgi/io_service.hpp"
+///////////////////////////////////////////////////////////
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/detail/protocol_traits.hpp"
-#include "boost/cgi/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/common/basic_protocol_service_fwd.hpp"
 #include "boost/cgi/detail/service_base.hpp"
-//#include "service_selector.hpp"
 
 namespace cgi {
  namespace common {

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/response.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/response.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,243 +0,0 @@
-// -- response.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_RESPONSE_HPP_INCLUDED__
-#define CGI_RESPONSE_HPP_INCLUDED__
-
-#include "boost/cgi/detail/push_options.hpp"
-
-#include <string>
-///////////////////////////////////////////////////////////
-#include <boost/foreach.hpp>
-#include <boost/bind.hpp>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/common/cookie.hpp"
-#include "boost/cgi/common/header.hpp"
-#include "boost/cgi/basic_request_fwd.hpp"
-#include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/common/streambuf.hpp"
-#include "boost/cgi/detail/throw_error.hpp"
-
-/// This mess outputs a default Content-type header if the user hasn't set any.
-/** **FIXME** Not implemented; not sure if it should be...
- * BOOST_CGI_ADD_DEFAULT_HEADER should not persiste into user-code.
- *
- * It basically works like (default first):
- *
- * Debug mode:
- * - Append a "Content-type: text/plain" header;
- * - If BOOST_CGI_DEFAULT_CONTENT_TYPE is defined, set that as the
- * content-type;
- * - If BOOST_CGI_NO_DEFAULT_CONTENT_TYPE is defined, do nothing.
- *
- * Release mode:
- * - Do nothing.
- */
-#if !defined(NDEBUG) && !defined(BOOST_CGI_NO_DEFAULT_CONTENT_TYPE)
-//{
-# if !defined(BOOST_CGI_DEFAULT_CONTENT_TYPE)
-# define BOOST_CGI_DEFAULT_CONTENT_TYPE "Content-type: text/plain"
-# endif // !defined(BOOST_CGI_DEFAULT_CONTENT_TYPE)
-//}
-# define BOOST_CGI_ADD_DEFAULT_HEADER \
- if (headers_.empty()) \
- headers_.push_back(BOOST_CGI_DEFAULT_CONTENT_TYPE"\r\n");
-#else
-# define BOOST_CGI_ADD_DEFAULT_HEADER
-#endif // !defined(NDEBUG) && !defined(BOOST_CGI_NO_DEFAULT_CONTENT_TYPE)
-
-
-namespace cgi {
- namespace common {
-
- /// The response class: a helper for responding to requests.
- template<typename T>
- class basic_response
- {
- public:
- typedef T char_type;
- typedef typename std::basic_string<T> string_type;
- typedef typename std::basic_ostream<T> ostream_type;
-
- basic_response(http::status_code sc = http::ok);
-
- /// Construct with a particular buffer
- /**
- * Takes the buffer and uses it internally, does nothing with it on
- * destruction.
- */
- basic_response(::cgi::streambuf* buf, http::status_code sc = http::ok);
-
- ~basic_response();
-
- /// Clear the response buffer.
- void clear();
-
- /// Return the response to the 'just constructed' state.
- void reset();
-
- // provide this too?
- std::size_t write(const char_type* str, std::size_t len);
-
- std::size_t write(string_type const& str);
-
- template<typename ConstBufferSequence>
- std::size_t write(const ConstBufferSequence& buf);
-
- /// Synchronously flush the data to the supplied SyncWriteStream
- /**
- * This call uses throwing semantics. ie. an exception will be thrown on
- * any failure.
- * If there is no error, the buffer is cleared.
- */
- template<typename SyncWriteStream>
- void flush(SyncWriteStream& sws);
-
- /// Synchronously flush the data via the supplied request
- /**
- * This call uses error_code semantics. ie. ec is set if an error occurs.
- * If there is no error, the buffer is cleared.
- */
- template<typename SyncWriteStream>
- boost::system::error_code
- flush(SyncWriteStream& sws, boost::system::error_code& ec);
-
- /// Synchronously send the data via the supplied request.
- /**
- * This call uses throwing semantics. ie. an exception will be thrown on
- * any failure.
- * Note: The data in the stream isn't cleared after this call.
- */
- template<typename SyncWriteStream>
- void send(SyncWriteStream& sws);
-
- /// Synchronously send the data via the supplied request.
- /**
- * This call will not throw, but will set `ec` such that `ec == true` if
- * an error occurs. Details of the error are held in the `error_code`
- * object.
- */
- template<typename SyncWriteStream>
- boost::system::error_code
- send(SyncWriteStream& sws, boost::system::error_code& ec);
-
- /// Resend headers + content regardless of value of `headers_terminated_`.
- template<typename SyncWriteStream>
- void resend(SyncWriteStream& sws);
-
- /// Asynchronously send the data through the supplied request
- /**
- * Note: This is quite crude at the moment and not as asynchronous as
- * it could/should be. The data in the stream isn't cleared after
- * this call.
- */
- template<typename AsyncWriteStream, typename Handler>
- void async_send(AsyncWriteStream& aws, Handler handler);
-
- template<typename AsyncWriteStream, typename Handler>
- void do_async_send(AsyncWriteStream& aws, Handler handler);
-
- /// Get the buffer associated with the stream
- common::streambuf*
- rdbuf();
-
- /// Set the status code associated with the response.
- basic_response<char_type>&
- set_status(const http::status_code& num);
-
- /// Get the status code associated with the response.
- common::http::status_code& status();
-
- /// Allow more headers to be added (WARNING: avoid using this).
- void unterminate_headers();
-
- /// Get the length of the body of the response
- std::size_t content_length();
-
- /// Add a header after appending the CRLF sequence.
- basic_response<char_type>&
- set_header(const string_type& value);
-
- /// Format and add a header given name and value, appending CRLF.
- basic_response<char_type>&
- set_header(string_type const& name, string_type const& value);
-
- void clear_headers();
-
- void reset_headers();
-
- bool headers_terminated() const;
-
- // Is this really necessary?
- void end_headers();
-
- /// Get the ostream containing the response body.
- ostream_type& ostream();
- protected:
- // Vector of all the headers, each followed by a CRLF
- std::vector<string_type> headers_;
-
- // The buffer is a shared_ptr, so you can keep it cached elsewhere.
- boost::shared_ptr<common::streambuf> buffer_;
-
- ostream_type ostream_;
-
- common::http::status_code http_status_;
-
- // True if no more headers can be appended.
- bool headers_terminated_;
-
- private:
- // Send the response headers and mark that they've been sent.
- template<typename ConstBufferSequence>
- void prepare_headers(ConstBufferSequence& headers);
- };
-
- /// Typedefs for typical usage.
- typedef basic_response<char> response;
- typedef basic_response<wchar_t> wresponse; // **FIXME** (untested)
-
- } // namespace common
-} // namespace cgi
-
- /// Generic ostream template
- template<typename CharT, typename T>
- cgi::common::basic_response<CharT>&
- operator<< (cgi::common::basic_response<CharT>& resp, const T& t);
-
- template<typename CharT>
- cgi::common::basic_response<CharT>&
- operator<< (cgi::common::basic_response<CharT>& resp
- , cgi::common::basic_header<CharT> const& hdr);
-
- /// You can stream a cgi::cookie into a response.
- /**
- * This is just a shorthand way of setting a header that will set a
- * client-side cookie.
- *
- * You cannot stream a cookie to a response after the headers have been
- * terminated. In this case, an alternative could be to use the HTML tag:
- * <meta http-equiv="Set-cookie" ...> (see http://tinyurl.com/3bxftv or
- * http://tinyurl.com/33znkj), but this is outside the scope of this
- * library.
- */
- template<typename charT, typename T>
- cgi::common::basic_response<charT>&
- operator<< (cgi::common::basic_response<charT>&
- , cgi::common::basic_cookie<T>&);
-
- template<typename charT, typename T>
- cgi::common::basic_response<charT>&
- operator<< (cgi::common::basic_response<charT>&
- , cgi::common::http::status_code);
-
-#include "boost/cgi/detail/pop_options.hpp"
-
-#include "boost/cgi/impl/response.ipp"
-
-#endif // CGI_RESPONSE_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/role_type.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/role_type.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,22 +0,0 @@
-#ifndef CGI_ROLE_TYPE_HPP_INCLUDED__
-#define CGI_ROLE_TYPE_HPP_INCLUDED__
-
-namespace cgi {
- namespace role {
-
- struct responder {};
- struct authorizer {};
- struct filter {};
-
- } // namespace role
-
- enum role_type
- { none
- , responder
- , authorizer
- , filter
- };
-
-} // namespace cgi
-
-#endif // CGI_ROLE_TYPE_HPP_INCLUDED__

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/status_type.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/status_type.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,21 +0,0 @@
-// -- status_type.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_STATUS_TYPE_HPP_INCLUDED__
-#define CGI_STATUS_TYPE_HPP_INCLUDED__
-
-#include "boost/cgi/common/status_type.hpp"
-
-namespace cgi {
-
- using namespace common;
-
-} // namespace cgi
-
-#endif // CGI_STATUS_TYPE_HPP_INCLUDED__
-

Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/write.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/write.hpp 2008-05-21 08:25:47 EDT (Wed, 21 May 2008)
+++ (empty file)
@@ -1,27 +0,0 @@
-// -- write.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_WRITE_HPP_INCLUDED
-#define CGI_WRITE_HPP_INCLUDED
-
-#include <boost/asio/write.hpp>
-
-namespace cgi {
- namespace common {
-
- using boost::asio::write;
- using boost::asio::async_write;
-
- } // namespace common
-
- //using common::write;
- //using common::async_write;
-
-} // namespace cgi
-
-#endif // CGI_WRITE_HPP_INCLUDED


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