Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r55954 - in sandbox/SOC/2007/cgi/branches/pickmeup: boost/cgi boost/cgi/common boost/cgi/detail boost/cgi/fcgi boost/cgi/impl boost/cgi/utility libs/cgi/build/msvc/9.0/Boost.CGI libs/cgi/build/msvc/9.0/Boost.CGI/acgi_hello_world libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/templates libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world libs/cgi/doc/src libs/cgi/example/acgi/cookie_game libs/cgi/example/acgi/cookie_game2 libs/cgi/example/acgi/echo libs/cgi/example/cgi/DebugServer libs/cgi/example/cgi/echo libs/cgi/example/fcgi/amortization libs/cgi/example/fcgi/echo libs/cgi/example/fcgi/hello_world
From: lists.drrngrvy_at_[hidden]
Date: 2009-09-01 07:20:01


Author: drrngrvy
Date: 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
New Revision: 55954
URL: http://svn.boost.org/trac/boost/changeset/55954

Log:
Windows FastCGI support (experimental).
Added:
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility/commit.hpp (contents, props changed)
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj (contents, props changed)
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/templates/
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/amortization.html
      - copied unchanged from r51789, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/amortization.tpl
Removed:
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/amortization.tpl
Binary files modified:
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.ncb
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.suo
Text files modified:
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request.hpp | 43 +++++++++------
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request_acceptor.hpp | 69 +++++++++++-------------
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/map.hpp | 2
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/parse_options.hpp | 17 +++--
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/request_base.hpp | 3 +
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/cgi_service_impl_base.hpp | 7 +-
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/acceptor_service_impl.hpp | 9 +-
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/client.hpp | 11 +++
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/error.hpp | 10 ++-
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_service.hpp | 4 +
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/fcgi_request_service.ipp | 99 ++++++++++++++++++++++++------------
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/form_parser.ipp | 109 +++++++++++++++++++--------------------
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/response.ipp | 1
   sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility.hpp | 3
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln | 42 +++++++++++++++
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/acgi_hello_world/acgi_hello_world.vcproj | 2
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj | 2
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj | 2
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj | 2
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/cgi.qbk | 18 -----
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/future_development.qbk | 68 ------------------------
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/preface.qbk | 12 ++--
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/reference.qbk | 12 ++-
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/troubleshooting.qbk | 2
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game/main.cpp | 20 +++---
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game2/main.cpp | 20 +++---
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/echo/main.cpp | 2
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/Timer.hpp | 5 +
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.cpp | 20 +-----
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.hpp | 1
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/hello.cpp | 5 -
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/echo/main.cpp | 9 +-
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/main.cpp | 26 ++++----
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/echo/main.cpp | 38 ++++++++-----
   sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/hello_world/main.cpp | 58 +++++++++++---------
   35 files changed, 385 insertions(+), 368 deletions(-)

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -110,35 +110,37 @@
       
       void set(map_type& data) { impl = &data; }
       
- iterator begin() { return impl->begin(); }
- iterator end() { return impl->end(); }
- const_iterator begin() const { return impl->begin(); }
- const_iterator end() const { return impl->end(); }
+ iterator begin() { BOOST_ASSERT(impl); return impl->begin(); }
+ iterator end() { BOOST_ASSERT(impl); return impl->end(); }
+ const_iterator begin() const { BOOST_ASSERT(impl); return impl->begin(); }
+ const_iterator end() const { BOOST_ASSERT(impl); return impl->end(); }
       
- reverse_iterator rbegin() { return impl->rbegin(); }
- reverse_iterator rend() { return impl->rend(); }
- const_reverse_iterator rbegin() const { return impl->rbegin(); }
- const_reverse_iterator rend() const { return impl->rend(); }
+ reverse_iterator rbegin() { BOOST_ASSERT(impl); return impl->rbegin(); }
+ reverse_iterator rend() { BOOST_ASSERT(impl); return impl->rend(); }
+ const_reverse_iterator rbegin() const { BOOST_ASSERT(impl); return impl->rbegin(); }
+ const_reverse_iterator rend() const { BOOST_ASSERT(impl); return impl->rend(); }
 
- bool empty() { return impl->empty(); }
+ bool empty() { BOOST_ASSERT(impl); return impl->empty(); }
       
- void clear() { return impl->clear(); }
+ void clear() { BOOST_ASSERT(impl); return impl->clear(); }
       
- size_type size() const { return impl->size(); }
+ size_type size() const { BOOST_ASSERT(impl); return impl->size(); }
       
- size_type count(const key_type& key) { return impl->count(key); }
+ size_type count(const key_type& key) { BOOST_ASSERT(impl); return impl->count(key); }
       
       template<typename T>
       T as(key_type const& key) {
+ BOOST_ASSERT(impl);
         mapped_type& val((*impl)[key]);
         return val.empty() ? T() : boost::lexical_cast<T>(val);
       }
       
       mapped_type& operator[](key_type const& varname) {
+ BOOST_ASSERT(impl);
         return (*impl)[varname.c_str()];
       }
       
- operator map_type&() { return *impl; }
+ operator map_type&() { BOOST_ASSERT(impl); return *impl; }
 
     private:
       map_type* impl;
@@ -147,6 +149,7 @@
     data_map_proxy<env_map> env;
     data_map_proxy<post_map> post;
     data_map_proxy<get_map> get;
+ data_map_proxy<form_map> form;
     data_map_proxy<cookie_map> cookies;
 
     basic_request(const parse_options opts = parse_none
@@ -252,9 +255,7 @@
     void load(parse_options parse_opts = parse_env, char** base_env = NULL)
     {
       boost::system::error_code ec;
- this->service.load(this->implementation, parse_opts, ec);
- //if (base_env)
- // load(base_env);
+ load(parse_opts, ec, base_env);
       detail::throw_error(ec);
     }
 
@@ -267,7 +268,15 @@
       if (base_environment)
         this->service.load_environment(this->implementation, base_environment
                                       , is_command_line);
- return ec;
+ if (parse_opts > parse_env && parse_opts & parse_form)
+ {
+ common::name rm(request_method().c_str());
+ form.set(
+ (rm == "GET" || rm == "HEAD") ? get :
+ rm == "POST" ? post : env
+ );
+ }
+ return ec;
     }
 
     void load(char** base_environment, bool is_command_line = true)

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request_acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request_acceptor.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/basic_request_acceptor.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -14,6 +14,7 @@
 #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/detail/throw_error.hpp"
 #include "boost/cgi/common/basic_protocol_service.hpp"
@@ -55,50 +56,36 @@
     //}
 
     template<typename IoServiceProvider>
- explicit basic_request_acceptor
- (
- common::basic_protocol_service<protocol_type, IoServiceProvider>& ps
- , bool default_init = true
- )
- : boost::asio::basic_io_object<RequestAcceptorService>(ps.io_service())
- {
- this->service.set_protocol_service(this->implementation, ps);
- if (default_init)
- {
- boost::system::error_code ec;
- this->service.default_init(this->implementation, ec);
- if (ec)
- {
- boost::system::system_error err(ec, "Problem constructing acceptor");
- boost::throw_exception(err);
- }
- }
- }
-
- template<typename IoServiceProvider>
     explicit basic_request_acceptor(
           common::basic_protocol_service<protocol_type, IoServiceProvider>& ps,
- port_number_type port_num)
+ port_number_type port_num = 0)
       : boost::asio::basic_io_object<RequestAcceptorService>(ps.io_service())
     {
       this->service.set_protocol_service(this->implementation, ps);
       this->implementation.port_num_ = port_num;
-
- this->implementation.endpoint_.port(port_num);
- //std::cerr<< "___________ protocol := " <<
- //(this->implementation.endpoint_.protocol() == boost::asio::ip::tcp::v4()) << std::endl;
- using boost::asio::ip::tcp;
- // This strange-looking conditional checks there's no error at each
- // stage of preparation.
- boost::system::error_code ec;
- //if (//this->service.open(this->implementation, tcp::v4(), ec)
- //||
- //this->service.bind(this->implementation
- // , tcp::endpoint(tcp::v4(), port_num), ec)
- //|| this->service.listen(this->implementation, ec))
       
+ if (!port_num)
       {
- detail::throw_error(ec);
+ boost::system::error_code ec;
+ if (this->service.default_init(this->implementation, ec)) {
+ detail::throw_error(ec);
+ }
+ }
+ else
+ {
+ boost::asio::ip::tcp::endpoint
+ endpoint(boost::asio::ip::tcp::v4(), port_num);
+ this->implementation.endpoint_ = endpoint;
+ // This strange-looking conditional checks there's no error at each
+ // stage of preparation.
+ boost::system::error_code ec;
+ if (
+ this->service.open(this->implementation, endpoint.protocol(), ec)
+ || this->service.bind(this->implementation, endpoint, ec)
+ || this->service.listen(this->implementation, 15, ec))
+ {
+ detail::throw_error(ec);
+ }
       }
     }
 
@@ -116,7 +103,7 @@
       boost::system::error_code ec;
       if (this->service.open(this->implementation, endpoint.protocol(), ec)
       || this->service.bind(this->implementation, endpoint, ec)
- || this->service.listen(this->implementation, ec))
+ || this->service.listen(this->implementation, 15, ec))
       {
         detail::throw_error(ec);
       }
@@ -183,6 +170,14 @@
     }
 
     template<typename Endpoint>
+ void bind(Endpoint& ep)
+ {
+ boost::system::error_code ec;
+ this->service.bind(this->implementation, ep, ec);
+ detail::throw_error(ec);
+ }
+
+ template<typename Endpoint>
     boost::system::error_code
       bind(Endpoint& ep, boost::system::error_code& ec)
     {

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/map.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/map.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/map.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -24,7 +24,7 @@
     * next to the other uses of it.
     */
   typedef map env_map;
- typedef multimap get_map;
+ typedef map get_map;
   typedef map post_map;
   typedef map form_map;
   typedef map cookie_map;

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/parse_options.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/parse_options.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/parse_options.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -10,13 +10,16 @@
    // anything you will have unspecified behaviour.
    enum parse_options
    {
- parse_none = 0
- , parse_env = 1
- , parse_get = 2 | parse_env
- , parse_post = 4 | parse_env
- , parse_form = parse_env | parse_get | parse_post
- , parse_cookie = 8 | parse_env
- , parse_all = parse_env | parse_form | parse_cookie
+ parse_none = 0
+ , parse_env = 1
+ , parse_get_only = 2
+ , parse_get = parse_get_only | parse_env
+ , parse_post_only = 4
+ , parse_post = parse_post_only | parse_env
+ , parse_form = parse_env | parse_get | parse_post
+ , parse_cookie_only = 8
+ , parse_cookie = parse_cookie_only | parse_env
+ , parse_all = parse_env | parse_form | parse_cookie
    };
 
  } // namespace common

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/request_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/request_base.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/request_base.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -21,6 +21,7 @@
 #include "boost/cgi/common/map.hpp"
 #include "boost/cgi/common/parse_options.hpp"
 #include "boost/cgi/detail/extract_params.hpp"
+#include "boost/cgi/detail/save_environment.hpp"
 
 namespace cgi {
  namespace common {
@@ -81,6 +82,8 @@
 
       mutable_buffers_type prepare(std::size_t size)
       {
+ // Make sure we're not trying to make a zero-sized buffer.
+ BOOST_ASSERT(size && "Attempting to allocate a zero-sized buffer.");
         std::size_t bufsz(post_buffer_.size());
         post_buffer_.resize(bufsz + size);
         return boost::asio::buffer(&post_buffer_[bufsz], size);

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/cgi_service_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/cgi_service_impl_base.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/cgi_service_impl_base.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -146,19 +146,20 @@
       std::string const& request_method = env_vars(impl.vars_)["REQUEST_METHOD"];
 
       if ((request_method == "GET" || request_method == "HEAD")
- && (parse_opts & common::parse_get))
+ && parse_opts > common::parse_env
+ && parse_opts & common::parse_get_only)
       {
         parse_get_vars(impl, ec);
       }
       else
- if (request_method == "POST" && (parse_opts & common::parse_post))
+ if (request_method == "POST" && (parse_opts & common::parse_post_only))
       {
         parse_post_vars(impl, ec);
       }
 
       if (ec) return ec;
 
- if (parse_opts & common::parse_cookie)
+ if (parse_opts & common::parse_cookie_only)
       {
         if (parse_cookie_vars(impl, ec)) // returns an error_code
           return ec;

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/acceptor_service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/acceptor_service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/acceptor_service_impl.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -320,14 +320,15 @@
      is_cgi(implementation_type& impl)
      {
        boost::system::error_code ec;
-#if ! defined(BOOST_WINDOWS)
+//#if ! defined(BOOST_WINDOWS)
        socklen_t len
          = static_cast<socklen_t>(local_endpoint(impl,ec).capacity());
        int ret = getpeername(native(impl), local_endpoint(impl,ec).data(), &len);
+ int err = errno;
        return ( ret != 0 && errno == ENOTCONN ) ? false : true;
-#else
- return false;
-#endif
+//#else
+// return false;
+//#endif
      }
 
    public:

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/client.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/client.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -149,7 +149,7 @@
 
       write(*connection_, bufs, boost::asio::transfer_all(), ec);
 
- if (!keep_connection_)
+ if (!ec && !keep_connection_)
         connection_->close();
 
       return ec;
@@ -221,7 +221,7 @@
 
       if (0 != (total_buffer_size + fcgi::spec::header_length::value
           - bytes_transferred))
- ec = error::couldnt_write_complete_packet;
+ ec = ::cgi::error::couldnt_write_complete_packet;
 
       return bytes_transferred;
     }
@@ -264,11 +264,18 @@
     }
 
 
+ /// Get the status of the client.
     const client_status& status() const
     {
       return status_;
     }
 
+ /// Set the status of the client.
+ void status(client_status status)
+ {
+ status_ = status;
+ }
+
     bool keep_connection() const
     {
       return keep_connection_;

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/error.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/error.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/error.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -8,10 +8,7 @@
 // Abstract:
 // ---------
 //
-// The errors for everything are defined in here. ie. FastCGI,
-// CGI and SCGI errors.
-//
-// **FIXME** This is a mess.
+// FastCGI errors are defined in here.
 //
 ////////////////////////////////////////////////////////////////
 #ifndef BOOST_FCGI_ERROR_HPP_INCLUDED__
@@ -68,6 +65,9 @@
   // A client wasn't able to open.
   client_not_open,
   
+ // An empty FastCGI packet was read (eg. STDIN or GET_PARAM data has been read).
+ //empty_packet_read,
+
   // End of File (read zero bytes)
   eof
 };
@@ -90,6 +90,8 @@
              "multiplexed). This isn't handled for now. **FIXME**";
     case accepting_on_an_open_request:
       return "You called async_accept before closing a request.";
+ //case empty_packet_read:
+ // return "An empty FastCGI packet was read (eg. STDIN or GET_PARAM data has been read).";
     default:
       return "(FastCGI) BOOM!!!";
     }

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_service.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -84,6 +84,8 @@
 
       mutable_buffers_type prepare_misc(std::size_t size)
       {
+ // Make sure we're not trying to make a zero-sized buffer.
+ BOOST_ASSERT(size && "Attempting to allocate a zero-sized buffer.");
         std::size_t bufsz(param_buffer_.size());
         param_buffer_.resize(bufsz + size);
         return boost::asio::buffer(&param_buffer_[bufsz], size);
@@ -176,7 +178,7 @@
      */
 
     boost::system::error_code
- load(implementation_type& impl, bool parse_stdin
+ load(implementation_type& impl, common::parse_options opts
           , boost::system::error_code& ec);
 /*
     boost::system::error_code

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/fcgi_request_service.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/fcgi_request_service.ipp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/fcgi_request_service.ipp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -13,19 +13,20 @@
 #include <boost/system/error_code.hpp>
 #include <boost/fusion/include/vector.hpp>
 ////////////////////////////////////////////////////////////////
+#include "boost/cgi/fcgi/client.hpp"
+#include "boost/cgi/fcgi/request_service.hpp"
 #include "boost/cgi/common/map.hpp"
 #include "boost/cgi/common/tags.hpp"
-#include "boost/cgi/fcgi/client.hpp"
-#include "boost/cgi/import/read.hpp"
-#include "boost/cgi/http/status_code.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/form_parser.hpp"
 #include "boost/cgi/common/source_enums.hpp"
 #include "boost/cgi/common/request_base.hpp"
+#include "boost/cgi/common/parse_options.hpp"
+#include "boost/cgi/http/status_code.hpp"
+#include "boost/cgi/import/read.hpp"
+#include "boost/cgi/import/io_service.hpp"
 #include "boost/cgi/detail/service_base.hpp"
-#include "boost/cgi/fcgi/request_service.hpp"
+#include "boost/cgi/detail/throw_error.hpp"
 
 namespace cgi {
 
@@ -170,7 +171,7 @@
 /*/
     BOOST_CGI_INLINE boost::system::error_code
     fcgi_request_service::load(
- implementation_type& impl, bool parse_stdin
+ implementation_type& impl, common::parse_options opts
       , boost::system::error_code& ec)
     {
       //int header_len( get_length_of_header(impl, ec) );
@@ -211,7 +212,7 @@
 
       read_env_vars(impl, ec);
 
- if (parse_stdin)
+ if (opts & common::parse_post_only)
       {
         while(!ec
           && impl.client_.status() < common::stdin_read
@@ -220,15 +221,28 @@
           parse_packet(impl, ec);
         }
       }
+ if (ec == error::eof) {
+ ec = boost::system::error_code();
+ return ec;
+ }
+ //else
+ //if (ec == error::empty_packet_read)
+ // return ec;
+
       const std::string& request_method = env_vars(impl.vars_)["REQUEST_METHOD"];
       if (request_method == "GET")
+ {
         if (parse_get_vars(impl, ec))
           return ec;
+ }
       else
- if (request_method == "POST" && parse_stdin)
+ if (request_method == "POST"
+ && opts > common::parse_env
+ && opts & common::parse_post_only)
+ {
         if (parse_post_vars(impl, ec))
               return ec;
-
+ }
       parse_cookie_vars(impl, ec);
 
       return ec;
@@ -307,7 +321,7 @@
     {
       if (impl.client_.status_ == common::closed_)
       {
- ec = error::client_closed;
+ ec = common::error::client_closed;
         return 0;
       }
 
@@ -334,21 +348,27 @@
 
         if (state)
           // the header has been handled and all is ok; continue.
- return ec;
+ impl.client_.status(common::params_read);
         else
         if (!state)
           // The header is confusing; something's wrong. Abort.
- return error::bad_header_type;
-
- // else => (state == boost::indeterminate)
-
- implementation_type::mutable_buffers_type buf
- = impl.prepare_misc(fcgi::spec::get_length(impl.header_buf_));
-
- if (this->read_body(impl, buf, ec))
- return ec;
+ ec = error::bad_header_type;
+ else // => (state == boost::indeterminate)
+ {
+ std::size_t remaining(fcgi::spec::get_length(impl.header_buf_));
 
- this->parse_body(impl, buf, ec);
+ if (remaining)
+ {
+ implementation_type::mutable_buffers_type buf
+ = impl.prepare_misc(remaining);
+
+ if (this->read_body(impl, buf, ec))
+ return ec;
+
+ this->parse_body(impl, buf, ec);
+ } else
+ ec = error::couldnt_write_complete_packet;
+ }
 
       } // while(!ec && !params_read(impl))
       return ec;
@@ -443,7 +463,7 @@
       if (0 == len)
       { // This is the final param record.
         
- impl.client_.status_ = common::params_read;
+ impl.client_.status(common::params_read);
 
         //std::cerr<< "[hw] Final PARAM record found." << std::endl;
         return ec;
@@ -530,11 +550,21 @@
       switch(fcgi::spec::get_type(impl.header_buf_))
       {
       case BEGIN_REQUEST:
- case PARAMS:
- case STDIN:
       case DATA:
       case GET_VALUES:
         return boost::indeterminate;
+ case STDIN:
+ if (0 == fcgi::spec::get_length(impl.header_buf_)) {
+ impl.client_.status(common::stdin_read);
+ return true;
+ } else
+ return boost::indeterminate; //0 == fcgi::spec::get_length(impl.header_buf_) ? true : boost::indeterminate;
+ case PARAMS:
+ if (0 == fcgi::spec::get_length(impl.header_buf_)) {
+ impl.client_.status(common::params_read);
+ return true;
+ } else
+ return boost::indeterminate; //0 == fcgi::spec::get_length(impl.header_buf_) ? true : boost::indeterminate;
       case ABORT_REQUEST:
         return false;
       case UNKNOWN_TYPE:
@@ -564,14 +594,19 @@
       }
       // else route (ie. state == boost::indeterminate)
 
- implementation_type::mutable_buffers_type buf
- = impl.prepare(fcgi::spec::get_length(impl.header_buf_));
-
- if (this->read_body(impl, buf, ec))
- return ec;
+ std::size_t remaining(fcgi::spec::get_length(impl.header_buf_));
+ if (remaining)
+ {
+ implementation_type::mutable_buffers_type buf
+ = impl.prepare(remaining);
 
- this->parse_body(impl, buf, ec);
+ if (this->read_body(impl, buf, ec))
+ return ec;
 
+ this->parse_body(impl, buf, ec);
+ }
+ //else
+ // ec = error::empty_packet_read;
       return ec;
     }
 
@@ -603,7 +638,6 @@
             , boost::asio::buffer_size(buf), ec);
     }
 
-
     BOOST_CGI_INLINE boost::system::error_code
     fcgi_request_service::begin_request_helper(
         implementation_type& impl
@@ -622,7 +656,6 @@
         
        impl.request_role_
          = fcgi::spec::begin_request::get_role(impl.header_buf_);
- // **FIXME** (rm impl.request_role_)
        impl.client_.role_ = impl.request_role_;
        impl.client_.keep_connection_
          = fcgi::spec::begin_request::get_flags(impl.header_buf_)

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/form_parser.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/form_parser.ipp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/form_parser.ipp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -74,14 +74,12 @@
     {
       BOOST_ASSERT(!content_type_.empty());
 
- if (boost::algorithm::ifind_first(content_type_,
- "application/x-www-form-urlencoded"))
+ if (content_type_.find("application/x-www-form-urlencoded") != std::string::npos)
       {
         parse_url_encoded_form(ec);
       }
- else
- if (boost::algorithm::ifind_first(content_type_,
- "multipart/form-data"))
+ else
+ if (content_type_.find("multipart/form-data") != std::string::npos)
       {
         parse_multipart_form(ec);
       }
@@ -95,63 +93,58 @@
     boost::system::error_code
       form_parser::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
- { // **FIXME** isn't this broken? What about '%%53' ? - use url_decode instead!
- 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);
+ typedef buffer_type buffer_type;
+ typedef std::string string_type; // Ahem.
+ buffer_type& str(buffer_);
+ string_type result;
+ string_type name;
+
+ if (str.size() == 0)
+ return ec;
+
+ for( buffer_type::const_iterator iter (str.begin()), end (str.end())
+ ; iter != end; ++iter )
+ {
+ switch( *iter )
+ {
+ case ' ':
+ break;
+ case '+':
+ result.append(1, ' ');
+ break;
+ case '%':
+ if (std::distance(iter, end) <= 2
+ || !std::isxdigit(*(iter+1))
+ || !std::isxdigit(*(iter+2)))
+ {
+ result.append(1, '%');
+ }
+ else // we've got a properly encoded hex value.
+ {
+ char ch = *++iter; // need this because order of function arg
+ // evaluation is UB.
+ result.append(1, hex_to_char(ch, *++iter));
+ }
+ break;
+ case '=': // the name is complete, now get the corresponding value
+ name.swap(result);
             break;
- case '&': // we now have the name/value pair, so save it
+ case '&': // we now have the name/value pair, so save it
             // **FIXME** have to have .c_str() ?
- data_map_[name.c_str()] = str;
- str.clear();
+ data_map_[name.c_str()] = result;
+ result.clear();
             name.clear();
- break;
- default:
- str.append(1, ch);
- }
- }
+ break;
+ default:
+ result.append(1, *iter);
+ }
+ }
+#if defined(BOOST_CGI_KEEP_EMPTY_VARS)
       // save the last param (it won't have a trailing &)
       if( !name.empty() )
- // **FIXME** have to have .c_str() ?
- data_map_[name.c_str()] = str;
-
- return ec;
+ data_map_[name.c_str()] = result;
+#endif // BOOST_CGI_KEEP_EMPTY_VARS
+ return ec;
     }
 
     /// Parse a multipart form.
@@ -160,6 +153,7 @@
       form_parser::parse_multipart_form(boost::system::error_code& ec)
     {
       parse_boundary_marker(ec);
+
       std::cerr<< "Parsed boundary marker" << std::endl;
       move_to_start_of_first_part(ec);
       std::cerr<< (ec ? "Error finding first multipart section" : "Moved to start of actual data") << std::endl;
@@ -480,6 +474,7 @@
 
       // **FIXME** (don't use Boost.Regex)
       std::cerr<< " :{ " << content_type_ << " }: " << std::endl;
+
       /*
       std::string::size_type sz = content_type_.find("=");
       if (sz == std::string::npos)

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/response.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/response.ipp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/response.ipp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -302,6 +302,7 @@
     return rdbuf()->size();
   }
 
+ /// Get the response as a string.
   template<typename T> BOOST_CGI_INLINE
   typename basic_response<T>::string_type
     basic_response<T>::str() const

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -13,7 +13,6 @@
 #include "boost/cgi/utility/has_key.hpp"
 #include "boost/cgi/utility/get.hpp"
 #include "boost/cgi/utility/redirect.hpp"
-//#include "boost/cgi/utility/get_value.hpp"
-//#include "boost/cgi/utility/get_as.hpp"
+#include "boost/cgi/utility/commit.hpp"
 
 #endif // CGI_UTILITY_HPP_INCLUDED__

Added: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility/commit.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility/commit.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -0,0 +1,24 @@
+
+#ifndef BOOST_CGI_COMMIT_HPP_INCLUDED_
+#define BOOST_CGI_COMMIT_HPP_INCLUDED_
+
+#include <map>
+///////////////////////////////////////////////////////////
+#include "boost/cgi/common/return.hpp"
+
+namespace cgi {
+ namespace common {
+
+ /// Send a response to a reqest and close off the request.
+ template<typename Request, typename Response>
+ int commit(Request& req, Response& resp, int program_status)
+ {
+ resp.send(req.client());
+ return req.close(resp.status(), program_status);
+ }
+
+ } // namespace common
+} // namespace cgi
+
+#endif // BOOST_CGI_COMMIT_HPP_INCLUDED_
+

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.ncb
==============================================================================
Binary files. No diff available.

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -11,6 +11,20 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xcgi_accept", "xcgi_accept\xcgi_accept.vcproj", "{D24DD1E5-B8E3-4686-AB93-D17D44A73730}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cgi_hello_world", "cgi_hello_world\cgi_hello_world.vcproj", "{CDC4D356-7606-4100-BD78-AFAE949C5748}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cgi_echo", "cgi_echo\cgi_echo.vcproj", "{12AA5F5E-EA1E-4602-98E4-9244872739C1}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cgi_debug_server", "cgi_debug_server\cgi_debug_server.vcproj", "{730E95B0-DEBE-4CEB-9E9D-9C2A521ACC05}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "acgi_hello_world", "acgi_hello_world\acgi_hello_world.vcproj", "{FEAD8671-B7BE-4F52-A308-6B337171F0B6}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fcgi_hello_world", "fcgi_hello_world\fcgi_hello_world.vcproj", "{9FACC40E-538D-4625-B8C7-7B2BC57B88BC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fcgi_echo", "fcgi_echo\fcgi_echo.vcproj", "{6DA098F9-2F63-42F4-A732-48E6B35ECD1F}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fcgi_amortization", "fcgi_amortization\fcgi_amortization.vcproj", "{2AE71DB6-3200-42EE-B024-1C2F4519F2B2}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -36,6 +50,34 @@
                 {D24DD1E5-B8E3-4686-AB93-D17D44A73730}.Debug|Win32.ActiveCfg = Debug|Win32
                 {D24DD1E5-B8E3-4686-AB93-D17D44A73730}.Release|Win32.ActiveCfg = Release|Win32
                 {D24DD1E5-B8E3-4686-AB93-D17D44A73730}.Release|Win32.Build.0 = Release|Win32
+ {CDC4D356-7606-4100-BD78-AFAE949C5748}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CDC4D356-7606-4100-BD78-AFAE949C5748}.Debug|Win32.Build.0 = Debug|Win32
+ {CDC4D356-7606-4100-BD78-AFAE949C5748}.Release|Win32.ActiveCfg = Release|Win32
+ {CDC4D356-7606-4100-BD78-AFAE949C5748}.Release|Win32.Build.0 = Release|Win32
+ {12AA5F5E-EA1E-4602-98E4-9244872739C1}.Debug|Win32.ActiveCfg = Debug|Win32
+ {12AA5F5E-EA1E-4602-98E4-9244872739C1}.Debug|Win32.Build.0 = Debug|Win32
+ {12AA5F5E-EA1E-4602-98E4-9244872739C1}.Release|Win32.ActiveCfg = Release|Win32
+ {12AA5F5E-EA1E-4602-98E4-9244872739C1}.Release|Win32.Build.0 = Release|Win32
+ {730E95B0-DEBE-4CEB-9E9D-9C2A521ACC05}.Debug|Win32.ActiveCfg = Debug|Win32
+ {730E95B0-DEBE-4CEB-9E9D-9C2A521ACC05}.Debug|Win32.Build.0 = Debug|Win32
+ {730E95B0-DEBE-4CEB-9E9D-9C2A521ACC05}.Release|Win32.ActiveCfg = Release|Win32
+ {730E95B0-DEBE-4CEB-9E9D-9C2A521ACC05}.Release|Win32.Build.0 = Release|Win32
+ {FEAD8671-B7BE-4F52-A308-6B337171F0B6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FEAD8671-B7BE-4F52-A308-6B337171F0B6}.Debug|Win32.Build.0 = Debug|Win32
+ {FEAD8671-B7BE-4F52-A308-6B337171F0B6}.Release|Win32.ActiveCfg = Release|Win32
+ {FEAD8671-B7BE-4F52-A308-6B337171F0B6}.Release|Win32.Build.0 = Release|Win32
+ {9FACC40E-538D-4625-B8C7-7B2BC57B88BC}.Debug|Win32.ActiveCfg = Debug|Win32
+ {9FACC40E-538D-4625-B8C7-7B2BC57B88BC}.Debug|Win32.Build.0 = Debug|Win32
+ {9FACC40E-538D-4625-B8C7-7B2BC57B88BC}.Release|Win32.ActiveCfg = Release|Win32
+ {9FACC40E-538D-4625-B8C7-7B2BC57B88BC}.Release|Win32.Build.0 = Release|Win32
+ {6DA098F9-2F63-42F4-A732-48E6B35ECD1F}.Debug|Win32.ActiveCfg = Debug|Win32
+ {6DA098F9-2F63-42F4-A732-48E6B35ECD1F}.Debug|Win32.Build.0 = Debug|Win32
+ {6DA098F9-2F63-42F4-A732-48E6B35ECD1F}.Release|Win32.ActiveCfg = Release|Win32
+ {6DA098F9-2F63-42F4-A732-48E6B35ECD1F}.Release|Win32.Build.0 = Release|Win32
+ {2AE71DB6-3200-42EE-B024-1C2F4519F2B2}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2AE71DB6-3200-42EE-B024-1C2F4519F2B2}.Debug|Win32.Build.0 = Debug|Win32
+ {2AE71DB6-3200-42EE-B024-1C2F4519F2B2}.Release|Win32.ActiveCfg = Release|Win32
+ {2AE71DB6-3200-42EE-B024-1C2F4519F2B2}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.suo
==============================================================================
Binary files. No diff available.

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/acgi_hello_world/acgi_hello_world.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/acgi_hello_world/acgi_hello_world.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/acgi_hello_world/acgi_hello_world.vcproj 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- AdditionalIncludeDirectories="&quot;C:\Code\C++\Boost.CGI\current&quot;;&quot;C:\Code\C++\boost\svn\branches\release&quot;"
+ AdditionalIncludeDirectories=""
                                 PreprocessorDefinitions="_SCL_SECURE_NO_WARNINGS"
                                 MinimalRebuild="true"
                                 BasicRuntimeChecks="3"

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- AdditionalIncludeDirectories="&quot;C:\Code\C++\Boost.CGI\current&quot;;&quot;C:\Code\C++\boost\svn\branches\release&quot;"
+ AdditionalIncludeDirectories=""
                                 PreprocessorDefinitions="_SCL_SECURE_NO_WARNINGS"
                                 MinimalRebuild="true"
                                 BasicRuntimeChecks="3"

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- AdditionalIncludeDirectories="&quot;C:\Code\C++\Boost.CGI\current&quot;;&quot;C:\Code\C++\boost\svn\branches\release&quot;"
+ AdditionalIncludeDirectories=""
                                 PreprocessorDefinitions="_SCL_SECURE_NO_WARNINGS"
                                 MinimalRebuild="true"
                                 BasicRuntimeChecks="3"

Added: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="fcgi_amortization"
+ ProjectGUID="{2AE71DB6-3200-42EE-B024-1C2F4519F2B2}"
+ RootNamespace="fcgi_hello_world"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ DisableLanguageExtensions="false"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ CallingConvention="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="libboost_system-vc90-mt-gd-1_38.lib&#x0D;&#x0A;libctemplate-debug.lib"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\amortization.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\amortization.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;c:\code\c++\boost.cgi\templates\amortization.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;$(ProjectDir)\templates\amortization.html&quot;&#x0D;&#x0A;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalOptions="libboost_system-vc90-mt-1_38.lib&#x0D;&#x0A;libctemplate.lib"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="copy &quot;$(TargetPath)&quot; &quot;c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.css&quot; &quot;c:\code\c++\boost.cgi\htdocs\css\amortization.css&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.js&quot; &quot;c:\code\c++\boost.cgi\htdocs\js\amortization.js&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;c:\code\c++\boost.cgi\templates\amortization.html&quot;&#x0D;&#x0A;copy &quot;$(SolutionDir)\..\..\..\..\example\fcgi\amortization\amortization.html&quot; &quot;$(ProjectDir)\templates\amortization.html&quot;&#x0D;&#x0A;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\..\..\..\..\example\fcgi\amortization\main.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <File
+ RelativePath="..\..\..\..\..\example\fcgi\amortization\amortization.css"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\example\fcgi\amortization\amortization.html"
+ >
+ </File>
+ <File
+ RelativePath="..\..\..\..\..\example\fcgi\amortization\amortization.js"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -41,7 +41,7 @@
                         <Tool
                                 Name="VCCLCompilerTool"
                                 Optimization="0"
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS"
                                 MinimalRebuild="true"
                                 BasicRuntimeChecks="3"
                                 RuntimeLibrary="3"

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/cgi.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/cgi.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/cgi.qbk 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -42,8 +42,8 @@
 
 [def __current_branch__ http://svn.boost.org/trac/boost/browser/sandbox/SOC/2007/cgi/branches/release]
 
-[def __examples__ [@http://svn.boost.org/trac/boost/browser/sandbox/SOC/2007/cgi/branches/release/libs/cgi/example examples]]
-[def __amort_example__ [@http://svn.boost.org/trac/boost/browser/sandbox/SOC/2007/cgi/branches/release/libs/cgi/example/acgi/amortization Amortization]]
+[def __examples__ [@/docs/examples/examples.html examples]]
+[def __amort_example__ [@/docs/examples/examples.html#cgi.examples.acgi_examples.amortization Amortization]]
 
 
 [def __GET__ `GET` ]
@@ -87,20 +87,6 @@
 
 [include:intro introduction.qbk]
 
-[/
-/[section:gs Getting Started]
-/
-/This section of the documentation is probably best read before the [link __tutorial__ tutorial]. In a nutshell, this is a quick and dirty run-through of how to get and install the library [-and configure your server].
-/
-/[include:building user_guide/building.qbk]
-/
-/[include:server_config user_guide/server_configuration.qbk]
-/
-[include:headers user_guide/headers.qbk]
-/
-/[endsect]
-/]
-
 [include user_guide.qbk]
 
 [/include:tutorial user_guide/tutorial.qbk]

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/future_development.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/future_development.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/future_development.qbk 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -40,78 +40,10 @@
 
 Access to persistent session data is a very useful stop-gap to using a complete RDBMS to store/retrieve data. In some cases, such as when an object is supposed to stay in active memory, a RDBMS will not be efficient, so session management fits in nicely. A templated `basic_session<>` will be provided so various session-storage methods can be used. Boost.Interprocess is an ideal default, while Boost.UUID can be used to generate unique session identifiers.
 
-[h4 Having request variable functions return a `cgi::param` type instead of `std::string`]
-
-An advantage to this approach, for the functions that look up request data, is that multiple values can be easily extracted from the same key, when they exist. Currently, a user must get the complete map of data and use that themselves.
-
-Another advantage is that a macro can be provided to turn on/off implicit conversion to `std::string`, which is in essence a form of tainting, akin to perl's taint mode.
-
-Yet another possibility, is that a member function `as<>` can be provided as a shortcut to `boost::lexical_cast<>`. This could greatly improve readability of web programs, where lexical casting is very common and may make programs overly verbose.
-
-Compare:
-``
-cgi::request req;
-cgi::response resp;
-
-cgi::map::const_iterator iter = req.form().find("number");
-if (iter != cgi::map::const_iterator())
-{
- rep<< "You picked no numbers...";
-}
-else
-{
- int sum(0);
- resp<< "Your numbers are: ";
- for(; iter != cgi::map::const_iterator(); ++iter)
- {
- resp<< iter->second << " ";
- sum += boost::lexical_cast<int>(iter->second);
- }
-
- resp<< std::endl
- << "Your numbers add up to: " << sum;
-}
-
-rep.send(req);
-``
-to:
-``
-cgi::request req;
-cgi::response resp;
-
-cgi::param p = req.form("number");
-if (p.empty())
-{
- resp<< "You picked no numbers...";
-}
-else
-{
- int sum(0);
- for(; p != p.end(); ++p)
- {
- resp<< p << " ";
- sum += p.as<int>());
- }
-
- resp<< std::endl
- << "Your numbers add up to: " << sum;
-}
-
-resp.send(req);
-``
-
 [h4 Concept Documentation]
 
 Even though this library introduces very few new concepts, they are not currently documented. Links to Boost.Asio's concept documentation is also required (essentially as part of a reworking of the doxygen reference section).
 
-[h4 Support for environment Passed on Command Line]
-
-See section 4.4 of [@http://www.ietf.org/rfc/rfc3875]. Should be easy to do by modifying the `acgi::service` class.
-
-[h4 Support for Multi-part POST Forms]
-
-This has been added to the CGI part of the library, but it's very ugly and hackish. The idea is to create a `form_parser` class that can be used both internally and externally to parse multipart forms.
-
 [/h4 Removing aCGI/CGI Divide]
 
 [/h4 Unicode Support]

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/preface.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/preface.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/preface.qbk 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -15,10 +15,10 @@
 
 [* THIS LIBRARY IS NOT A PART OF BOOST.]
 
-Boost.CGI is an open-source library for writing CGI programs in Standard C++. The library supports vanilla CGI, SCGI and FastCGI (SCGI doesn't really work yet) so it can be used to write anything from simple 'CGI scripts' to full-fledged, scalable applications. This library rests on top of and should appear familiar to users of Boost.Asio, a cross-platform asynchronous (and ['fast]) networking library. One of the main aims of the library is to allow programs to be written for any of the supported protocols without any real modification.
+Boost.CGI is an open-source library for writing CGI programs in Standard C++. The library supports vanilla CGI and FastCGI [footnote SCGI support was orignally planned, but isn't currently included. If you want it, let me know.] so it can be used to write anything from simple 'CGI scripts' to full-fledged, scalable applications. This library rests on top of and should appear familiar to users of Boost.Asio, a cross-platform asynchronous (and ['fast]) networking library. One of the main aims of the library is to allow programs to be written for any of the supported protocols without any real modification.
 
 [tip
- The [*Deep End] is located in the examples directory. Try looking for the __examples__.
+ If you want to start with the [*Deep End], head straight to the __examples__.
 ]
 
 [h3 Motivation]
@@ -43,12 +43,12 @@
 
 With web applications becoming increasingly complex and responsive (ie. asynchronous, vis-à-vis AJAX) all the while being required to scale boundlessly - the benefits of C++ begin to show.
 
-The generally poor support for CGI programming for C++ - most libraries are either unmaintained, or don't take advantage of modern C++ capabilities - has driven the development of this library. [-moremoremore]
+The generally poor support for CGI programming for C++ - most libraries are either unmaintained, or don't take advantage of modern C++ capabilities - has driven the development of this library.
 
 [section:using How to use this manual]
 
 [note
-At the moment, the Boost [@http://www.boost.org/more/lib_guide.htm#Guidelines style guidelines] aren't honoured properly or consistently. Please ignore this for now, as the ambiguity is half-intentional (['since this [*is not] a Boost library]). It's simple enough to rectify.
+At the moment, the Boost [@http://www.boost.org/more/lib_guide.htm#Guidelines style guidelines] aren't always honoured properly. Please ignore this for now, as the ambiguity is half-intentional (['since this [*is not] a Boost library]). It's simple enough to rectify.
 ]
 
 [h4 Naming Conventions]
@@ -65,7 +65,7 @@
 
 [h5 Namespaces]
 
-The classes/functions that are shared between protocols are in the `cgi::common` namespace. Using the above headers dumps these into the relevant namespace.
+The classes/functions that are shared between protocols are in the `boost::cgi::common` namespace. Using the above headers dumps these into the relevant namespace.
 
 [table
   [[Protocol] [`namespace`]]
@@ -98,7 +98,7 @@
   [[`BOOST_CGI_DEFAULT_CONTENT_TYPE`] [This defaults to "text/plain" and causes a default "content-type" header to be output, but ['only when you don't output any other headers].
         ]]
 
- [[`BOOST_CGI_NO_DEFAULT_CONTENT_TYPE`] [`#define` this when you don't want a default "content-type" header to be output. CGI scripts always need one of these, so you will be responsible for sending one!
+ [[`BOOST_CGI_NO_DEFAULT_CONTENT_TYPE`] [`#define` this when you don't want a default "content-type" header to be output. CGI scripts always need one of these, so you will be responsible for sending one!msv
         ]]
 
 ]

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/reference.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/reference.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/reference.qbk 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -17,11 +17,12 @@
 
   * Request Data
       * environment
- * operator[""] (operator[] on the environment map)
- * operator[env] (request meta-data)
- * operator[get] (GET data)
- * operator[post] (POST data)
- * operator[cookies] (cookie data)
+ * member variables
+ * env (request meta-data)
+ * get (GET data)
+ * post (POST data)
+ * cookies (cookie data)
+ * form (GET, POST or env data, depending on the request method)
         * member functions
           * script_name()
           * request_method()
@@ -57,6 +58,7 @@
   * send()
   * clear()
   * data()
+ * charset() // get / set the charset of the request.
   * content_length()
 
 [endsect] [/ quick_reference]

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/troubleshooting.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/troubleshooting.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/troubleshooting.qbk 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -42,7 +42,7 @@
 ``
 
 [tip
- To check what directories are searched for libraries, try one of the echo examples on your server and look for a variable like `LIB_DIR` or `LIB`.
+ To check what directories are searched for libraries, try one of the echo examples provided with the library. Run it with your server and look for a variable like `LIB_DIR` or `LIB`.
 ]
 
 [endsect] [/ static_linking]

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game/main.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -209,7 +209,7 @@
   response resp;
   resp<< content_type("text/plain");
 
- if (has_key(req[form], "reset") && req[form]["reset"] == "true")
+ if (has_key(req.form, "reset") && req.form["reset"] == "true")
   {
     resp<< cookie("name")
         << redirect(req, req.script_name()); // redirect them.
@@ -217,12 +217,12 @@
     return 0;
   }
 
- if (has_key(req[form], "name"))
+ if (has_key(req.form, "name"))
   {
- if (has_key(req[form], "del"))
- resp<< cookie(req[form]["name"]);
+ if (has_key(req.form, "del"))
+ resp<< cookie(req.form["name"]);
     else
- resp<< cookie(req[form]["name"], req[form]["value"]);
+ resp<< cookie(req.form["name"], req.form["value"]);
     resp<< redirect(req, req.script_name());
     return_(resp, req, http::ok);
   }
@@ -240,8 +240,8 @@
          "<body>";
 
   // First, see if they have a cookie set
- if (has_key(req[cookies], "name"))
- resp<< "<h1>Hello again " << req[cookies]["name"] << "</h1>"
+ if (has_key(req.cookies, "name"))
+ resp<< "<h1>Hello again " << req.cookies["name"] << "</h1>"
           << "<p><a href='?reset=true'><input type='submit' value='Reset' /></a></p>";
   else
     resp<< "<h1>Hello there.</h1>";
@@ -249,13 +249,13 @@
   resp<< "<p>You can add cookies using the form below. If you add a cookie value for 'name', it will show up above.</p>"
          "<p>Here is list of the cookies you currently have:</p>";
   
- print_formatted_data(resp, req[cookies]);
+ print_formatted_data(resp, req.cookies);
   
   resp<< "<form method='get' action='" << req.script_name() << "' id='getform'>"
            "<label for='name' class='name'>Name:</label>"
- "<input id='name' name='name' class='value' type='text' value='" << req[form]["name"] << "'>""</input>"
+ "<input id='name' name='name' class='value' type='text' value='" << req.form["name"] << "'>""</input>"
            "<label for='value' class='name'>Value:</label>"
- "<input id='value' name='value' class='value' type='text' value='" << req[form]["value"] << "'>""</input>"
+ "<input id='value' name='value' class='value' type='text' value='" << req.form["value"] << "'>""</input>"
            "<label for='del' class='name'>Delete this cookie?</label>"
            "<input id='del' name='del' class='value' type='checkbox'></input>"
            "<div class='clear'></div>"

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game2/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game2/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/cookie_game2/main.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -107,7 +107,7 @@
     response_type resp;
 
     // Check if we are resetting the user.
- if (has_key(req[form], "reset") && req[form]["reset"] == "true")
+ if (has_key(req.form, "reset") && req.form["reset"] == "true")
     {
       resp<< cookie("name") // delete the 'name' cookie.
           << redirect(req, req.script_name()); // redirect them.
@@ -115,13 +115,13 @@
       return 0;
     }
 
- if (has_key(req[form], "name"))
+ if (has_key(req.form, "name"))
     {
       // If requested by the user, delete the cookie.
- if (has_key(req[form], "del"))
- resp<< cookie(req[form]["name"]);
+ if (has_key(req.form, "del"))
+ resp<< cookie(req.form["name"]);
       else // Set the cookie.
- resp<< cookie(req[form]["name"], req[form]["value"]);
+ resp<< cookie(req.form["name"], req.form["value"]);
       resp<< redirect(req, req.script_name());
       // Exit here.
       return_(resp, req, http::ok);
@@ -130,19 +130,19 @@
     dictionary_type dict("cookie-game dict");
 
     // First, see if they have a cookie set
- if (has_key(req[cookies], "name"))
- dict.SetValueAndShowSection("USER_NAME", req[cookies]["name"], "HAS_NAME_IN_COOKIE_true");
+ if (has_key(req.cookies, "name"))
+ dict.SetValueAndShowSection("USER_NAME", req.cookies["name"], "HAS_NAME_IN_COOKIE_true");
     else
       dict.ShowSection("HAS_NAME_IN_COOKIE_false");
 
- print_formatted_data(req[cookies], dict);
+ print_formatted_data(req.cookies, dict);
 
     dict.SetValue("SCRIPT_NAME", req.script_name());
     // get_value is defined in boost/cgi/util/
     // Looks up the key in the map, returns a default value if the key
     // isn't found.
- dict.SetValue("COOKIE_NAME", get_value(req[form], "name", ""));
- dict.SetValue("COOKIE_VALUE", req[form]["value"]);
+ dict.SetValue("COOKIE_NAME", get_value(req.form, "name", ""));
+ dict.SetValue("COOKIE_VALUE", req.form["value"]);
 
     // Load the HTML stencil now from the index.html file.
     stencil_type* stencil = get_stencil("../templates/index.html");

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/acgi/echo/main.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -137,7 +137,7 @@
                "Environment stuffs:<br />"
                " > content_type: " << req.env["Content_type"] << "<br />"
                " > script uri: " << req.env["script_uri"] << "<br />"
- " > count('girl'): " << req.get.count("girl") << "<br />"
+ " > count('foo'): " << req.get.count("foo") << "<br />"
                "Environment stuffs:<br />"
                "Request ID = " << req.id() << "<br />"
                "Process ID = " << process_id() << "<br />"

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/Timer.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/Timer.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/Timer.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -1,6 +1,11 @@
 
 #undef max
 #undef min
+/**
+ * You need Boost.Chrono from the Boost sandbox svn.
+ *
+ * See http://svn.boost.org/trac/boost/browser/sandbox/chrono/.
+ */
 #include <boost/chrono/chrono.hpp>
 
 //using namespace boost::chrono;

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -175,10 +175,9 @@
             //style='"
               // "border-color: #ca3766;" "border-width: 1px 0 1px 0;" "border-style: solid;"
                 // "padding: 2px 8px 2px 8px;" "margin: 1em" "'>";
- detail::format_map(resp2, request[boost::cgi::env], "Env data");
- //detail::format_map(resp2, request[boost::cgi::env_map], "Env data");
- detail::format_map(resp2, request[boost::cgi::form], "Form (" + request.request_method() + ") data");
- detail::format_map(resp2, request[boost::cgi::cookies], "Cookies");
+ detail::format_map(resp2, request.env, "Environment data");
+ detail::format_map(resp2, request.form, "Form [" + request.request_method() + "] Variables");
+ detail::format_map(resp2, request.cookies, "Cookies");
     resp2<< "</div>"
             "<p>The headers sent in the original (broken) response were:</p>"
             "<div class=\"info\">"
@@ -212,15 +211,6 @@
     bomb_out(err_msg, response, request);
 }
 
-void TracingServer::bomb_out(std::exception* e, response_type& response, request_type& request) {
- typedef request_type::string_type string;
- string err_msg("<ul class=nvpair>std::exception*<li class=name>What:</li>");
- err_msg += string("<li class=value>") + e->what() + "</li>"
- + "<li class=name>Type:</li>"
- + "<li class=value>" + typeid(e).name() + "</li><br class=clear /></ul>";
- bomb_out(err_msg, response, request);
-}
-
 void TracingServer::bomb_out(std::exception& e, response_type& response, request_type& request) {
     typedef request_type::string_type string;
     string err_msg("<ul class=nvpair>std::exception<li class=name>What:</li>");
@@ -238,7 +228,7 @@
     try {
         request.load(boost::cgi::parse_all);
         int ret(callback(request, response));
- if (request[boost::cgi::form]["debug"] == "1") {
+ if (request.form["debug"] == "1") {
             bomb_out("** Debug mode ** - client callback returned code #" + boost::lexical_cast<std::string>(ret)
                     , response, request);
         }else
@@ -251,8 +241,6 @@
         }
     }catch(boost::system::system_error* err) {
         bomb_out(err, response, request); return false;
- }catch(std::exception* e) {
- bomb_out(e, response, request); return false;
     }catch(std::exception& e) {
         bomb_out(e, response, request); return false;
     }catch(...){

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.hpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -38,6 +38,5 @@
 
     void bomb_out(std::string const& error, response_type&, request_type&);
     void bomb_out(boost::system::system_error* err, response_type&, request_type&);
- void bomb_out(std::exception* e, response_type&, request_type&);
     void bomb_out(std::exception& e, response_type&, request_type&);
 };

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/hello.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/hello.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/hello.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -10,7 +10,6 @@
 // Uses a server class that catches and reports errors in your handler.
 #include "TracingServer.hpp"
 
-using boost::cgi::form;
 using boost::cgi::request;
 using boost::cgi::response;
 using boost::cgi::header;
@@ -51,8 +50,8 @@
            "</p>"
            "</body>"
            "</html>";
- if (req[form]["badger"] == "bait!") throw std::runtime_error("AOUHFAEOUHAEOUHAEOUHOUH!!!!!!");
- else if (has_key(req[form], "spam")) return 33;
+ if (req.get["badger"] == "bait!") throw std::runtime_error("You asked for an error, you got one.");
+ else if (has_key(req.get, "spam")) return 33;
     return 0;
 }
 

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/echo/main.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -38,15 +38,14 @@
 
 int main()
 {
- request req; // A basic CGI request auto-parses everything (including POST data).
+ request req(parse_all); // A basic CGI request auto-parses everything (including POST data).
   response resp;
 
   resp<< "Request id = " << req.id() << "<p/>";
 
- show_map_contents(resp, req[env], "Environment Variables");
- show_map_contents(resp, req[get], "GET Variables");
- show_map_contents(resp, req[post], "POST Variables");
- show_map_contents(resp, req[cookies], "Cookie Variables");
+ show_map_contents(resp, req.env, "Environment Variables");
+ show_map_contents(resp, req.form, "Form [" + req.request_method() + "] Variables");
+ show_map_contents(resp, req.cookies, "Cookie Variables");
 
   // Note that this (and any other) HTTP header can go either before or after
   // the response contents.

Deleted: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/amortization.tpl
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/amortization.tpl 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
+++ (empty file)
@@ -1,174 +0,0 @@
-<html>
-<head>
- <link rel="stylesheet" type="text/css" href="/amortization.css">
-
- <title>Fixed Mortgage Loan Calculator</title>
- <script type="text/javascript" language="JavaScript1.2" src="/amortization.js"></script>
-</head>
-
-<body>
-
-{{!--Amortization form}}
-<form name="AmortBrowser" action="{{SCRIPT_NAME}}" method="post">
- <input type="hidden" name="Amortize" value="1">
- <table width="550" border="0" cellpadding="0" cellspacing="1" class="tblbase">
- <tr>
- <td colspan=4 class=tblhead align=center>FIXED MORTGAGE LOAN CALCULATOR</td>
- </tr>
- <tr>
- <td colspan=2 class=tblhead align=center>Loan Information</td>
- <td colspan=2 class=tblhead align=center>Prepayment Information (optional)</td>
- </tr>
- <tr>
- <td width="250" class="td1">Mortgage Amount</td>
- <td class="td2">
- <input name="LoanAmt" type="text" onBlur="this.value=formatCurrency(this.value);" value="{{LoanAmt}}" size="10">
- </td>
- <td width="250" class="td1">Prepayment Frequency</td>
- <td class="td2">
- <select name="PrePmtFreq" {{PrePmtFreqInvalid}}>{{PrePmtFreq}}</select>
- </td>
- </tr>
- <tr>
- <td class="td1">Interest (APR)</td>
- <td class="td2">
- <input name="YearlyIntRate" type="text" value="{{YearlyIntRate}}" size="10">
- </td>
- <td class="td1">Prepayment Amount</td>
- <td class="td2">
- <input name="PrePmtAmt" type="text" value="{{PrePmtAmt}}" size="17" {{PrePmtFreqInvalid}}>
- </td>
- </tr>
- <tr>
- {{!-- Length of Loan selection list }}
- <td class="td1">Length of Loan</td>
- <td class="td2">
- <select name="TermYrs">
- {{#SELECT_TERM_YEARS}}
- <option value="{{TermYrs}}">{{TermYrs}} Years</option>
- {{/SELECT_TERM_YEARS}}
- </select>
- </td>
- <td class="td1">Start with Payment</td>
- <td class="td2">
- <input name="PrePmtBegin" type="text" value="{{PrePmtBegin}}" size="17">
- </td>
- </tr>
- <tr>
- <td class="td1"></td>
- <td class="td2">
- <input type="submit" value="Calculate">
- </td>
- </tr>
-
- {{#NotAmortize}}
- <tr>
- <td colspan="4" class="td2"><span class="small">
- DISCLAIMER: The figures above are based upon conventional program guidelines.<br>
- Calculations by this tool are believed to be accurate, yet are not guaranteed. Further review is<br>
- necessary to obtain an exact qualification. If you have less than 20% equity in your home, a monthly<br>
- mortgage insurance payment may be required.
- </span></td>
- </tr>
- {{/NotAmortize}}
-
- </table>
-</FORM>
-
-{{!--Prepayment summary table}}
-{{#PrePmtSummary}}
- <table width="550" border="0" cellpadding="0" cellspacing="1" class="tblbase">
- <tr>
- <td colspan=4 class=tblhead align=center>PREPAYMENT vs REGULAR PAYMENT</td>
- </tr>
- <tr>
- <td colspan=2 class=tblhead align=center>Prepayment Results</td>
- <td colspan=2 class=tblhead align=center>Regular Payment Results</td>
- </tr>
- <tr>
- <td class="td1">Number of months to pay loan</td>
- <td class="td2" width="125">
- <center><b>{{PrePmt_iPmtNo}}</b></center>
- </td>
- <td class="td1"></td>
- <td class="td2" width="125">
- <center><b>{{RegPmt_iPmtNo}}</b></center>
- </td>
- </tr>
- <tr>
- <td class="td1">Total Interest Paid</td>
- <td class="td2" align="right">{{PrePmt_TotalIntPd}}</td>
- <td class="td1"></td>
- <td class="td2" align="right">{{RegPmt_TotalIntPd}}</td>
- </tr>
- <tr>
- <td width="250" class="td1">Total Payments</td>
- <td class="td2" align="right">{{PrePmt_TotalPmts}}</td>
- <td width="250" class="td1"></td>
- <td class="td2" align="right">{{RegPmt_TotalPmts}}</td>
- </tr>
- <tr>
- <td colspan="4" class="td2"><span class="small">
- <br>
- By applying the prepayments in the schedule above, you would <u>realize these savings</u>:
- <ul>
- <li>
- You pay the <b>{{RegPmt_term_to_words}}</b> loan in <b>{{PrePmt_term_to_words}}</b>
- <br><br>
- <li>The total loan payments will be <b>{{PrePmt_TotalPmts}}</b> instead of <b>{{RegPmt_TotalPmts}}</b>
- </ul>
- </span></td>
- </tr>
- </table>
- <br>
-{{/PrePmtSummary}}
-
-{{#RegPmtSummary}}
- {{!--Regular Payment summary table}}
- <table width="550" border="0" cellpadding="0" cellspacing="1" class="tblbase">
- <tr>
- <td colspan=4 class=tblhead align=center>REGULAR PAYMENT SUMMARY</td>
- </tr>
- <tr>
- <td class="td1">Monthly Payment</td>
- <td class="td2" width="125" align="right"><b>${{MonthlyPmt}}</b></td>
- </tr>
- <tr>
- <td class="td1">Total Interest Paid</td>
- <td class="td2" width="125" align="right">${{RegPmt_TotalIntPd}}</td>
- </tr>
- <tr>
- <td class="td1">Total Payments</td>
- <td class="td2" width="125" align="right">${{RegPmt_TotalPmts}}</td>
- </tr>
- </table>
- <br>
-{{/RegPmtSummary}}
-
-{{!--Amortization table}}
-
-{{#Amortize}}
- <table border=0 cellpadding=0 cellspacing=1 width=550 class="tblbase">
- <tr>
- <td colspan=6 class=tblhead align=center>AMORTIZATION TABLE</td>
- </tr>
- <td class=tblhead align=center>Payment</td>
- <td class=tblhead align=center>Mo. Payment</td>
- <td class=tblhead align=center>Interest Pd.</td>
- <td class=tblhead align=center>Principal Pd.</td>
- <td class=tblhead align=center>New Balance</td>
- {{#PaymentEntry}}
- <tr class=row{{ROW_TYPE}}>
- <td ALIGN=CENTER>{{ROW_NUM}}</td>
- <td>${{Payment}}</td>
- <td>${{InterestPaid}}</td>
- <td>${{PrincipalPaid}}</td>
- <td>${{Balance}}</td>
- </tr>
- {{/PaymentEntry}}
- </table>
-{{/Amortize}}
-
-</body>
-</html>
-

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/main.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <iomanip>
 #include <boost/cgi/fcgi.hpp>
+#include <boost/cgi/utility.hpp>
 #include <boost/algorithm/string/regex.hpp>
 #include <google/template.h>
 
@@ -38,10 +39,10 @@
 template<typename Request>
 void fill_amortization_dictionary(google::TemplateDictionary& dict, Request& req)
 {
- dict.SetValue("LoanAmt", has_key(req[post], "LoanAmt")
- ? "$250,000" : req[post]["LoanAmt"]);
- dict.SetValue("YearlyIntRate", has_key(req[post], "YearlyIntRate")
- ? "6.000" : req[post]["YearlyIntRate"]);
+ dict.SetValue("LoanAmt", has_key(req.post, "LoanAmt")
+ ? "$250,000" : req.post["LoanAmt"]);
+ dict.SetValue("YearlyIntRate", has_key(req.post, "YearlyIntRate")
+ ? "6.000" : req.post["YearlyIntRate"]);
 
   boost::array<std::string, 8> year_opts
     = {{ "5", "7", "10", "20", "30", "40", "50" }};
@@ -51,13 +52,13 @@
     dict.SetValueAndShowSection("TermYrs", year, "SELECT_TERM_YEARS");
   }
 
- if (req[post]["Amortize"]).empty())
+ if (req.post["Amortize"].empty())
     dict.ShowSection("NotAmortize");
   else
   {
- double P = boost::lexical_cast<double>(string_from_currency(req.POST("LoanAmt")));
- double i = boost::lexical_cast<double>(req.POST("YearlyIntRate")) / 1200;
- double n = boost::lexical_cast<double>(req.POST("TermYrs")) * 12;
+ double P = boost::lexical_cast<double>(string_from_currency(req.post["LoanAmt"]));
+ double i = boost::lexical_cast<double>(req.post["YearlyIntRate"]) / 1200;
+ double n = boost::lexical_cast<double>(req.post["TermYrs"]) * 12;
     double monthly_payments = (P*i) / (1 - std::pow((1+i), -n));
     
     google::TemplateDictionary* sub_dict = dict.AddSectionDictionary("RegPmtSummary");
@@ -101,12 +102,12 @@
   fill_amortization_dictionary(dict, req);
 
   google::Template* tmpl
- = google::Template::GetTemplate("amortization.tpl", google::STRIP_WHITESPACE);
+ = google::Template::GetTemplate("../templates/amortization.html", google::STRIP_WHITESPACE);
 
   std::string h("Content-type: text/html\r\n\r\n");
   write(req.client(), buffer(h));
 
- std::string arg(req[get]["arg"]));
+ std::string arg(req.get["arg"]);
   if (arg.empty())
     arg = "2"; // set this as default (for no particular reason).
 
@@ -160,7 +161,7 @@
     req.load(parse_all);
 
     resp<< content_type("text/html")
- << "map size := " << req[post].size() << "<p>";
+ << "map size := " << req.post.size() << "<p>";
   
     ret = write_amortization_template(req, resp);
 
@@ -186,8 +187,7 @@
   try{
 
     service s;
- acceptor a(s, true); // The true means default-initialise.
- // Unfortunately this only works on linux w. apache for now.
+ acceptor a(s, 8010); // Listen on port 8010.
 
     accept_requests(a);
     

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/echo/main.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -19,6 +19,7 @@
 #include <boost/program_options/environment_iterator.hpp>
 ///////////////////////////////////////////////////////////
 #include "boost/cgi/fcgi.hpp"
+#include "boost/cgi/utility/commit.hpp"
 
 using namespace std;
 using namespace boost::fcgi;
@@ -91,7 +92,7 @@
   //
   // Load in the request data so we can access it easily.
   //
- req.load(ec, true); // The 'true' means read and parse STDIN (ie. POST) data.
+ req.load(parse_all); // Read and parse STDIN (ie. POST) data.
 
   //
   // Construct a `response` object (makes writing/sending responses easier).
@@ -116,12 +117,12 @@
          "<body>"
            "Request ID = " << req.id() << "<br />"
            "Process ID = " << process_id() << "<br />"
- "<form method=POST enctype='multipart/form-data'>"
+ "<form method=post>" // enctype=\"multipart/form-data\">"
              "<input type=text name=name value='"
- << req[post]["name"] << "' />"
+ << req.post["name"] << "' />"
              "<br />"
              "<input type=text name=hello value='"
- << req[post]["hello"] << "' />"
+ << req.post["hello"] << "' />"
              "<br />"
              "<input type=file name=user_file />"
              "<input type=hidden name=cmd value=multipart_test />"
@@ -133,10 +134,10 @@
   // Use the function defined above to show some of the request data.
   // (this function isn't part of the library)
   //
- format_map(resp, req[env], "Environment Variables");
- format_map(resp, req[get], "GET Variables");
- format_map(resp, req[post], "POST Variables");
- format_map(resp, req[cookies], "Cookie Variables");
+ format_map(resp, req.env, "Environment Variables");
+ format_map(resp, req.get, "GET Variables");
+ format_map(resp, req.post, "POST Variables");
+ format_map(resp, req.cookies, "Cookie Variables");
 
   // Print the complete buffer containing the POST data and the FastCGI params.
   resp<< "<pre>";
@@ -152,10 +153,10 @@
   //
   resp<< "Response content-length == "
       << resp.content_length() // the content-length (returns std::size_t)
- << content_length(resp); // a content-length header
+ ;//<< content_length(resp); // a content-length header
 
- // This funky macro finishes up:
- return_(resp, req, 0);
+ // This function finishes up:
+ return commit(req, resp, 0);
   //
   // It is equivalent to the below, where the third argument is represented by
   // `program_status`:
@@ -174,8 +175,13 @@
 
   // Make a `service` (more about this in other examples).
   service s;
+
+ using boost::asio::ip::tcp;
+
+ //tcp::endpoint endpoint(tcp::v4(), 8009);
   // Make an `acceptor` for accepting requests through.
- acceptor a(s);
+ acceptor a(s, 8009); // The acceptor is for accepting requests.
+ cerr<< "Listening" << endl;
 
   //
   // After the initial setup, we can enter a loop to handle one request at a
@@ -193,6 +199,8 @@
     for (;;)
     {
       a.accept(req);
+ cerr<< "is_cgi ? " << a.is_cgi() << endl;
+ cerr<< "Accepted" << endl;
       ret = handle_request(req);
       if (ret)
         break;
@@ -207,13 +215,13 @@
   
   return ret;
 
-}catch(boost::system::system_error& se){
+}catch(boost::system::system_error const& se){
   // This is the type of error thrown by the library.
   cerr<< "[fcgi] System error: " << se.what() << endl;
   return 1313;
-}catch(exception* e){
+}catch(exception const& e){
   // Catch any other exceptions
- cerr<< "[fcgi] Exception: " << e->what() << endl;
+ cerr<< "[fcgi] Exception: " << e.what() << endl;
   return 666;
 }catch(...){
   cerr<< "[fcgi] Uncaught exception!" << endl;

Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/hello_world/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/hello_world/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/hello_world/main.cpp 2009-09-01 07:19:57 EDT (Tue, 01 Sep 2009)
@@ -13,52 +13,58 @@
 //
 
 #include <cmath>
+#include <iostream>
+#include <boost/asio.hpp>
 #include <boost/system/system_error.hpp>
-//#include <boost/cgi/fcgi.hpp>
-//#include <boost/cgi.hpp>
+#include <boost/cgi/fcgi.hpp>
+#include <boost/cgi/utility/commit.hpp>
 
 using namespace std;
-//using namespace boost::fcgi;
+using namespace boost::fcgi;
 
 #include <iostream>
 
-class Test
-{
-public:
- Test() {
- //std::cerr<< "Test Test!!!";
- }
-};
-
-// Initialise first.
-Test test;
-
 template<typename Request, typename Response>
 int handle_request(Request& req, Response& resp)
 {
   // This is a minimal response. The content_type(...) may go before or after
   // the response text.
- resp//<< content_type("text/plain")
+ resp<< content_type("text/plain")
       << "Hello there, universe.";
 
- return_(resp, req, 0);
+ return commit(req, resp, 0);
 }
 
+
+//
+template<typename OStreamT, typename MapT>
+void show_map_contents(OStreamT& os, MapT& m, const std::string& title)
+{
+ os<< "<h3>" << title << "</h3>";
+
+ if (m.empty())
+ os<< "NONE<br />";
+ else
+ for (typename MapT::const_iterator i = m.begin(); i != m.end(); ++i)
+ os<< "<b>" << i->first << "</b> = <i>"
+ << i->second << "</i><br />";
+}
+
+
 int main()
 {
   int ret = 0; // the return value
 
- for(long i=1000000000; i != 0; --i)
- {
- std::sqrt(1236.456L); // waste time
- }
+ //for(long i=1000000000; i != 0; --i)
+ //{
+ // std::sqrt(1236.456L); // waste time
+ //}
 
   try
- {/*
+ {
     service s; // This becomes useful with async operations.
- acceptor a(s); // The acceptor is for accepting requests
+ acceptor a(s, (unsigned short)8008); // The acceptor is for accepting requests
 
-
     for (;;)
     {
       request req(s); // Our request (reusing this when possible saves expensive
@@ -74,14 +80,14 @@
       }
       if (!a.is_open()) break; // Quit completely if the acceptor bails out.
     }
- */
- }catch(boost::system::system_error& err){
- std::cerr<< "System Error: [" << err.id() << "] - " << err.message() << std::endl;
+ }catch(boost::system::system_error const& err){
+ std::cerr<< "System Error: [" << err.code() << "] - " << err.what() << std::endl;
   }catch(std::exception const& e){
     std::cerr<< "Exception: [" << typeid(e).name() << "] - " << e.what() << std::endl;
   }catch(...){
     std::cerr<< "boom<blink>!</blink>";
   }
+ cin.get();
   return ret;
 }
 //]


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