|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58465 - in sandbox/SOC/2007/cgi/branches/pickmeup: . boost/cgi boost/cgi/cgi boost/cgi/common boost/cgi/connections boost/cgi/detail boost/cgi/fcgi boost/cgi/fwd boost/cgi/impl libs/cgi/build/msvc/9.0/Boost.CGI libs/cgi/build/msvc/9.0/Boost.CGI/acgi_cookie_game libs/cgi/build/msvc/9.0/Boost.CGI/acgi_echo libs/cgi/build/msvc/9.0/Boost.CGI/acgi_hello_world libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world libs/cgi/doc libs/cgi/doc/src libs/cgi/doc/src/user_guide libs/cgi/doc/src/user_guide/tutorial libs/cgi/example libs/cgi/example/cgi libs/cgi/example/cgi/DebugServer libs/cgi/example/cgi/DebugServer2 libs/cgi/example/cgi/cookie_game2 libs/cgi/example/cgi/echo libs/cgi/example/cgi/hello_world libs/cgi/example/cgi/stencil libs/cgi/example/fcgi/echo libs/cgi/example/fcgi/file_browser libs/cgi/example/fcgi/hello_world
From: lists.drrngrvy_at_[hidden]
Date: 2009-12-19 21:00:32
Author: drrngrvy
Date: 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
New Revision: 58465
URL: http://svn.boost.org/trac/boost/changeset/58465
Log:
Lots of refactoring:
* Use protocol_traits more to determine properties of basic_request<> and basic_client<>.
* Moved more of the request implementation_type into the common request_base class
* Added accessor to basic_request<> to get the form_part for POST data, if it exists.
* Other tidying.
Added:
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/stencil/
Removed:
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_impl.hpp
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/acgi_cookie_game/
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/acgi_echo/
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/acgi_hello_world/
Binary files modified:
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 | 60 ++++++++++---------
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request.hpp | 4
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_service.hpp | 32 ++++------
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/connection_base.hpp | 17 -----
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/cookie.hpp | 74 +++--------------------
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/form_part.hpp | 37 ++++++++++-
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/name.hpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/path_info.hpp | 123 ++++++++++++++++++++-------------------
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/request_base.hpp | 98 ++++++++++++++++++++++++-------
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/response.hpp | 10 +-
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/tags.hpp | 5 -
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/connections/shareable_tcp_socket.hpp | 9 +-
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/common_headers.hpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/protocol_traits.hpp | 81 +++++++++++++++++---------
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi.hpp | 6 -
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/acceptor_service_impl.hpp | 4
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/client.hpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request.hpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_acceptor_service.hpp | 13 ++-
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_service.hpp | 32 +---------
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/service.hpp | 4
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fwd/basic_request_fwd.hpp | 4
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/fcgi_request_service.ipp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/impl/form_parser.ipp | 6 +
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.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_amortization/fcgi_amortization.vcproj | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj | 6 +
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj | 5
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/Jamfile.v2 | 26 +++++++-
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/cgi.qbk | 10 +-
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/headers.qbk | 8 -
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/request_objects.qbk | 9 +-
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp | 6
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/Jamfile.v2 | 14 ---
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/hello.cpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp | 4
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/ctemplate.cpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookie_game2/main.cpp | 11 +-
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/doc.qbk | 8 ++
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/echo/main.cpp | 13 +++
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/hello_world/main.cpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/doc.qbk | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/echo/main.cpp | 2
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/file_browser/main.cpp | 4
sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/hello_world/main.cpp | 7 --
sandbox/SOC/2007/cgi/branches/pickmeup/project-root.jam | 4
50 files changed, 403 insertions(+), 383 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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -55,8 +55,8 @@
* request, but it should be quite useful anyway.
* You can use this for logging or tracking, for example.
*/
- template<typename T, typename S>
- std::size_t hash_value(basic_request<T,S> const& req);
+ template<typename P>
+ std::size_t hash_value(basic_request<P> const& req);
/// The basic_request class, primary entry point to the library
/**
@@ -73,28 +73,24 @@
* mutex as an argument and lock it. (Async calls could get messy if you
* need a protected request object).
**/
- template<typename RequestService
- , typename ProtocolService
- , typename Allocator>
+ template<typename Protocol>
class basic_request
- : public detail::basic_io_object<RequestService>
+ : public detail::basic_io_object<
+ typename detail::protocol_traits<Protocol>::service_type
+ >
{
public:
- typedef
- basic_request<
- RequestService, ProtocolService
- , Allocator
- > self_type;
- typedef ::BOOST_CGI_NAMESPACE::common::map map_type;
- typedef RequestService service_type;
- typedef typename service_type::protocol_type protocol_type;
- typedef ProtocolService protocol_service_type;
- typedef boost::shared_ptr<self_type> pointer;
+ typedef basic_request<Protocol> self_type;
+ typedef Protocol protocol_type;
+ typedef detail::protocol_traits<protocol_type> traits;
+ typedef typename traits::protocol_service_type protocol_service_type;
+ typedef typename traits::service_type service_type;
+ typedef typename traits::pointer pointer;
typedef typename service_type::implementation_type implementation_type;
- typedef typename implementation_type::char_type char_type;
- typedef typename implementation_type::string_type string_type;
- typedef typename implementation_type::client_type client_type;
- typedef typename implementation_type::buffer_type buffer_type;
+ typedef typename traits::char_type char_type;
+ typedef typename traits::string_type string_type;
+ typedef typename traits::client_type client_type;
+ typedef typename traits::buffer_type buffer_type;
common::data_map_proxy<env_map> env;
common::data_map_proxy<post_map> post;
@@ -102,7 +98,8 @@
common::data_map_proxy<form_map> form;
common::data_map_proxy<cookie_map> cookies;
- basic_request(const parse_options opts = parse_none
+ basic_request(
+ const parse_options opts = traits::parse_opts
, char** base_env = NULL)
: detail::basic_io_object<service_type>()
{
@@ -111,7 +108,7 @@
// Won't throw
basic_request(boost::system::error_code& ec
- , const parse_options opts = parse_none
+ , const parse_options opts = traits::parse_opts
, char** base_env = NULL)
: detail::basic_io_object<service_type>()
{
@@ -120,7 +117,7 @@
// Throws
basic_request(protocol_service_type& s
- , const parse_options opts = parse_none
+ , const parse_options opts = traits::parse_opts
, char** base_env = NULL)
: detail::basic_io_object<service_type>(s.io_service())
{
@@ -131,7 +128,7 @@
// Won't throw
basic_request(protocol_service_type& s
, boost::system::error_code& ec
- , const parse_options opts = parse_none
+ , const parse_options opts = traits::parse_opts
, char** base_env = NULL)
: detail::basic_io_object<service_type>(s.io_service())
{
@@ -365,7 +362,7 @@
* If you expect a field to be a file upload, check if it is using
* this function.
*/
- bool is_file(string_type const& key)
+ bool is_file(string_type& key)
{
return this->service.is_file(this->implementation, key);
}
@@ -637,12 +634,19 @@
{
this->service.set_status(this->implementation, status);
}
+
+ /// Get the form_part for the passed key, which may not exist.
+ boost::optional<common::form_part&> get_form_part(string_type const& key)
+ {
+ return this->service.get_form_part(this->implementation, key);
+ }
+
};
- template<typename T, typename S>
- std::size_t hash_value(basic_request<T,S> const& req)
+ template<typename P>
+ std::size_t hash_value(basic_request<P> const& req)
{
- boost::hash<typename basic_request<T,S>::string_type> hasher;
+ boost::hash<typename basic_request<P>::string_type> hasher;
return hasher(req.env["REMOTE_ADDR"] + ":"
+ req.env["REMOTE_PORT"] + ":"
+ req.env["HTTP_USER_AGENT"] + ":"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -14,7 +14,6 @@
#include "boost/cgi/detail/protocol_traits.hpp"
#include "boost/cgi/common/tags.hpp"
#include "boost/cgi/cgi/service.hpp"
-#include "boost/cgi/cgi/request_impl.hpp"
#include "boost/cgi/cgi/request_service.hpp"
#include "boost/cgi/fwd/basic_request_fwd.hpp"
@@ -22,8 +21,7 @@
typedef
common::basic_request<
- ::BOOST_CGI_NAMESPACE::cgi_request_service,
- ::BOOST_CGI_NAMESPACE::cgi_service
+ common::tags::cgi
>
cgi_request;
Deleted: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_impl.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
+++ (empty file)
@@ -1,72 +0,0 @@
-// -- cgi_request_impl.hpp --
-//
-// Copyright (c) Darren Garvey 2007-2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_CGI_REQUEST_IMPL_HPP_INCLUDED__
-#define CGI_CGI_REQUEST_IMPL_HPP_INCLUDED__
-
-#include "boost/cgi/detail/push_options.hpp"
-
-#include "boost/cgi/cgi/service.hpp"
-#include "boost/cgi/basic_client.hpp"
-#include "boost/cgi/connections/async_stdio.hpp"
-
-// Make this ProtocolService-independent
-
-BOOST_CGI_NAMESPACE_BEGIN
-
- class cgi_request_impl
- {
- public:
- typedef ::BOOST_CGI_NAMESPACE::common::map map_type;
- typedef ::BOOST_CGI_NAMESPACE::cgi::service protocol_service_type;
- typedef protocol_service_type::protocol_type protocol_type;
- typedef connections::async_stdio connection_type;
- typedef
- ::BOOST_CGI_NAMESPACE::common::basic_client<
- connection_type, common::tags::cgi
- >
- client_type;
- typedef connection_type::pointer conn_ptr;
-
- /// Constructor
- cgi_request_impl()
- : stdin_parsed_(false)
- , stdin_data_read_(false)
- , stdin_bytes_left_(-1)
- , http_status_(common::http::ok)
- , request_status_(common::unloaded)
- {
- }
-
- protocol_service_type* service_;
-
- bool stdin_parsed() { return stdin_parsed_; }
- common::http::status_code& http_status() { return http_status_; }
- common::request_status& status() { return request_status_; }
-
- conn_ptr& connection() { return connection_; }
-
- bool stdin_parsed_;
- bool stdin_data_read_;
- std::size_t stdin_bytes_left_;
-
- private:
-
- common::http::status_code http_status_;
- common::request_status request_status_;
-
- conn_ptr connection_;
-
- };
-
-BOOST_CGI_NAMESPACE_END
-
-#include "boost/cgi/detail/pop_options.hpp"
-
-#endif // CGI_CGI_REQUEST_IMPL_HPP_INCLUDED__
-
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_service.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -13,7 +13,6 @@
#include "boost/cgi/common/tags.hpp"
#include "boost/cgi/common/map.hpp"
-#include "boost/cgi/cgi/request_impl.hpp"
#include "boost/cgi/import/io_service.hpp"
#include "boost/cgi/detail/service_base.hpp"
#include "boost/cgi/detail/extract_params.hpp"
@@ -43,36 +42,31 @@
BOOST_CGI_NAMESPACE_BEGIN
class cgi_request_service
- : public common::request_base<cgi_request_impl>
+ : public common::request_base<common::tags::cgi>
, public detail::service_base<cgi_request_service>
{
public:
typedef common::tags::cgi protocol_type;
typedef cgi_service protocol_service_type;
- typedef cgi_request_impl impl_type;
typedef cgi_request_service self_type;
- typedef common::request_base<self_type> base_type;
- typedef ::BOOST_CGI_NAMESPACE::common::map map_type;
struct implementation_type
- : impl_type
- , base_type::impl_base
+ : base_type::impl_base
{
- typedef impl_type::client_type client_type;
- typedef detail::form_parser form_parser_type;
-
implementation_type()
- : fp_(NULL)
+ : stdin_data_read_(false)
+ , stdin_bytes_left_(-1)
{
}
- client_type client_;
+ protocol_service_type* service_;
+
+ conn_ptr& connection() { return connection_; }
- // The number of characters left to read (ie. "content_length -
- // bytes_read")
- std::size_t characters_left_;
-
- boost::scoped_ptr<form_parser_type> fp_;
+ bool stdin_data_read_;
+ std::size_t stdin_bytes_left_;
+
+ conn_ptr connection_;
};
template<typename Service>
@@ -164,10 +158,10 @@
}
std::string const& cl = env_vars(impl.vars_)["CONTENT_LENGTH"];
- impl.characters_left_
+ impl.bytes_left_
= cl.empty() ? 0 : boost::lexical_cast<std::size_t>(cl);
impl.client_.bytes_left()
- = impl.characters_left_;
+ = impl.bytes_left_;
std::string const& request_method
= env_vars(impl.vars_)["REQUEST_METHOD"];
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/connection_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/connection_base.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/connection_base.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -18,23 +18,6 @@
{
public:
virtual ~connection_base() {}
-
- // read functions
- //template<typename MutableBufferSequence>
- //virtual std::size_t read(MutableBufferSequence) = 0;
-
- //template<typename MutableBufferSequence, typename Handler>
- //virtual void async_read(MutableBufferSequence, Handler) = 0;
-
- // write functions
- //template<typename ConstBufferSequence>
- //virtual std::size_t write(ConstBufferSequence) = 0;
-
- //template<typename ConstBufferSequence, typename Handler>
- //virtual void async_write(ConstBufferSequence, Handler) = 0;
-
- protected:
- //~connection_base() { }
};
BOOST_CGI_NAMESPACE_END
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/cookie.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/cookie.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/cookie.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -9,7 +9,6 @@
#ifndef CGI_COOKIE_HPP_INCLUDED__
#define CGI_COOKIE_HPP_INCLUDED__
-#include <iostream>
#include <string>
#include <boost/system/error_code.hpp>
#include <boost/tokenizer.hpp>
@@ -96,50 +95,10 @@
bool secure;
bool http_only;
- /// Create a cookie from a const char*
+ /// TODO: Create a cookie from a const char*
/**
- * Rules taken from: http://wp.netscape.com/newsref/std/cookie_spec.html
- *
- * Assumes:
- * - Parts of the cookie are delimited by '; '. ie. if there is no space,
- * or multiple spaces after the semi-colon, this function won't work...
+ * Rules at: http://wp.netscape.com/newsref/std/cookie_spec.html
*/
- /* Actually, I'm omitting these functions for now, just had a thought...
- static basic_cookie<string_type>
- from_string(const char* str, boost::system::error_code& ec)
- {
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep(";=");
- tokenizer tokens(str, sep);
- for (tokenizer::iterator iter = tokens.begin();
- iter != tokens.end(); ++iter)
- {
-
- }
- return ck;
- }
-
- static basic_cookie<string_type> from_string(const char* str)
- {
- boost::system::error_code ec;
- basic_cookie<string_type> ck = from_string(ec);
- detail::throw_error(ec);
- return ck;
- }
-
- static basic_cookie<string_type> from_string(std::string& str)
- {
- basic_cookie<string_type> ck;
- std::string val""
- return from_string(str.c_str());
- }
-
- static basic_cookie<string_type>
- from_string(std::string& str, boost::system::error_code& ec)
- {
- return from_string(str.c_str(), ec);
- }
- */
/// Make a string out of the cookie.
string_type to_string() const
@@ -153,23 +112,17 @@
return str;
}
- operator const char_type () const { return value.c_str(); }
+ bool empty() const { return value.empty(); }
+
+ const char_type* c_str() const { return value.c_str(); }
+ operator const char_type* () const { return value.c_str(); }
operator string_type const& () const { return value; }
operator string_type () const { return value; }
template<typename T>
operator std::basic_string<T> () { return value; }
- //template<typename T>
- //operator T () const { return value; }
template<typename T>
friend std::ostream& operator<<(std::ostream& os, basic_cookie<T> const& ck);
- /*
- template<typename T>
- friend response& operator<< (response& resp, self_type const& ck) {
- resp<< "Set-Cookie: " << ck.to_string();
- return resp;
- }
- */
};
inline
@@ -181,15 +134,12 @@
return std::make_pair(n, ck);
}
-
-template<typename CharT>
-inline std::ostream& operator<< (std::ostream& os, BOOST_CGI_NAMESPACE::common::basic_cookie<CharT> const& ck)
-{
- os<< ck.value;
- return os;
-}
-
-
+ template<typename CharT>
+ inline std::ostream& operator<< (std::ostream& os, BOOST_CGI_NAMESPACE::common::basic_cookie<CharT> const& ck)
+ {
+ os<< ck.value;
+ return os;
+ }
} // namespace common
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/form_part.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/form_part.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/form_part.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -12,10 +12,10 @@
struct form_part
{
- typedef std::string string_type;
- //typedef std::vector<char> buffer_type;
- typedef string_type buffer_type;
- typedef buffer_type::iterator iter_t;
+ typedef char char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef string_type buffer_type;
+ typedef buffer_type::iterator iter_t;
typedef boost::iterator_range<
buffer_type::const_iterator
@@ -47,10 +47,24 @@
string_type content_type; // must exist
string_type content_disposition; // must exist
string_type name; // must exist
+ string_type value; // Either the data itself, or the filename for
string_type filename;
// Where the actual uploaded file is stored.
string_type path;
+ public:
+ /// TODO: Check that the uploaded file isn't empty too.
+ bool empty() const { return value.empty(); }
+
+ const char_type* c_str() const { return value.c_str(); }
+ operator const char_type* () const { return value.c_str(); }
+ operator string_type const& () const { return value; }
+ operator string_type () const { return value; }
+ template<typename T>
+ operator std::basic_string<T> () { return value; }
+
+ friend std::ostream& operator<<(std::ostream& os, form_part const& part);
+
// Using a simple map while everything is changing. This will not copy the
// values when it is properly implemented (it'll hold a pair of iterators
// to the data).
@@ -60,6 +74,21 @@
//bool finished_;
};
+ inline
+ std::pair<common::name, common::form_part>
+ make_pair (const char* n, common::form_part& part)
+ {
+ part.value.swap(part.name);
+ part.name = n;
+ return std::make_pair(n, part);
+ }
+
+ inline std::ostream& operator<< (std::ostream& os, BOOST_CGI_NAMESPACE::common::form_part const& part)
+ {
+ os<< part.value;
+ return os;
+ }
+
} // namespace common
BOOST_CGI_NAMESPACE_END
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/name.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/name.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/name.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -14,7 +14,7 @@
#define BOOST_CGI_COMMON_NAME_HPP_INCLUDED__
#include <string>
-#include <ostream>
+//#include <ostream>
#include <cstdlib>
#include <ctype.h>
#include "boost/cgi/config.hpp"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/path_info.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/path_info.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/path_info.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -12,65 +12,70 @@
BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- struct path_info
- {
- typedef std::string value_type;
- typedef value_type string_type;
- typedef string_type::size_type size_type;
- typedef std::vector<value_type> vector_type;
- typedef vector_type::iterator iterator;
- typedef vector_type::const_iterator const_iterator;
-
-private:
- void parse()
- {
- if (value[0] != '/') value.insert(value.begin(), '/');
- boost::algorithm::split(
- parts, value, boost::algorithm::is_any_of("/"));
- }
-
- string_type substr(string_type const& str, char ch, bool include_char = true) const
- {
- try {
- return value.substr(value.find_last_of(ch));
- } catch(...) {
- return "";
- }
- }
-
-public:
-
- template<typename S, typename P, typename A>
- path_info(basic_request<S,P,A> & request)
- : value(request.env["path_info"])
- {
- parse();
- }
-
- path_info(value_type const& str)
- : value(str)
- {
- parse();
- }
-
- value_type& operator[](int i) { return parts[i]; }
-
- value_type& string() { return value; }
-
- operator value_type& () { return value; }
-
- string_type stem() const { return substr(value, '/', false); }
-
- string_type extension() const { return substr(stem(), '.'); }
-
- iterator begin() { return parts.begin(); }
- iterator end() { return parts.end(); }
- const_iterator begin() const { return parts.begin(); }
- const_iterator end() const { return parts.end(); }
-
- value_type value;
- vector_type parts;
- };
+ struct path_info
+ {
+ typedef std::string value_type;
+ typedef value_type string_type;
+ typedef string_type::size_type size_type;
+ typedef std::vector<value_type> vector_type;
+ typedef vector_type::iterator iterator;
+ typedef vector_type::const_iterator const_iterator;
+
+ private:
+ void parse()
+ {
+ if (value[0] != '/') value.insert(value.begin(), '/');
+ boost::algorithm::split(
+ parts, value, boost::algorithm::is_any_of("/"));
+ }
+
+ string_type substr(
+ string_type const& str,
+ char ch,
+ bool include_char = true
+ )
+ const
+ {
+ try {
+ return value.substr(value.find_last_of(ch));
+ } catch(...) {
+ return "";
+ }
+ }
+
+ public:
+
+ template<typename P>
+ path_info(basic_request<P> & request)
+ : value(request.env["path_info"])
+ {
+ parse();
+ }
+
+ path_info(value_type const& str)
+ : value(str)
+ {
+ parse();
+ }
+
+ value_type& operator[](int i) { return parts[i]; }
+
+ value_type& string() { return value; }
+
+ operator value_type& () { return value; }
+
+ string_type stem() const { return substr(value, '/', false); }
+
+ string_type extension() const { return substr(stem(), '.'); }
+
+ iterator begin() { return parts.begin(); }
+ iterator end() { return parts.end(); }
+ const_iterator begin() const { return parts.begin(); }
+ const_iterator end() const { return parts.end(); }
+
+ value_type value;
+ vector_type parts;
+ };
} // namespace common
BOOST_CGI_NAMESPACE_END
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -24,6 +24,7 @@
#include "boost/cgi/common/form_part.hpp"
#include "boost/cgi/common/parse_options.hpp"
#include "boost/cgi/detail/extract_params.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
#include "boost/cgi/detail/save_environment.hpp"
#include "boost/cgi/config.hpp"
@@ -35,10 +36,11 @@
* This class provides generic member functions that can be used by any
* request type.
*/
- template<typename T>
+ template<typename Protocol>
class request_base
{
public:
+ typedef common::request_base<Protocol> base_type;
/// Get the request ID of a FastCGI request, or 1.
template<typename ImplType>
@@ -51,20 +53,30 @@
// implementation_type and should be inherited by it.
struct impl_base
{
- typedef char char_type; // **FIXME**
- typedef std::basic_string<char_type> string_type;
- typedef string_type buffer_type;
- //typedef std::vector<char_type> buffer_type;
- typedef boost::asio::const_buffers_1 const_buffers_type;
- typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+ typedef impl_base base_type;
+ typedef Protocol protocol_type;
+ typedef detail::protocol_traits<Protocol> traits;
+
+ typedef typename traits::char_type char_type;
+ typedef typename traits::string_type string_type;
+ typedef typename traits::buffer_type buffer_type;
+ typedef typename traits::const_buffers_type const_buffers_type;
+ typedef typename traits::mutable_buffers_type mutable_buffers_type;
+
+ typedef typename traits::form_parser_type form_parser_type;
+ typedef typename traits::client_type client_type;
+ typedef typename traits::connection_type connection_type;
+ typedef typename connection_type::pointer conn_ptr;
+ typedef typename traits::request_type request_type;
+ typedef typename traits::protocol_service_type protocol_service_type;
+
/**
* If you want to add a new data type to a request you need to:
* > Update this file (just below)
* > Update source_enums.hpp
* > Update map.hpp with a new map type
- * > Use the `BOOST_CGI_DETAIL_MAP_ACCESS` macro in `basic_request<>`,
- * next to the other uses of it.
+ * > Add a member variable to basic_request<>
*/
typedef boost::fusion::vector<
common::env_map, common::get_map
@@ -74,16 +86,40 @@
/// Construct.
impl_base()
- : vars_(), post_buffer_()
- , get_parsed_(false), env_parsed_(false)
+ : service_(NULL)
+ , vars_(), post_buffer_()
+ , get_parsed_(false), env_parsed_(false), stdin_parsed_(false)
+ , bytes_left_(0)
+ , http_status_(common::http::no_content)
+ , request_status_(common::unloaded)
+ , client_()
+ , fp_(NULL)
{}
+
+ bool stdin_parsed() { return stdin_parsed_; }
+ common::http::status_code& http_status() { return http_status_; }
+ common::request_status& status() { return request_status_; }
+ protocol_service_type* service_;
+
var_map_type vars_;
buffer_type post_buffer_;
/// Whether the get data has been parsed yet.
bool get_parsed_;
/// Whether the environment has been parsed yet.
bool env_parsed_;
+ /// Whether the post data has been parsed yet.
+ bool stdin_parsed_;
+
+ // The number of bytes left to read (ie. content_length - bytes_read)
+ std::size_t bytes_left_;
+
+ common::http::status_code http_status_;
+ common::request_status request_status_;
+
+ client_type client_;
+
+ boost::scoped_ptr<form_parser_type> fp_;
std::vector<common::form_part> form_parts_;
@@ -100,15 +136,19 @@
/// Load the base_environment into the current environment.
/**
* Parsed the base_environment and add it to the current request's
- * environment. This overwrites any environment variables with the existing
- * key.
- *
- * If `is_command_line` is true, then the first argument is skipped as this
- * is the name of the program and ignored. Using it actually causes a crash
- * on Windows (MSVC 9) anyway: I'm not exactly sure why.
+ * environment. This overwrites any environment variables with the
+ * existing key.
+ *
+ * If `is_command_line` is true, then the first argument is skipped as
+ * this is the name of the program and ignored. Using it actually causes
+ * a crash on Windows (MSVC 9) anyway: I'm not exactly sure why.
*/
template<typename ImplType>
- void load_environment(ImplType& impl, char** base_environment, bool is_command_line)
+ void load_environment(
+ ImplType& impl,
+ char** base_environment,
+ bool is_command_line
+ )
{
if (is_command_line) ++base_environment;
detail::save_environment(env_vars(impl.vars_), base_environment);
@@ -136,16 +176,26 @@
bool is_file(ImplType& impl
, typename ImplType::string_type const& key)
{
- typedef std::vector<common::form_part>::const_iterator
+ boost::optional<common::form_part&>
+ part = get_form_part(impl, key);
+ return part && !part->filename.empty();
+ }
+
+ /// Get the form_part for the passed key, which may not exist.
+ template<typename ImplType>
+ boost::optional<common::form_part&>
+ get_form_part(ImplType& impl, typename ImplType::string_type const& key)
+ {
+ typedef std::vector<common::form_part>::iterator
iter_t;
for(iter_t iter (impl.form_parts_.begin())
, end (impl.form_parts_.end()); iter != end; ++iter)
{
- if (iter->name == key.c_str() && !iter->filename.empty())
- return true;
+ if (iter->name == key.c_str())
+ return boost::optional<common::form_part&>(*iter);
}
- return false;
+ return boost::optional<common::form_part&>();
}
/// Synchronously read/parse the request meta-data
@@ -163,9 +213,9 @@
std::string const& cl = env_vars(impl.vars_)["CONTENT_LENGTH"];
// This will throw if the content-length isn't a valid number
// (which shouldn't ever happen).
- impl.characters_left_
+ impl.bytes_left_
= cl.empty() ? 0 : boost::lexical_cast<std::size_t>(cl);
- impl.client_.bytes_left() = impl.characters_left_;
+ impl.client_.bytes_left() = impl.bytes_left_;
std::string const& request_method
= env_vars(impl.vars_)["REQUEST_METHOD"];
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/response.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/response.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/response.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -29,14 +29,14 @@
namespace common {
/// The response class: a helper for responding to requests.
- template<typename T>
+ template<typename CharT>
class basic_response
{
public:
- typedef basic_response<T> self_type;
- typedef T char_type;
- typedef typename std::basic_string<T> string_type;
- typedef typename std::basic_ostream<T> ostream_type;
+ typedef basic_response<CharT> self_type;
+ typedef CharT char_type;
+ typedef typename std::basic_string<CharT> string_type;
+ typedef typename std::basic_ostream<CharT> ostream_type;
basic_response(common::http::status_code sc = common::http::ok);
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/tags.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/tags.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/tags.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -18,11 +18,6 @@
BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- /// SCGI (note, this must be removed)
- struct scgi_{};
- /// FastCGI
- struct fcgi_{};
-
namespace tags {
// the null tag type
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/connections/shareable_tcp_socket.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/connections/shareable_tcp_socket.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/connections/shareable_tcp_socket.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -50,15 +50,14 @@
typedef boost::mutex mutex_type;
struct condition_type : public boost::condition_variable
{ typedef boost::shared_ptr<boost::condition_variable> pointer; };
- typedef boost::mutex::scoped_lock scoped_lock_type;
+ typedef boost::mutex::scoped_lock scoped_lock_type;
typedef boost::asio::ip::tcp::socket next_layer_type;
/** FastCGI specific stuff **/
- //typedef ::BOOST_CGI_NAMESPACE::fcgi::client client_type;
- typedef //typename
- detail::protocol_traits<fcgi_>::request_type request_type;
+ typedef
+ detail::protocol_traits<tags::fcgi>::request_type request_type;
typedef
- detail::protocol_traits<fcgi_>::request_ptr request_ptr;
+ detail::protocol_traits<tags::fcgi>::request_ptr request_ptr;
typedef std::map<boost::uint16_t, request_type*> request_map_type;
typedef std::vector<request_type*> request_vector_type;
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/common_headers.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/common_headers.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/common_headers.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -12,8 +12,6 @@
// #include all protocol-independent headers only. Protocol-specific
// headers can just include this after other headers.
-#include <iostream> // **FIXME** - only for debugging info
-
//#include "boost/cgi/logger.hpp"
#include "boost/cgi/config.hpp"
#include "boost/cgi/basic_request.hpp"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/protocol_traits.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/protocol_traits.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/protocol_traits.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -22,23 +22,23 @@
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
#include "boost/cgi/common/tags.hpp"
#include "boost/cgi/common/role_type.hpp"
+#include "boost/cgi/common/parse_options.hpp"
#include "boost/cgi/fcgi/specification.hpp"
#include "boost/cgi/fwd/basic_request_fwd.hpp"
#include "boost/cgi/fwd/basic_connection_fwd.hpp"
+#include "boost/cgi/fwd/basic_client_fwd.hpp"
BOOST_CGI_NAMESPACE_BEGIN
namespace cgi {}
namespace fcgi
{
- class fcgi_request_impl;
class fcgi_service_impl;
class fcgi_request_service;
class fcgi_acceptor_service;
}
namespace scgi
{
- class scgi_request_impl;
class scgi_service_impl;
class scgi_request_service;
class scgi_acceptor_service;
@@ -46,9 +46,6 @@
// Forward declarations
- class cgi_request_impl;
- class fcgi_request_impl;
-
class cgi_service_impl;
class fcgi_service_impl;
@@ -60,6 +57,8 @@
namespace detail {
namespace tags = ::BOOST_CGI_NAMESPACE::common::tags;
+
+ class form_parser;
template<typename Protocol>
struct protocol_traits
@@ -70,33 +69,46 @@
struct protocol_traits<tags::cgi>
{
typedef protocol_traits<tags::cgi> type;
- typedef cgi_request_impl impl_type;
typedef cgi_request_service request_service_impl;
+ typedef cgi_request_service service_type;
typedef common::basic_protocol_service<
tags::cgi
> protocol_service_type;
typedef common::basic_request<
- request_service_impl
- , protocol_service_type
+ tags::cgi
> request_type;
typedef cgi_service_impl service_impl_type;
- typedef common::basic_connection<tags::async_stdio> connection_type;
+ typedef common::basic_connection<
+ tags::async_stdio
+ > connection_type;
+ typedef common::basic_client<
+ connection_type,
+ tags::cgi
+ > client_type;
+ typedef detail::form_parser form_parser_type;
typedef boost::none_t header_type;
+ typedef char char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef string_type buffer_type;
+ typedef boost::asio::const_buffers_1 const_buffers_type;
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
typedef common::role_type role_type;
+ typedef boost::shared_ptr<request_type> pointer;
+
+ static const common::parse_options parse_opts = common::parse_all;
};
template<>
struct protocol_traits<tags::fcgi>
{
typedef protocol_traits<tags::fcgi> type;
- typedef fcgi::fcgi_request_impl impl_type;
typedef fcgi::fcgi_request_service request_service_impl;
+ typedef fcgi::fcgi_request_service service_type;
typedef common::basic_protocol_service<
- common::fcgi_
+ tags::fcgi
> protocol_service_type;
typedef common::basic_request<
- request_service_impl
- , protocol_service_type
+ tags::fcgi
> request_type;
typedef boost::shared_ptr<request_type> request_ptr;
typedef fcgi::fcgi_service_impl service_impl_type;
@@ -104,37 +116,50 @@
typedef common::basic_connection<
tags::shareable_tcp_socket
> connection_type;
+ typedef common::basic_client<
+ connection_type,
+ tags::fcgi
+ > client_type;
+ typedef detail::form_parser form_parser_type;
typedef fcgi::spec::header header_type;
typedef fcgi::spec_detail::role_types role_type;
+
+ typedef char char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef string_type buffer_type;
+ typedef boost::asio::const_buffers_1 const_buffers_type;
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+ typedef boost::shared_ptr<request_type> pointer;
+
+ static const common::parse_options parse_opts = common::parse_none;
};
template<>
struct protocol_traits<tags::scgi>
{
typedef protocol_traits<tags::scgi> type;
- typedef scgi::scgi_request_impl impl_type;
typedef scgi::scgi_request_service request_service_impl;
+ typedef scgi::scgi_request_service service_type;
typedef common::basic_protocol_service<tags::scgi> protocol_service_type;
typedef common::basic_request<
- request_service_impl, protocol_service_type
+ tags::scgi
> request_type;
typedef scgi::scgi_service_impl service_impl_type;
typedef scgi::scgi_acceptor_service acceptor_service_impl;
typedef common::basic_connection<tags::tcp_socket> connection_type;
- };
+ typedef common::basic_client<
+ connection_type,
+ tags::scgi
+ > client_type;
+ typedef detail::form_parser form_parser_type;
+ typedef char char_type;
+ typedef std::basic_string<char_type> string_type;
+ typedef string_type buffer_type;
+ typedef boost::asio::const_buffers_1 const_buffers_type;
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+ typedef boost::shared_ptr<request_type> pointer;
- // **FIXME** (remove)
- template<>
- struct protocol_traits< ::BOOST_CGI_NAMESPACE::common::scgi_>
- : protocol_traits<tags::scgi>
- {
- };
-
- // **FIXME** (remove)
- template<>
- struct protocol_traits< ::BOOST_CGI_NAMESPACE::common::fcgi_>
- : protocol_traits<tags::fcgi>
- {
+ static const common::parse_options parse_opts = common::parse_none;
};
} // namespace detail
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -11,13 +11,11 @@
// #include all fcgi-related files only
#include "boost/cgi/config.hpp"
-#include "boost/cgi/fcgi/service.hpp"
+#include "boost/cgi/detail/common_headers.hpp"
#include "boost/cgi/fcgi/acceptor.hpp"
#include "boost/cgi/fcgi/client.hpp"
#include "boost/cgi/fcgi/request.hpp"
-//#include "boost/cgi/fcgi/request_service.hpp"
-//#include "boost/cgi/fcgi/request_acceptor_service.hpp"
-#include "boost/cgi/detail/common_headers.hpp"
+#include "boost/cgi/fcgi/service.hpp"
BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -13,7 +13,7 @@
#include <boost/ref.hpp>
#include <boost/bind.hpp>
-#include <boost/asio.hpp> // **FIXME**
+#include <boost/asio.hpp>
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/static_assert.hpp>
@@ -75,7 +75,7 @@
* If the protocol isn't async then the class can be used without a
* ProtocolService.
*/
- template<typename Protocol_ = ::BOOST_CGI_NAMESPACE::common::fcgi_>
+ template<typename Protocol_ = common::tags::fcgi>
class acceptor_service_impl
: public detail::service_base<
::BOOST_CGI_NAMESPACE::fcgi::acceptor_service_impl<Protocol_>
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -171,6 +171,7 @@
total_sent_bytes_ += bytes_transferred;
total_sent_packets_ += 1;
+#ifndef NDEBUG
if (ec)
std::cerr<< "Error " << ec << ": " << ec.message() << '\n';
else
@@ -179,6 +180,7 @@
<< " / " << total_buffer_size << " bytes (running total: "
<< total_sent_bytes_ << " bytes; "
<< total_sent_packets_ << " packets).\n";
+#endif // NDEBUG
// Now remove the protocol overhead for the caller, who
// doesn't care about them.
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -20,7 +20,7 @@
// typedef for typical usage (FCGI)
typedef
common::basic_request<
- fcgi_request_service, service
+ common::tags::fcgi
>
request;
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_acceptor_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_acceptor_service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/request_acceptor_service.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -15,6 +15,7 @@
#include "boost/cgi/import/io_service.hpp"
#include "boost/cgi/detail/throw_error.hpp"
#include "boost/cgi/detail/service_base.hpp"
+#include "boost/cgi/common/tags.hpp"
#include "boost/cgi/detail/protocol_traits.hpp"
#include "boost/cgi/fcgi/acceptor_service_impl.hpp"
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
@@ -23,13 +24,13 @@
/// The service class for FCGI basic_request_acceptor<>s
/**
- * Note: If the protocol is an asynchronous protocol, which means it requires
- * access to a boost::asio::io_service instance, then this class becomes a
- * model of the Service concept (**LINK**) and must only use the constructor
- * which takes a ProtocolService (**LINK**). If the protocol isn't async then
- * the class can be used without a ProtocolService.
+ * Note: If the protocol is an asynchronous protocol, which means it
+ * requires access to a boost::asio::io_service instance, then this class
+ * becomes a model of the Service concept (**LINK**) and must only use the
+ * constructor which takes a ProtocolService (**LINK**). If the protocol
+ * isn't async then the class can be used without a ProtocolService.
*/
- template<typename Protocol_ = common::fcgi_>
+ template<typename Protocol_ = common::tags::fcgi>
class fcgi_request_acceptor_service
: public detail::service_base<fcgi_request_acceptor_service<Protocol_> >
{
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -32,57 +32,33 @@
/// The IoObjectService class for a FCGI basic_request<>s
class fcgi_request_service
- : public detail::service_base<fcgi_request_service>
- , public common::request_base<fcgi_request_service>
+ : public common::request_base<common::tags::fcgi>
+ , public detail::service_base<fcgi_request_service>
{
public:
/// The actual implementation date for an FCGI request.
struct implementation_type
- : common::request_base<fcgi_request_service>::impl_base
+ : base_type::impl_base
{
- typedef ::BOOST_CGI_NAMESPACE::common::fcgi_ protocol_type;
- typedef ::BOOST_CGI_NAMESPACE::fcgi::client client_type;
- typedef client_type::connection_type connection_type;
typedef client_type::header_buffer_type header_buffer_type;
typedef spec_detail::Header header_type;
- typedef detail::protocol_traits<
- protocol_type
- >::protocol_service_type protocol_service_type;
- typedef detail::protocol_traits<
- protocol_type
- >::request_type request_type;
-
implementation_type()
: id_(0)
- , client_()
- , stdin_parsed_(false)
- , http_status_(::BOOST_CGI_NAMESPACE::common::http::no_content)
- , request_status_(common::unloaded)
, request_role_(spec_detail::ANY)
, all_done_(false)
{
}
- protocol_service_type* service_;
-
boost::uint16_t id_;
- client_type client_;
-
- bool stdin_parsed_;
- ::BOOST_CGI_NAMESPACE::common::http::status_code http_status_;
- common::request_status request_status_;
fcgi::spec_detail::role_types request_role_;
- std::size_t characters_left_;
bool all_done_;
header_buffer_type header_buf_;
header_type header_;
- typedef detail::form_parser form_parser_type;
-
- boost::scoped_ptr<form_parser_type> fp_;
+
// Buffer to hold param records and filter data, etc.
buffer_type param_buffer_;
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/service.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/service.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -17,8 +17,8 @@
// typedef for standard fcgi::service (a model of ProtocolService)
typedef
- ::BOOST_CGI_NAMESPACE::common::basic_protocol_service<
- ::BOOST_CGI_NAMESPACE::common::fcgi_
+ common::basic_protocol_service<
+ common::tags::fcgi
>
service;
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fwd/basic_request_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fwd/basic_request_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fwd/basic_request_fwd.hpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -15,9 +15,7 @@
BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- template<typename RequestService
- , typename ProtocolService
- , typename Allocator = std::allocator<char> >
+ template<typename Protocol>
class basic_request;
} // namespace common
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -671,9 +671,7 @@
return ec;
}
-
} // namespace fcgi
-
BOOST_CGI_NAMESPACE_END
#endif // CGI_FCGI_REQUEST_SERVICE_IPP_INCLUDED__
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -162,14 +162,14 @@
buffer.substr(meta.length()+4, next_pos-meta.length()-4));
// Load the data to the request's post map.
- context_->data_map[part.name.c_str()] = content;
+ part.value = content;
}
else
{
string_type filename (meta.substr(pos6+9, pos5-pos6-9));
algo::trim_if(filename, algo::is_any_of("\" "));
// Load the filename as the value on the request's post map.
- context_->data_map[part.name.c_str()] = filename;
+ part.value = filename;
// Empty parameters could probably be left out, but setting even
// an empty variable is consistent with the rest of the library.
// **FIXME** Might be useful to respect BOOST_CGI_KEEP_EMPTY_VARS
@@ -194,6 +194,8 @@
file.flush();
}
}
+ // Load the data to the request's post map.
+ context_->data_map[part.name.c_str()] = part.value;
context_->form_parts.push_back(part);
buffer.erase(0, next_pos+marker.length()+2);
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/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -137,7 +137,7 @@
Name="VCLinkerTool"
AdditionalOptions="libctemplate.lib"
LinkIncremental="1"
- GenerateDebugInformation="true"
+ GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -139,7 +139,7 @@
Name="VCLinkerTool"
AdditionalOptions="libboost_system-vc90-mt-1_38.lib"
LinkIncremental="1"
- GenerateDebugInformation="true"
+ GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -137,7 +137,7 @@
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
- GenerateDebugInformation="true"
+ GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -138,7 +138,7 @@
Name="VCLinkerTool"
AdditionalOptions="libboost_system-vc90-mt-1_38.lib"
LinkIncremental="1"
- GenerateDebugInformation="true"
+ GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -140,7 +140,7 @@
Name="VCLinkerTool"
AdditionalOptions="libboost_system-vc90-mt-1_38.lib
libctemplate.lib"
LinkIncremental="1"
- GenerateDebugInformation="true"
+ GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -87,6 +87,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="copy "$(TargetPath)" "c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)""
/>
</Configuration>
<Configuration
@@ -114,7 +115,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="2"
+ Optimization="3"
EnableIntrinsicFunctions="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS"
RuntimeLibrary="2"
@@ -135,7 +136,7 @@
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
- GenerateDebugInformation="true"
+ GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
@@ -161,6 +162,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="copy "$(TargetPath)" "c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)""
/>
</Configuration>
</Configurations>
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -87,6 +87,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="copy "$(TargetPath)" "c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)""
/>
</Configuration>
<Configuration
@@ -163,6 +164,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="copy "$(TargetPath)" "c:\code\c++\boost.cgi\fcgi-bin\$(TargetName)""
/>
</Configuration>
</Configurations>
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -114,8 +114,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
+ Optimization="3"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
@@ -136,7 +135,7 @@
Name="VCLinkerTool"
AdditionalOptions="libboost_system-vc90-mt-1_38.lib"
LinkIncremental="1"
- GenerateDebugInformation="true"
+ GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/Jamfile.v2 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -5,6 +5,24 @@
project boost.cgi.docs
;
+
+#exe doc_quickstart_cgi
+# :
+# src/quickstart/quickstart_cgi.cpp /boost/cgi/
+# :
+# <threading>multi
+# <library>/boost//thread
+# ;
+
+# Our install rule (builds binaries and copies them to <location>)
+#install install_quickstart_cgi
+# : doc_quickstart_cgi
+# : <location>$(cgi-bin)
+# ;
+
+# Only install example if you use `bjam install' or equivalent
+#explicit install_quickstart_cgi ;
+
import boostbook : boostbook ;
import doxygen ;
@@ -28,9 +46,6 @@
$(top)/boost/cgi/fcgi/service.hpp
$(top)/boost/cgi/fcgi/acceptor.hpp
$(top)/boost/cgi/fcgi/request.hpp
- $(top)/boost/cgi/acgi/service.hpp
- $(top)/boost/cgi/acgi/acceptor.hpp
- $(top)/boost/cgi/acgi/request.hpp
$(top)/boost/cgi/cgi/service.hpp
$(top)/boost/cgi/cgi/request.hpp
$(top)/boost/cgi/http/status_code.hpp
@@ -119,6 +134,7 @@
# How far down we go with TOC's
<xsl:param>generate.section.toc.level=10
#<xsl:param>root.filename="svg_plot"
+ <xsl:param>boost.image.src="../../../../boost/boostified/release/doc/html/images"
# <xsl:param>project.root=http://beta.boost.org/development
# <xsl:param>annotation.support=1
@@ -156,8 +172,10 @@
install html
:
/boost//doc/html/boostbook.css
-# /bin/doc/$(toolset)/debug/cgi_xml.xml
+ /bin/doc/$(toolset)/debug/cgi_xml.xml
;
install pdf-install : standalone : <location>. <install-type>PDF ;
+explicit install ;
+explicit pdf-install ;
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -104,14 +104,14 @@
[/include:reference reference.qbk]
-[include:future future_development.qbk]
+[/include:future future_development.qbk]
-[include:server_support user_guide/server_support.qbk]
+[/include:server_support user_guide/server_support.qbk]
-[include troubleshooting.qbk]
+[/include troubleshooting.qbk]
[include acknowledgements.qbk]
-[xinclude index.xml]
+[/xinclude index.xml]
-[include reference.qbk]
+[/include reference.qbk]
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/headers.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/headers.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/headers.qbk 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -1,5 +1,5 @@
[/
- / Copyright (c) 2007 Darren Garvey
+ / Copyright (c) 2007,2009 Darren Garvey
/
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -13,13 +13,9 @@
``
#include <boost/cgi.hpp> // include header files for any protocol
-#include <boost/cgi/cgi.hpp> // include all headers required for (sync) CGI usage
-
-#include <boost/cgi/acgi.hpp> // include all headers required for aCGI usage
+#include <boost/cgi/cgi.hpp> // include all headers required for CGI usage
#include <boost/cgi/fcgi.hpp> // include all headers required for FastCGI usage
-
-#include <boost/cgi/scgi.hpp> // include all headers required for SCGI usage
``
[endsect] [/ headers]
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/request_objects.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/request_objects.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/request_objects.qbk 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -1,5 +1,5 @@
[/
- / Copyright (c) 2007 Darren Garvey
+ / Copyright (c) 2007-2009 Darren Garvey
/
/ Distributed under the Boost Software License, Version 1.0. (See accompanying
/ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -13,10 +13,9 @@
[table Request typedefs
[[Protocol] [`typedef` ]]
- [[CGI ] [`cgi_request` ]]
- [[aCGI ] [`acgi_request`]]
- [[FastCGI ] [`fcgi_request`]]
- [[SCGI ] [`scgi_request`]]
+ [[CGI ] [`boost::cgi::request` ]]
+ [[FastCGI ] [`boost::fcgi::request`]]
+ [[SCGI ] [`boost::scgi::request`]]
]
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -23,7 +23,7 @@
Let's assume you now want to check if the user has a cookie, "user_name", set. We get at it like this:
*/
- std::string user_name( req[cookies]["user_name"] );
+ std::string user_name( req.cookies["user_name"] );
/*`
If it's set, we'll be polite and say hello. If you are used to CGI programming, you'll notice the lack of any HTTP headers. If you don't want to bother with headers, a default header `'Content-type: text/plain'` is sent, followed by the usual HTTP end-of-line `'\r\n'` and a blank line which indicates the end of the headers and the start of content.
@@ -31,7 +31,7 @@
if (!user_name.empty())
{
- resp<< "Hello there, " << user_name << ". How are you?";
+ resp<< "Hello there, " << req.cookies["user_name"] << ". How are you?";
/*`
That's all we want to say for now, so just send this back and quit.
@@ -45,7 +45,7 @@
/*`
If the cookie isn't set, we will check if the user has posted a __GET__/__POST__ form with their name.
*/
- user_name = req[form]["user_name"];
+ user_name = req.form["user_name"];
if (!user_name.empty())
{
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/Jamfile.v2 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -13,14 +13,12 @@
# Build all of the cgi examples
build-project cgi ;
-# Build all of the acgi examples
-build-project acgi ;
# Build all of the fcgi examples
build-project fcgi ;
# Build all of the xcgi examples
build-project xcgi ;
-alias all_examples : cgi acgi fcgi xcgi ;
+alias all_examples : cgi fcgi xcgi ;
install cgi-install
: # sources
@@ -29,13 +27,6 @@
<location>$(cgi-bin)
;
-install acgi-install
- : # sources
- acgi//install
- :
- <location>$(cgi-bin)
- ;
-
install fcgi-install
:
fcgi//install
@@ -48,10 +39,9 @@
xcgi//install
;
-alias install : cgi//install acgi//install fcgi//install xcgi//install ;
+alias install : cgi//install fcgi//install xcgi//install ;
explicit cgi-install ;
-explicit acgi-install ;
explicit fcgi-install ;
explicit install ;
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -18,7 +18,7 @@
int cgi_handler(request& req, response& resp)
{
- resp<< header("X-Custom-Header: some value")
+ resp<< header("X-Custom-Header", "some value")
<< content_type("text/html")
<< "<html>"
"<head>"
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -35,7 +35,7 @@
{
dictionary_type* nvpair_dict = sub_dict->AddSectionDictionary("REQUEST_DATA_PAIR");
nvpair_dict->SetValue("REQUEST_DATA_NAME", iter->first.c_str());
- nvpair_dict->SetValue("REQUEST_DATA_VALUE", iter->second);
+ nvpair_dict->SetValue("REQUEST_DATA_VALUE", iter->second.c_str());
}
}
}
@@ -125,7 +125,7 @@
, response, request);
}else
if (!ret) {
- return boost::cgi::commit(request, response);
+ return 0 == boost::cgi::commit(request, response);
} else {
bomb_out("Callback returned code #" + boost::lexical_cast<std::string>(ret) + "; unknown error", response, request);
}
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/ctemplate.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/ctemplate.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/ctemplate.cpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -30,7 +30,7 @@
// We can expand it into a string.
std::string output;
tmpl->Expand(&output, NULL);
- resp<< header("X-Custom-Header: some value")
+ resp<< header("X-Custom-Header", "some value")
<< content_type("text/html")
<< output;
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookie_game2/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookie_game2/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookie_game2/main.cpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -90,7 +90,7 @@
{
Dict* row_dict = subd->AddSectionDictionary("ROW");
row_dict->SetValue("NAME", iter->first.c_str());
- row_dict->SetValue("VALUE", iter->second);
+ row_dict->SetValue("VALUE", iter->second.c_str());
row_dict->ShowSection("ROW");
}
}
@@ -131,7 +131,7 @@
// First, see if they have a cookie set
if (req.cookies.count("name"))
- dict.SetValueAndShowSection("USER_NAME", req.cookies["name"],
+ dict.SetValueAndShowSection("USER_NAME", req.cookies["name"].c_str(),
"HAS_NAME_IN_COOKIE_true");
else
dict.ShowSection("HAS_NAME_IN_COOKIE_false");
@@ -139,10 +139,9 @@
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", req.form.get("name", ""));
+ // pick() looks up the key in the map, returns a default value
+ // (ie. anonymous) if the key isn't found.
+ dict.SetValue("COOKIE_NAME", req.form.pick("name", "anonymous"));
dict.SetValue("COOKIE_VALUE", req.form["value"]);
// Load the HTML stencil now from the index.html file.
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/doc.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/doc.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/doc.qbk 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -5,5 +5,13 @@
[include echo/doc.qbk]
+[include command_line/doc.qbk]
+
+[include cookie_game/doc.qbk]
+
+[include file_browser/doc.qbk]
+
+[include stencil/doc.qbk]
+
[endsect][/ cgi_examples]
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -1,4 +1,4 @@
-// -- main.hpp --
+// -- main.hpp --
//
// Copyright (c) Darren Garvey 2007-2009.
// Distributed under the Boost Software License, Version 1.0.
@@ -70,6 +70,7 @@
<< "</div>"
"</div>";
}
+ }
os<< "</div>";
}
@@ -108,6 +109,16 @@
format_map(resp, req, req.form, "Form [" + req.method() + "] Variables");
format_map(resp, req, req.cookies, "Cookie Variables");
+ boost::optional<cgi::common::form_part&> part = req.get_form_part("user_file");
+ if (part)
+ resp<< "File path: " << (*part).path;
+ else
+ resp<< "File not found.";
+
+ if (req.is_file("user_file"))
+ resp<< " (uploaded as a file)";
+
+
// Note that this (and any other) HTTP header can go either before or after
// the response contents.
resp<< cgi::content_type("text/html");
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/hello_world/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/hello_world/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/hello_world/main.cpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -23,7 +23,7 @@
try {
// Construct a request. Parses all GET, POST and environment data,
// as well as cookies.
- cgi::request req(cgi::parse_all);
+ cgi::request req;
// Using a response is the simplest way to write data back to the client.
cgi::response resp;
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/doc.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/doc.qbk (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/doc.qbk 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -23,8 +23,6 @@
[include cgi/doc.qbk]
-[include acgi/doc.qbk]
-
[include fcgi/doc.qbk]
[include xcgi/doc.qbk]
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -1,6 +1,6 @@
// -- main.hpp --
//
-// Copyright (c) Darren Garvey 2007.
+// Copyright (c) Darren Garvey 2007-2009.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/file_browser/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/file_browser/main.cpp (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/file_browser/main.cpp 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -200,11 +200,11 @@
ifs.seekg(0, std::ios::beg);
while (!ifs.eof() && size > 0 && !ec)
{
- ifs.read(buf, size < bufsize ? size : bufsize);
+ ifs.read(buf, (std::streamsize)(size < bufsize ? size : bufsize));
read_bytes = ifs.gcount();
size -= read_bytes;
- output.push_back(boost::asio::buffer(buf, read_bytes));
+ output.push_back(boost::asio::buffer(buf, (std::size_t)read_bytes));
// Write unbuffered (ie. not using a response).
write(client, output
, boost::asio::transfer_all(), ec);
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-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -12,18 +12,11 @@
// The simplest FastCGI program, outputs only "Hello there, universe."
//
-#include <boost/cgi/config.hpp>
-#include <cmath>
-#include <iostream>
-#include <boost/asio.hpp>
-#include <boost/system/system_error.hpp>
#include <boost/cgi/fcgi.hpp>
using namespace std;
using namespace boost::fcgi;
-#include <iostream>
-
template<typename Request, typename Response>
int handle_request(Request& req, Response& resp)
{
Modified: sandbox/SOC/2007/cgi/branches/pickmeup/project-root.jam
==============================================================================
--- sandbox/SOC/2007/cgi/branches/pickmeup/project-root.jam (original)
+++ sandbox/SOC/2007/cgi/branches/pickmeup/project-root.jam 2009-12-19 21:00:28 EST (Sat, 19 Dec 2009)
@@ -53,7 +53,7 @@
path-constant include-dir : /usr/local/include ;
# A relative path to boost (for documentation stuff)
-path-constant boost-root-relative : $(top)/../../../../boost/trunk/ ;
+path-constant boost-root-relative : $(top)/../../boost/trunk/ ;
#############################################################################
@@ -135,5 +135,5 @@
use-project /boost/ : $(boost-root) ;
use-project /boost/cgi/ : $(top)/libs/cgi/build ;
-project anon : build-dir bin.v2 ;
+# project anon : build-dir bin.v2 ;
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