Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62273 - in sandbox/SOC/2007/cgi/trunk/boost/cgi: . cgi common detail fcgi impl
From: lists.drrngrvy_at_[hidden]
Date: 2010-05-27 14:13:05


Author: drrngrvy
Date: 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
New Revision: 62273
URL: http://svn.boost.org/trac/boost/changeset/62273

Log:
* Do not URL-decode cookie values.
* Add typedef for boost::cgi::client, for consistency.
* Add missing header in path_info.hpp.
* Add missing overloads for request_service::close
Added:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/client.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp | 16 ++++++++--------
   sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi.hpp | 1 +
   sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_service.hpp | 17 +++++++++++++++--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp | 1 +
   sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp | 17 +++++++++++++++--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/extract_params.hpp | 5 +++--
   sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp | 10 ++++++----
   sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp | 4 ++--
   8 files changed, 51 insertions(+), 20 deletions(-)

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -81,17 +81,17 @@
     session_type session;
 #endif // BOOST_CGI_ENABLE_SESSIONS
     
- /// The environment data, exposed as a request_data<env_map>.
+ /// The environment data, exposed as a `request_data<env_map>`.
     env_data env;
- /// The GET (ie. query string) data, exposed as a request_data<get_map>.
+ /// The GET (ie. query string) data, exposed as a `request_data<get_map>`.
     post_data post;
- /// The POST data, exposed as a request_data<post_map>.
+ /// The POST data, exposed as a `request_data<post_map>`.
     get_data get;
- /// The form data, which is either the GET or POST data.
+ /// The form data, which is either the GET or POST data.
     form_data form;
- /// The cookie data, exposed as a request_data<cookie_map>.
+ /// The cookie data, exposed as a `request_data<cookie_map>`.
     cookie_data cookies;
- /// The file uploads, exposed as a request_data<upload_map>.
+ /// The file uploads, exposed as a `request_data<upload_map>`.
     upload_data uploads;
 
     basic_request(
@@ -381,7 +381,7 @@
     /// Reject the request with a '500 Internal Server Error' error.
     int reject()
     {
- this->service.set_status(this->implementation, aborted);
+ this->service.status(this->implementation, aborted);
       return this->service.close(this->implementation
                                 , http::internal_server_error);
     }
@@ -389,7 +389,7 @@
     /// Abort a request.
     void abort()
     {
- this->service.set_status(this->implementation, aborted);
+ this->service.status(this->implementation, aborted);
     }
 
     /// Clear the data for the request, for reusing this object.

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -13,6 +13,7 @@
 
 // Include all cgi-related headers only.
 #include "boost/cgi/cgi/request.hpp"
+#include "boost/cgi/cgi/client.hpp"
 #include "boost/cgi/cgi/service.hpp"
 
 // Include headers common to all protocols

Added: sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/client.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/client.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -0,0 +1,25 @@
+// -- cgi/client.hpp --
+//
+// Copyright (c) Darren Garvey 2010.
+// 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_CLIENT_HPP_INCLUDED__
+#define CGI_CLIENT_HPP_INCLUDED__
+
+#include "boost/cgi/common/tags.hpp"
+#include "boost/cgi/fwd/basic_client_fwd.hpp"
+
+BOOST_CGI_NAMESPACE_BEGIN
+
+ typedef common::basic_client<common::tags::cgi> cgi_client;
+ /// typedef for typical usage
+ typedef cgi_client client;
+
+BOOST_CGI_NAMESPACE_END
+
+#include "boost/cgi/basic_client.hpp"
+
+#endif // CGI_CLIENT_HPP_INCLUDED__

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_service.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -110,8 +110,21 @@
 
     int request_id(implementation_type& impl) { return 1; }
 
- // **FIXME** should return error_code
- int close(implementation_type& impl, common::http::status_code& http_s
+ /// Close the request.
+ int close(implementation_type& impl,
+ common::http::status_code http_s = http::ok
+ , int program_status = 0)
+ {
+ int s(0);
+ boost::system::error_code ec;
+ s = close(impl, http_s, program_status, ec);
+ detail::throw_error(ec);
+ return s;
+ }
+
+ /// Close the request.
+ int close(implementation_type& impl,
+ common::http::status_code http_s
       , int program_status, boost::system::error_code& ec)
     {
       status(impl, common::closed);

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -2,6 +2,7 @@
 #ifndef BOOST_CGI_COMMON_PATH_INFO_HPP_INCLUDED_
 #define BOOST_CGI_COMMON_PATH_INFO_HPP_INCLUDED_
 
+#include <vector>
 #include <boost/algorithm/string/trim.hpp>
 #include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/classification.hpp>

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -257,6 +257,16 @@
       impl.status(status);
     }
 
+ /// Close the request.
+ template<typename ImplType>
+ int close(ImplType& impl
+ , http::status_code& hsc = http::ok
+ , int program_status = 0)
+ {
+ status(closed);
+ return program_status;
+ }
+
     /// Return if the request is still open.
     template<typename ImplType>
     bool is_open(ImplType& impl)
@@ -333,7 +343,10 @@
       return ec;
     }
 
- /// Read and parse the HTTP_COOKIE meta variable
+ /// Read and parse the HTTP_COOKIE meta variable.
+ /**
+ * Note: Do not URL decode the cookie values.
+ */
     template<typename ImplType>
     boost::system::error_code
     parse_cookie_vars(ImplType& impl, boost::system::error_code& ec)
@@ -347,7 +360,7 @@
           detail::extract_params(vars, cookie_vars(impl.vars_)
                                 , boost::char_separator<char>
                                     ("", "=;", boost::keep_empty_tokens)
- , ec);
+ , ec, false);
         status(impl, (common::request_status)(status(impl) | common::cookies_read));
       }
       return ec;

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/extract_params.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/extract_params.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/extract_params.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -30,7 +30,8 @@
    extract_params(const String& input
                  , Map& destination
                  , const Separator& separator
- , boost::system::error_code& ec)
+ , boost::system::error_code& ec
+ , bool url_decode_values = true)
    {
      if( input.empty() )
        return ec;// = boost::system::error_code(34, boost::system::errno_ecat);
@@ -75,7 +76,7 @@
          name.clear();
        }else
        {
- current_token = url_decode(*iter);
+ current_token = url_decode_values ? url_decode(*iter) : *iter;
        }
      }
      

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -106,12 +106,14 @@
     }
 
     /// Close the request.
- int close(implementation_type& impl, ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
- , int program_status);
+ int close(implementation_type& impl,
+ http::status_code hsc = http::ok
+ , int program_status = 0);
 
     /// Close the request.
- int close(implementation_type& impl, ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
- , int program_status, boost::system::error_code& ec);
+ int close(implementation_type& impl,
+ http::status_code hsc
+ , int program_status, boost::system::error_code& ec);
 
     /// Clear all request data (object is then safe to reuse).
     void clear(implementation_type& impl);

Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp 2010-05-27 14:13:04 EDT (Thu, 27 May 2010)
@@ -83,7 +83,7 @@
     BOOST_CGI_INLINE int
     fcgi_request_service<Protocol>::close(
         implementation_type& impl
- , ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
+ , http::status_code hsc
       , int program_status)
     {
       boost::system::error_code ec;
@@ -96,7 +96,7 @@
     BOOST_CGI_INLINE int
     fcgi_request_service<Protocol>::close(
         implementation_type& impl
- , ::BOOST_CGI_NAMESPACE::common::http::status_code&
+ , http::status_code hsc
       , int program_status
       , boost::system::error_code& ec)
     {


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