|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r59388 - in sandbox/SOC/2007/cgi/trunk: . boost boost/cgi boost/cgi/acgi boost/cgi/cgi boost/cgi/common boost/cgi/connections boost/cgi/detail boost/cgi/fcgi boost/cgi/fwd boost/cgi/http boost/cgi/impl boost/cgi/import boost/cgi/scgi boost/cgi/utility libs/cgi/build libs/cgi/build/msvc libs/cgi/build/msvc/9.0 libs/cgi/build/msvc/9.0/Boost.CGI libs/cgi/build/msvc/9.0/Boost.CGI/0.fcgi_template libs/cgi/build/msvc/9.0/Boost.CGI/Amortization libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookie_game libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser 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_echo_threaded libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world libs/cgi/build/msvc/9.0/Boost.CGI/xcgi_server1 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/acgi libs/cgi/example/cgi libs/cgi/example/cgi/DebugServer libs/cgi/example/cgi/DebugServer2 libs/cgi/example/cgi/cookies libs/cgi/example/cgi/echo libs/cgi/example/cgi/file_browser libs/cgi/example/cgi/hello_world libs/cgi/example/cgi/stencil libs/cgi/example/cgi/upload libs/cgi/example/fcgi libs/cgi/example/fcgi/amortization libs/cgi/example/fcgi/async_echo libs/cgi/example/fcgi/echo libs/cgi/example/fcgi/file_browser libs/cgi/example/fcgi/hello_world libs/cgi/example/fcgi/server1 libs/cgi/example/fcgi/server2 libs/cgi/example/fcgi/server3 libs/cgi/example/fcgi/stencil libs/cgi/example/fcgi/upload libs/cgi/example/scgi libs/cgi/example/xcgi/server1 libs/cgi/src libs/cgi/test/compile libs/cgi/test/run
From: lists.drrngrvy_at_[hidden]
Date: 2010-01-31 17:43:28
Author: drrngrvy
Date: 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
New Revision: 59388
URL: http://svn.boost.org/trac/boost/changeset/59388
Log:
Moving development back to trunk.
Added:
sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/acceptor.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/acceptor.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_service.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/request_service.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/service.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/cgi/service.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/commit.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/commit.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/data_map_proxy.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/data_map_proxy.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/error.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/error.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/has_hidden_io_service.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/common/has_hidden_io_service.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/config.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/config.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/basic_io_object.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/detail/basic_io_object.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/error.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/error.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/response.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fcgi/response.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_client_fwd.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fwd/basic_client_fwd.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/form_parser_fwd.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/fwd/form_parser_fwd.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/utility.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility/get.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/get_value.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility/get_value.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/has_key.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility/has_key.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/stencil.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/boost/cgi/utility/stencil.hpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/0.fcgi_template/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/0.fcgi_template/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/0.fcgi_template/fcgi_file_browser.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/0.fcgi_template/fcgi_file_browser.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Amortization/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Amortization/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Amortization/Amortization.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Amortization/Amortization.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Amortization/Amortization.vcproj.360-SYSTEMS.darreng.user
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Amortization/Amortization.vcproj.360-SYSTEMS.darreng.user
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.sln
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.suo
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/Boost.CGI.suo
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookie_game/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookie_game/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookie_game/cgi_cookie_game.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_cookie_game/cgi_cookie_game.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/cgi_ctemplate_cookie_game.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_cookie_game/cgi_ctemplate_cookie_game.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj
- copied unchanged from r59384, /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/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj.360-SYSTEMS.darreng.user
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_ctemplate_debug_server/cgi_ctemplate_debug_server.vcproj.360-SYSTEMS.darreng.user
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj
- copied unchanged from r59384, /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/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj.360-SYSTEMS.darreng.user
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_debug_server/cgi_debug_server.vcproj.360-SYSTEMS.darreng.user
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj.360-SYSTEMS.darreng.user
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_echo/cgi_echo.vcproj.360-SYSTEMS.darreng.user
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser/cgi_file_browser.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_file_browser/cgi_file_browser.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj
- copied unchanged from r59384, /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/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj.360-SYSTEMS.darreng.user
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/cgi_hello_world/cgi_hello_world.vcproj.360-SYSTEMS.darreng.user
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/fcgi_amortization.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/templates/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_amortization/templates/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_echo_threaded/fcgi_echo_threaded.vcproj
- copied unchanged from r59384, /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/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_file_browser/fcgi_file_browser.vcproj
- copied unchanged from r59384, /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/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj
- copied unchanged from r59384, /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/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj.360-SYSTEMS.darreng.user
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/fcgi_hello_world/fcgi_hello_world.vcproj.360-SYSTEMS.darreng.user
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/xcgi_server1/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/xcgi_server1/
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/xcgi_server1/xcgi_server1.vcproj
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/xcgi_server1/xcgi_server1.vcproj
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/msvc/9.0/Boost.CGI/xcgi_server1/xcgi_server1.vcproj.360-SYSTEMS.darreng.user
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/build/msvc/9.0/Boost.CGI/xcgi_server1/xcgi_server1.vcproj.360-SYSTEMS.darreng.user
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/design.qbk
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/doc/src/design.qbk
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer/Jamfile.v2
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/Jamfile.v2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer/Timer.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/Timer.hpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer/TracingServer.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer/TracingServer.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/TracingServer.hpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer/hello.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer/hello.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/Jamfile.v2
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/Jamfile.v2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/TracebackServer.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/TracebackServer.hpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/TracebackServer.hpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/ctemplate.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/ctemplate.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/debug_view.css
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/debug_view.css
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/debug_view.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/debug_view.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/debug_view.js
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/debug_view.js
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/DebugServer2/default_view.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/DebugServer2/default_view.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookies/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/Jamfile.v2
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookies/Jamfile.v2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/index.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookies/index.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookies/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/main.js
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookies/main.js
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/cookies/style.css
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/cookies/style.css
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/file_browser/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/file_browser/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/file_browser/Jamfile.v2
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/file_browser/Jamfile.v2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/file_browser/doc.qbk
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/file_browser/doc.qbk
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/file_browser/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/file_browser/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/stencil/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/Jamfile.v2
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/stencil/Jamfile.v2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/doc.qbk
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/stencil/doc.qbk
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/stencil/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/stencil.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/stencil/stencil.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/stencil/stencil.include.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/stencil/stencil.include.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/upload/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/upload/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/upload/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/upload/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/upload/upload.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/cgi/upload/upload.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/amortization.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/amortization/amortization.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/async_echo/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/async_echo/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/async_echo/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/async_echo/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/file_browser/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/file_browser/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/file_browser/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/file_browser/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/stencil/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/Jamfile.v2
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/stencil/Jamfile.v2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/doc.qbk
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/stencil/doc.qbk
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/stencil/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/stencil.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/stencil/stencil.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/stencil/stencil.include.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/stencil/stencil.include.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/upload/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/upload/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/upload/main.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/upload/main.cpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/upload/upload.html
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/fcgi/upload/upload.html
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/scgi/
- copied from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/example/scgi/
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/has_key.cpp
- copied unchanged from r59384, /sandbox/SOC/2007/cgi/branches/pickmeup/libs/cgi/test/run/has_key.cpp
Removed:
sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi/
sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_impl.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_request_impl_base.hpp
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_service_impl_base.hpp
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/acgi/
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/amortization.tpl
Properties modified:
sandbox/SOC/2007/cgi/trunk/ (props changed)
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/amortization.css (props changed)
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/amortization.js (props changed)
Text files modified:
sandbox/SOC/2007/cgi/trunk/boost/cgi.hpp | 7
sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp | 151
sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_connection.hpp | 69
sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp | 576 +
sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp | 127
sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi.hpp | 18
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp | 23
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/connection_base.hpp | 23
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/cookie.hpp | 110
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp | 129
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_part.hpp | 83
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp | 48
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp | 19
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/is_async.hpp | 5
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/map.hpp | 32
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/name.hpp | 11
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/parse_options.hpp | 28
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/path_info.hpp | 94
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_acceptor_service.hpp | 5
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_base.hpp | 293
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_service.hpp | 15
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_status.hpp | 21
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp | 160
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/return.hpp | 25
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/role_type.hpp | 9
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/source_enums.hpp | 39
sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp | 14
sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp | 28
sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp | 26
sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/stdio.hpp | 81
sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp | 18
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/basic_sync_io_object.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp | 15
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/extract_params.hpp | 59
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp | 187
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp | 28
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/save_environment.hpp | 74
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_base.hpp | 15
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_id.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/throw_error.hpp | 9
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.ipp | 13
sandbox/SOC/2007/cgi/trunk/boost/cgi/error.hpp | 110
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi.hpp | 19
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp | 14
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp | 334
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp | 466
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request.hpp | 10
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp | 44
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_service.hpp | 193
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp | 25
sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/specification.hpp | 211
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_connection_fwd.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_protocol_service_fwd.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_acceptor_fwd.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_fwd.hpp | 8
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/io_service_provider_fwd.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/request_service_fwd.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/http/status_code.hpp | 8
sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/basic_request.ipp | 80
sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/fcgi_request_service.ipp | 665 +
sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/form_parser.ipp | 567 -
sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp | 207
sandbox/SOC/2007/cgi/trunk/boost/cgi/import/basic_io_object.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/import/buffer.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/import/io_service.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/import/read.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/import/streambuf.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/import/write.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi.hpp | 6
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor_service_impl.hpp | 12
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request.hpp | 4
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_acceptor_service.hpp | 6
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_impl.hpp | 16
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_service.hpp | 14
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service.hpp | 6
sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service_impl.hpp | 14
sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/redirect.hpp | 38
sandbox/SOC/2007/cgi/trunk/libs/cgi/build/Jamfile.v2 | 22
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/Jamfile.v2 | 173
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/cgi.qbk | 51
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/future_development.qbk | 68
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/preface.qbk | 12
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/reference.qbk | 13422 +++++++++++++++++++++++++++++++++++++++
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/troubleshooting.qbk | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide.qbk | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/headers.qbk | 8
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/request_objects.qbk | 9
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp | 6
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/quickstart.qbk | 7
sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/tutorial.qbk | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2 | 14
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/Jamfile.v2 | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/doc.qbk | 10
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/main.cpp | 117
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/main.cpp | 40
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/doc.qbk | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/main.cpp | 113
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/doc.qbk | 8
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp | 151
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp | 92
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/main.cpp | 18
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/server.hpp | 8
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/main.cpp | 28
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/main.cpp | 13
sandbox/SOC/2007/cgi/trunk/libs/cgi/example/xcgi/server1/Server.hpp | 10
sandbox/SOC/2007/cgi/trunk/libs/cgi/src/library_sources.cpp | 5
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/Jamfile.v2 | 3
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/async_stdio_connection.cpp | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_header_check.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_request.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_service.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_acceptor.cpp | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_request.cpp | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_service.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/response.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_acceptor.cpp | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_request.cpp | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_service.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/shareable_tcp_connection.cpp | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/stdio_connection.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/tcp_connection.cpp | 4
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2 | 7
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/acgi_simple_request.cpp | 10
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/cookie.cpp | 13
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/map_test.cpp | 5
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/name_test.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/parse_options.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/request_test_template.hpp | 46
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/response.cpp | 2
sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/stdio_connection.cpp | 2
sandbox/SOC/2007/cgi/trunk/project-root.jam | 4
134 files changed, 17210 insertions(+), 3177 deletions(-)
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -6,14 +6,13 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
////////////////////////////////////////////////////////////////
-#ifndef CGI_HPP_INCLUDED__
-#define CGI_HPP_INCLUDED__
+#ifndef BOOST_CGI_HPP_INCLUDED__
+#define BOOST_CGI_HPP_INCLUDED__
// #include all headers
#include "boost/cgi/cgi.hpp"
-#include "boost/cgi/acgi.hpp"
#include "boost/cgi/fcgi.hpp"
//#include "boost/cgi/scgi.hpp"
-#endif // CGI_HPP_INCLUDED__
+#endif // BOOST_CGI_HPP_INCLUDED__
Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/acgi.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
+++ (empty file)
@@ -1,34 +0,0 @@
-// -- acgi.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_ACGI_HPP_INCLUDED__
-#define CGI_ACGI_HPP_INCLUDED__
-
-#include "boost/cgi/acgi/service.hpp"
-#include "boost/cgi/acgi/request.hpp"
-#include "boost/cgi/detail/common_headers.hpp"
-
-namespace cgi {
-#ifndef CGI_NO_IMPLICIT_TYPEDEFS
- //typedef acgi_request request;
-#endif
- namespace acgi {
-
- using namespace ::cgi::common; // import common namespace elements.
-
- } // namespace acgi
-} // namespace cgi
-
-/// Dump acgi stuff into the boost namespace
-namespace boost {
- namespace acgi {
- using namespace ::cgi::acgi;
- } // namespace acgi
-} // namespace boost
-
-#endif // CGI_ACGI_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_client.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,14 +12,28 @@
#include <boost/shared_ptr.hpp>
///////////////////////////////////////////////////////////
#include "boost/cgi/common/map.hpp"
-#include "boost/cgi/http/status_code.hpp"
#include "boost/cgi/common/role_type.hpp"
#include "boost/cgi/common/request_status.hpp"
#include "boost/cgi/connections/tcp_socket.hpp"
+#include "boost/cgi/detail/throw_error.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
+#include "boost/cgi/error.hpp"
+#include "boost/cgi/http/status_code.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
+
+ enum client_status
+ {
+ none_, // **FIXME** !
+ constructed,
+ params_read,
+ stdin_read,
+ end_request_sent,
+ closed_, // **FIXME** !
+ //aborted
+ };
/// A client
/**
@@ -43,10 +57,19 @@
class basic_client
{
public:
- //typedef cgi::map map_type;
+ //typedef BOOST_CGI_NAMESPACE::map map_type;
+ typedef ::BOOST_CGI_NAMESPACE::common::io_service io_service_type;
+ typedef ::BOOST_CGI_NAMESPACE::common::map map_type;
typedef Connection connection_type;
typedef Protocol protocol_type;
typedef typename connection_type::pointer connection_ptr;
+ typedef boost::array<unsigned char, 8> header_buffer_type;
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+ typedef typename
+ detail::protocol_traits<
+ Protocol
+ >::role_type role_type;
+
basic_client()
{
@@ -56,28 +79,53 @@
//: io_service_(ios)
{
}
-
- bool is_open()
+
+ /// Construct the client by claiming a request id.
+ /**
+ * Before loading a request, it will usually not have a request id. This
+ * function reads headers (and corresponding bodies if necessary) until
+ * a BEGIN_REQUEST record is found. The calling request then claims and
+ * serves that request.
+ */
+ template<typename RequestImpl>
+ boost::system::error_code
+ construct(RequestImpl& req, boost::system::error_code& ec)
{
- return connection_->is_open();
+ status_ = constructed;
+ return ec;
+ }
+
+ boost::system::error_code
+ close(boost::uint64_t app_status, boost::system::error_code& ec)
+ {
+ if (!is_open())
+ ec = error::already_closed;
+ else
+ {
+ status_ = closed_;
+ connection_->close();
+ }
+ return ec;
}
- void close()
+ void close(boost::uint64_t app_status = 0)
{
- connection_->close();
+ boost::system::error_code ec;
+ close(app_status, ec);
+ detail::throw_error(ec);
}
/// Associate a connection with this client
/**
* Note: the connection must have been created using the new operator
- *
+ */
bool set_connection(connection_type* conn)
{
// make sure there isn't already a connection associated with the client
- if (!connection_) return false;
+ //if (!connection_) return false;
connection_.reset(conn);
return true;
- }*/
+ }
//io_service& io_service() { return io_service_; }
@@ -94,10 +142,6 @@
return true;
}
- /// Get a shared_ptr of the connection associated with the client.
- connection_ptr& connection() { return connection_; }
- std::size_t& bytes_left() { return bytes_left_; }
-
/// Write some data to the client.
template<typename ConstBufferSequence>
std::size_t write_some(const ConstBufferSequence& buf
@@ -106,7 +150,20 @@
return connection_->write_some(buf, ec);
}
- /// Read some data from the client.
+ /// Read data into the supplied buffer.
+ /**
+ * Reads some data that, correctly checking and stripping FastCGI headers.
+ *
+ * Returns the number of bytes read and sets `ec` such that `ec` evaluates
+ * to `true` iff an error occured during the read operation.
+ *
+ * Notable errors:
+ * - `fcgi::error::data_for_another_request`
+ * - `fcgi::error::connection_locked`
+ *
+ * These must be dealt with by user code if they choose to read through the
+ * client (reading through the request is recommended).
+ */
template<typename MutableBufferSequence>
std::size_t read_some(const MutableBufferSequence& buf
, boost::system::error_code& ec)
@@ -140,16 +197,76 @@
{
connection_->async_read_some(buf, handler);
}
+
+
+ ////// Querying the client.
+
+ /// Get a shared_ptr of the connection associated with the client.
+ connection_ptr& connection() { return connection_; }
+ std::size_t& bytes_left() { return bytes_left_; }
+
+ bool is_open()
+ {
+ return connection_->is_open();
+ }
+
+ /// 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_;
+ }
+
+ boost::uint16_t const& request_id() const
+ {
+ return request_id_;
+ }
+
private:
+
+ template<typename ConstBufferSequence>
+ void prepare_buffer(const ConstBufferSequence& buf)
+ { /* NOOP */ }
+
+ void handle_write(
+ std::size_t bytes_transferred, boost::system::error_code& ec)
+ { /* NOOP */ }
+
//io_service& io_service_;
connection_ptr connection_;
public: // **FIXME**
// we should never read more than content-length bytes.
std::size_t bytes_left_;
+
+ boost::uint16_t request_id_;
+ client_status status_;
+
+ boost::uint64_t total_sent_bytes_;
+ boost::uint64_t total_sent_packets_;
+
+ /// Buffer used to check the header of each packet.
+ //header_buffer_type out_header_;
+ fcgi::spec::header header_;
+
+ /// Output buffer.
+ std::vector<boost::asio::const_buffer> outbuf_;
+
+ bool keep_connection_;
+ role_type role_;
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_CLIENT_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_connection.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_connection.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_connection.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,78 +9,13 @@
#ifndef CGI_BASIC_CONNECTION_HPP_INCLUDED__
#define CGI_BASIC_CONNECTION_HPP_INCLUDED__
-//#include <istream>
-//#include <ostream>
-//#include <boost/asio.hpp>
-
-//#include "boost/cgi/tags.hpp"
-//#include "boost/cgi/connection_base.hpp"
-//#include "connections/async_stdio_connection_impl.hpp"
-
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<typename ConnectionType>
class basic_connection;
-/*
- : public connection_base
- //, connection_wrapper<ConnectionType>
- {
- public:
- // typedef ConnectionType impl_type;
- // //typedef boost::shared_ptr<conection_base> pointer;
-
- // explicit basic_connection(protocol_service_type& ps)
- // : impl_(ps)
- // {
- // }
-
- // static pointer create()
- // {
- // return new basic_connection<protocol_service_type
- // , connection_type>(impl_.protocol_service());
- // }
-
- //private:
- // impl_type impl_;
- };
-
-*/
-
- // template<typename ProtocolService>
- //class async_stdio_connection_impl;
-
- //template<typename ProtocolService>
- //class stdio_connection_impl;
-
-
- //#include "connections/stdio_connection_impl.hpp"
-
- //template<typename ProtocolService>
- // class basic_connection<tags::stdio, ProtocolService>
- // : public stdio_connection_impl<ProtocolService>
- //{
- //};
-
- //typedef basic_connection<tags::stdio, stdio_connection
-
-
- //#include "connections/async_stdio_connection_impl.hpp"
-
- //template<typename ProtocolService>
- //class basic_connection<tags::async_stdio, ProtocolService>
- // : public async_stdio_connection_impl<ProtocolService>
- //{
- //};
-
- //typedef basic_connection<tags::tcp> tcp_connection;
- //typedef basic_connection<tags::pipe> pipe_connection; // not implemented
-//#include "connections/stdio_connection.hpp"
-//#include "connections/async_stdio_connection.hpp"
-//#include "connections/tcp_connection.hpp"
-
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_CONNECTION_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -1,6 +1,6 @@
// -- basic_request.hpp --
//
-// Copyright (c) Darren Garvey 2007.
+// 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)
@@ -20,109 +20,142 @@
#include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/noncopyable.hpp>
+#include <boost/optional.hpp>
+#include <boost/functional/hash.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/system/error_code.hpp>
-#include <boost/asio/basic_io_object.hpp>
+#include <boost/utility/enable_if.hpp>
///////////////////////////////////////////////////////////
-// **FIXME** Half of these are probably useless
-#include "boost/cgi/detail/protocol_traits.hpp"
+#include "boost/cgi/common/data_map_proxy.hpp"
+#include "boost/cgi/common/form_part.hpp"
+#include "boost/cgi/common/has_hidden_io_service.hpp"
#include "boost/cgi/common/map.hpp"
-#include "boost/cgi/common/is_async.hpp"
+#include "boost/cgi/common/parse_options.hpp"
+#include "boost/cgi/common/path_info.hpp"
+#include "boost/cgi/common/request_service.hpp"
+#include "boost/cgi/common/request_status.hpp"
#include "boost/cgi/common/role_type.hpp"
-#include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/detail/throw_error.hpp"
#include "boost/cgi/common/source_enums.hpp"
+#include "boost/cgi/detail/basic_io_object.hpp"
+#include "boost/cgi/detail/throw_error.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
#include "boost/cgi/fwd/basic_request_fwd.hpp"
-#include "boost/cgi/common/request_service.hpp"
-#include "boost/cgi/import/basic_io_object.hpp"
-#include "boost/cgi/detail/basic_sync_io_object.hpp"
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/http/status_code.hpp"
-namespace cgi {
+#ifndef BOOST_CGI_POST_MAX
+ /// Restrict POST data to less than 7MB per request.
+# define BOOST_CGI_POST_MAX 6663322
+#endif // BOOST_CGI_POST_MAX
+
+#ifndef BOOST_CGI_DEFAULT_CHARSET
+# define BOOST_CGI_DEFAULT_CHARSET "UTF-8"
+#endif
+
+BOOST_CGI_NAMESPACE_BEGIN
+
namespace common {
+ /// Get a hashed interpretation of the request.
+ /**
+ * You cannot consider this completely unique to each
+ * request, but it should be quite useful anyway.
+ * You can use this for logging or tracking, for example.
+ */
+ template<typename P>
+ std::size_t hash_value(basic_request<P> const& req);
+
/// The basic_request class, primary entry point to the library
/**
* Note: By default, synchronous protocols (ie. cgi) auto-load AND parse
* STDIN,whereas async protocols don't.
*
- * Note: The alternative functions which take a boost::system::error_code are
- * the non-throwing versions. Instead of a boost::system::system_error being
- * thrown in case of an error, the passed error_code will be set to the value
- * of the error, s.t. if (error) evaluates to true.`
+ * Note: The alternative functions which take a boost::system::error_code
+ * are the non-throwing versions. Instead of a boost::system::system_error
+ * being thrown in case of an error, the passed error_code will be set to
+ * the value of the error, s.t. if (error) evaluates to true.`
*
* Note: This class isn't thread safe: carrying around a mutex-per-request
- * seems prohibitively expensive. There could be functions which take a mutex
- * as an arguement and lock it. (Async calls could get messy if you need a
- * protected request object).
+ * seems prohibitively expensive. There could be functions which take a
+ * 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 boost::mpl::if_<
- is_async<typename RequestService::protocol_type>
- , basic_io_object<RequestService>
- , detail::basic_sync_io_object<RequestService>
- >::type
+ : public detail::basic_io_object<
+ typename detail::protocol_traits<Protocol>::service_type
+ >
{
public:
- typedef
- basic_request<
- RequestService, ProtocolService
- , Allocator
- > type;
- typedef ::cgi::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<type> pointer;
- typedef typename RequestService::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 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 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;
+ common::data_map_proxy<get_map> get;
+ common::data_map_proxy<form_map> form;
+ common::data_map_proxy<cookie_map> cookies;
+ common::data_map_proxy<upload_map> uploads;
+ basic_request(
+ int opts
+ , char** base_env = NULL)
+ : detail::basic_io_object<service_type>()
+ {
+ if ((parse_options)opts > parse_none) load((parse_options)opts, base_env);
+ }
- // Throws
- basic_request(bool load_now = true, bool parse_post = true)
- : detail::basic_sync_io_object<service_type>()
+ basic_request(
+ const parse_options opts = traits::parse_opts
+ , char** base_env = NULL)
+ : detail::basic_io_object<service_type>()
{
- if (load_now) load(parse_post);//this->service.load(this->implementation, true, ec);
+ if (opts > parse_none) load(opts, base_env);
}
- // Won't throw
+ // Won't throw
basic_request(boost::system::error_code& ec
- , const bool load_now = true
- , const bool parse_post = true)
- : detail::basic_sync_io_object<service_type>()
+ , const parse_options opts = traits::parse_opts
+ , char** base_env = NULL)
+ : detail::basic_io_object<service_type>()
{
- if (load_now) load(ec, parse_post);//this->service.load(this->implementation, true, ec);
+ if (opts > parse_none) load(opts, ec);
}
- // Throws
- basic_request(protocol_service_type& s, const bool load_now = false
- , const bool parse_post = false)
- : basic_io_object<service_type>(s.io_service())
+ // Throws
+ basic_request(protocol_service_type& s
+ , const parse_options opts = traits::parse_opts
+ , char** base_env = NULL)
+ : detail::basic_io_object<service_type>(s.io_service())
{
set_protocol_service(s);
- if (load_now) load(parse_post);//this->service.load(this->implementation, false, ec);
+ if (opts > parse_none) load(opts, base_env);
}
- // Won't throw
+ // Won't throw
basic_request(protocol_service_type& s
, boost::system::error_code& ec
- , const bool load_now = false, const bool parse_post = false)
- : basic_io_object<service_type>(s.io_service())
+ , const parse_options opts = traits::parse_opts
+ , char** base_env = NULL)
+ : detail::basic_io_object<service_type>(s.io_service())
{
set_protocol_service(s);
- if(load_now) load(ec, parse_post);//this->service.load(this->implementation, false, ec);
+ if (opts > parse_none) load(opts, ec, base_env);
}
/// Make a new mutiplexed request from an existing connection.
// Throws.
basic_request(implementation_type& impl)
- : basic_io_object<service_type>(impl.service_->io_service())
+ : detail::basic_io_object<service_type>(impl.service_->io_service())
{
set_protocol_service(*impl.service_);
boost::system::error_code ec;
@@ -134,7 +167,7 @@
/// Make a new mutiplexed request from an existing connection.
// Won't throw.
basic_request(implementation_type& impl, boost::system::error_code& ec)
- : basic_io_object<service_type>(impl.service_->io_service())
+ : detail::basic_io_object<service_type>(impl.service_->io_service())
{
set_protocol_service(*impl.service_);
this->service.begin_request_helper(this->implementation
@@ -146,10 +179,15 @@
//if (is_open())
// close(http::internal_server_error, 0);
}
-
+
static pointer create(protocol_service_type& ps)
{
- return pointer(new type(ps));
+ return pointer(new self_type(ps));
+ }
+
+ static pointer create()
+ {
+ return pointer(new self_type());
}
void set_protocol_service(protocol_service_type& ps)
@@ -157,7 +195,21 @@
this->service.set_service(this->implementation, ps);
}
- /// Return `true` if the request is still open (ie. not aborted or closed)
+ /// The id of this request.
+ /**
+ * This is 1 for CGI/aCGI requests, but may be != 1 for FastCGI
+ * requests.
+ *
+ * Note that for FastCGI requests, the id's are assigned on a
+ * *per-connection* policy, so in one application you may have
+ * several requests with the same id.
+ */
+ int id()
+ {
+ return this->service.request_id(this->implementation);
+ }
+
+ /// Check if the request is still open (ie. not aborted or closed)
bool is_open()
{
return this->service.is_open(this->implementation);
@@ -165,42 +217,74 @@
/// Synchronously read/parse the request meta-data
/**
- * Note: 'loading' including reading/parsing STDIN if parse_stdin == true
+ * Note: 'loading' including reading/parsing STDIN if
+ * parse_stdin == true
*/
- // Throwing semantics
- void load(bool parse_stdin = false)
+ void load(parse_options parse_opts = parse_env, char** base_env = NULL)
{
boost::system::error_code ec;
- this->service.load(this->implementation, parse_stdin, ec);
+ load(parse_opts, ec, base_env);
detail::throw_error(ec);
}
- // Error-code semantics (**FIXME**)
- boost::system::error_code
- load(parse_options parse_opts, boost::system::error_code& ec)
- {
- return this->service.load(this->implementation, parse_opts, ec);
- }
-
- // Error-code semantics (**FIXME**)
+ // Error-code semantics
boost::system::error_code
- load(bool parse_stdin, boost::system::error_code& ec)
+ load(parse_options parse_opts, boost::system::error_code& ec
+ , char** base_environment = NULL, bool is_command_line = true)
{
- return this->service.load(this->implementation, parse_stdin, ec);
- }
-
- // Error-code semantics (**FIXME**)
- boost::system::error_code
- load(boost::system::error_code& ec, bool parse_stdin = false)
- {
- return this->service.load(this->implementation, parse_stdin, ec);
+ // Parse just the environment first, then check the user
+ // isn't trying to upload more data than we want to let them.
+ // Define `BOOST_CGI_POST_MAX` to set the maximum content-length
+ // allowed.
+ if (parse_opts & parse_env)
+ {
+ //this->service.load(this->implementation, parse_env, ec);
+ //if (content_length() >= BOOST_CGI_POST_MAX)
+ // ec = common::error::max_post_exceeded;
+ this->service.load(this->implementation, parse_opts, ec);
+
+ if (ec) return ec;
+
+ // Load the environment passed by the user.
+ if (base_environment)
+ this->service.load_environment(
+ this->implementation, base_environment
+ , is_command_line);
+
+ if (parse_opts & parse_env)
+ env.set(env_vars(this->implementation.vars_));
+ if (parse_opts & parse_get_only)
+ get.set(get_vars(this->implementation.vars_));
+ if (parse_opts & parse_post_only)
+ post.set(post_vars(this->implementation.vars_));
+ if (parse_opts & parse_get_only || parse_opts & parse_get_only)
+ uploads.set(upload_vars(this->implementation.vars_));
+ if (parse_opts & parse_cookies)
+ cookies.set(cookie_vars(this->implementation.vars_));
+ if (parse_opts & parse_form_only)
+ {
+ 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)
+ {
+ this->service.load_environment(this->implementation
+ , base_environment
+ , is_command_line);
}
/// Get the buffer containing the POST data.
/**
* **FIXME**
- * This actually returns the whole buffer on FastCGI at the moment, which
- * contains the params too.
+ * This actually returns the whole buffer on FastCGI at the moment,
+ * which contains the params too.
*/
buffer_type& post_buffer()
{
@@ -210,7 +294,8 @@
// **FIXME**
/// Asynchronously read/parse the request meta-data
/**
- * Note: 'loading' including reading/parsing STDIN if parse_stdin == true
+ * Note: 'loading' including reading/parsing STDIN if
+ * parse_stdin == true
*/
//template<typename Handler>
//void async_load(Handler handler, bool parse_stdin = false)
@@ -219,28 +304,30 @@
// , handler);
//}
- /// Notify the server the request has finished being handled
+ /// Notify the server the request has been handled.
/**
- * In certain situations (such as a Proactor client using the async read
- * functions) it will be necessary to call end, rather than just returning
- * from the sub_main function.
+ * In certain situations (such as a Proactor client using the async
+ * read functions) it will be necessary to call end, rather than
+ * just returning from the sub_main function.
+ *
+ * @param http_status The HTTP status of the request.
*
- * @param program_status This value is returned to the server indicating the
- * state of the request after it was finished handling. It is
- * implementation defined how the server deals with this, and it may have
- * no effect on the http status code returned to the client (eg. 200 OK).
+ * @param program_status This value is returned to the server
+ * indicating the state of the request after it was finished
+ * handling. It is implementation defined how the server deals with
+ * this, and it may have no effect on the http status code returned
+ * to the client (eg. 200 OK).
*
* @returns The value of program_status
*/
int close(common::http::status_code http_status = http::ok
, int program_status = 0)
{
- //BOOST_ASSERT( request_status_ != ended );
-
- //this->service.set_status(this->implementation, http_status);
boost::system::error_code ec;
this->service.close(this->implementation, http_status,
program_status, ec);
+ // Clear the request data so the object can be reused.
+ //clear();
detail::throw_error(ec);
return program_status;
}
@@ -253,7 +340,7 @@
, program_status, ec);
}
- /// Reject the request with a standard '500 Internal Server Error' error
+ /// Reject the request with a '500 Internal Server Error' error.
int reject()
{
this->service.set_status(this->implementation, aborted);
@@ -261,7 +348,7 @@
, http::internal_server_error);
}
- /// Abort a request
+ /// Abort a request.
void abort()
{
this->service.set_status(this->implementation, aborted);
@@ -277,8 +364,8 @@
/// Get the client connection associated with the request
/**
- * You use the client for read/write calls. Y
- */
+ * You use the client for read/write calls.
+ */
client_type& client()
{
return this->service.client(this->implementation);
@@ -326,79 +413,178 @@
* Set the output sink as `stdout_`, `stderr_`, or `stdout_ | stderr_`
*/
/*
- void set_output(cgi::sink dest, boost::system::error_code& ec)
+ void set_output(BOOST_CGI_NAMESPACE::sink dest, boost::system::error_code& ec)
{
this->service(this->implementation, dest, ec);
}
*/
- // [helper-functions for the basic CGI 1.1 meta-variables.
+ /////////////////////////////////////////////////////////
+ // Helper-functions for the basic CGI 1.1 meta-variables.
+ /////////////////////////////////////////////////////////
+
string_type& auth_type()
- { return env_("AUTH_TYPE"); }
+ { return env["AUTH_TYPE"]; }
- string_type& content_length()
- { return env_("CONTENT_LENGTH"); }
+ /// Get the content length as a long.
+ /**
+ * The content length defaults to zero if it isn't explicitly set
+ * by your HTTP server.
+ */
+ long content_length()
+ {
+ string_type& cl(env["CONTENT_LENGTH"]);
+ return boost::lexical_cast<long>(cl.empty() ? "0" : cl);
+ }
+ /// The content type of the request.
+ /**
+ * Common value: text/html.
+ */
string_type& content_type()
- { return env_("CONTENT_TYPE"); }
+ { return env["CONTENT_TYPE"]; }
+ /// The protocol used by the server to communicate to the script.
+ /**
+ * Common value: CGI/1.1.
+ */
string_type& gateway_interface()
- { return env_("GATEWAY_INTERFACE"); }
+ { return env["GATEWAY_INTERFACE"]; }
- string_type& path_info()
- { return env_("PATH_INFO"); }
+ /// Additional information, appendended to the script.
+ common::path_info path_info()
+ { return env["PATH_INFO"]; }
+ /// The translated version of the path info.
+ /**
+ * Your HTTP server may provide this, depending on configuration.
+ * The path info can represent a resource on the local file system.
+ */
string_type& path_translated()
- { return env_("PATH_TRANSLATED"); }
+ { return env["PATH_TRANSLATED"]; }
+ /// The query string for the request.
+ /**
+ * This is the part of the request URI after a '?'. A GET request
+ * passes request parameters, URL encoded in the query string.
+ */
string_type& query_string()
- { return env_("QUERY_STRING"); }
+ { return env["QUERY_STRING"]; }
+ /// The host address of the remote user.
string_type& remote_addr()
- { return env_("REMOTE_ADDR"); }
+ { return env["REMOTE_ADDR"]; }
+ /// The host name of the remote user's machine.
string_type& remote_host()
- { return env_("REMOTE_HOST"); }
+ { return env["REMOTE_HOST"]; }
+ /// The user making the request.
string_type& remote_ident()
- { return env_("REMOTE_IDENT"); }
+ { return env["REMOTE_IDENT"]; }
+ /// The userid of the person accessing the script.
string_type& remote_user()
- { return env_("REMOTE_USER"); }
+ { return env["REMOTE_USER"]; }
+
+ /// The method of the request.
+ /**
+ * Common values: `GET`, `POST`, `HEAD`.
+ */
+ string_type& method()
+ { return env["REQUEST_METHOD"]; }
+ /// The method of the request (long-hand of `method()`).
+ /**
+ * Common values: `GET`, `POST`, `HEAD`.
+ */
string_type& request_method()
- { return env_("REQUEST_METHOD"); }
+ { return env["REQUEST_METHOD"]; }
+
+ /// Get the URI of the request.
+ string_type& uri()
+ { return env["REQUEST_URI"]; }
+
+ /// Get the URI of the request (long-hand of `uri()`).
+ string_type& request_uri()
+ { return env["REQUEST_URI"]; }
+ /// The name of the script.
string_type& script_name()
- { return env_("SCRIPT_NAME"); }
+ { return env["SCRIPT_NAME"]; }
+ /// The URL of the script.
+ string_type& script_url()
+ { return env["SCRIPT_URL"]; }
+
+ /// The full URI of the script.
+ string_type& script_uri()
+ { return env["SCRIPT_URI"]; }
+
+ /// Get the name of the server.
+ /**
+ * Usually set in your HTTP configuration. This could be the name
+ * of a virtual host.
+ */
string_type& server_name()
- { return env_("SERVER_NAME"); }
+ { return env["SERVER_NAME"]; }
+ /// Get the port the calling server is listening on.
+ /**
+ * Common value: 80.
+ */
string_type& server_port()
- { return env_("SERVER_PORT"); }
+ { return env["SERVER_PORT"]; }
+ /// Get the protocol being used by the calling server.
+ /**
+ * Common value: HTTP/1.1.
+ */
string_type& server_protocol()
- { return env_("SERVER_PROTOCOL"); }
+ { return env["SERVER_PROTOCOL"]; }
+ /// Get a string identifying the calling server.
+ /**
+ * CGI scripts are generally called by a web-facing HTTP server.
+ * When set, this string can be useful for knowing what is calling
+ * the script, especially in a multi-server or load balanced
+ * environment.
+ */
string_type& server_software()
- { return env_("SERVER_SOFTWARE"); }
-
+ { return env["SERVER_SOFTWARE"]; }
+
+ /// Get the web page the user came from.
+ /**
+ * HTTP equivalent: `HTTP_REFERER`
+ *
+ * The referer is commonly used for tracking user's movements and
+ * origins. For instance, some sites use this to highlight some
+ * keywords on the page when users come from a search engine.
+ *
+ * Note that you cannot ever guarantee on this value being either set
+ * or accurate.
+ */
string_type& referer()
- { return env_("HTTP_REFERER"); }
+ { return env["HTTP_REFERER"]; }
// -- end helper-functions]
/// Get the charset from the CONTENT_TYPE header
string_type charset()
{
- // Not sure if regex is needlessly heavy-weight here.
- boost::regex re(";[ ]?charset=([-\\w]+);");
- boost::smatch match;
- if (!boost::regex_match(this->content_type(), match, re))
- return ""; // A default could go here.
-
- return match[1];
+ string_type ctype(content_type());
+ std::size_t pos = ctype.find("charset=");
+ string_type val(ctype.substr(pos+8, ctype.find(";", pos)));
+ boost::algorithm::trim(val);
+ return val.empty() ? BOOST_CGI_DEFAULT_CHARSET : val;
}
+
+ /// The email of the user making the request.
+ string_type& http_from ()
+ { return env["HTTP_FROM"]; }
+
+ /// The cookies sent by the user making the request.
+ string_type& http_cookie ()
+ { return env["HTTP_COOKIE"]; }
/// The role that the request is playing
/**
@@ -406,108 +592,63 @@
*
* In some cases - for instance with FastCGI - the role type can be
* different
- * eg. authorizer, or filter.
+ * eg. `authorizer`, or `filter`.
*/
- role_type& role()
- {
- return this->service.get_role(this->implementation);
- }
-
- void set_status(common::http::status_code const& status)
- {
- this->service.set_status(this->implementation, status);
- }
-
- ////////////////////////////////////////////////////////////
- // Note on operator[]
- // ------------------
- // It is overloaded on different enum types to allow
- // compile-time (I hope) retrieval of different data
- // maps.
- //
-
- // The first three overloads are for directly looking into the
- // environment.
- // eg.
- // string_type& val = req["some name"];
-
- /// Get the value of the environment variable with name `n`.
- string_type& operator[](string_type const& n)
- {
- return env_vars(this->implementation.vars_)[n.c_str()];
- }
-
- /// Get the value of the environment variable with name `n`.
- string_type& operator[](const char* n)
+ role_type& role() const
{
- return env_vars(this->implementation.vars_)[n];
+ return this->service.role(this->implementation);
}
- /// Get the value of the environment variable with name `n`.
- string_type& operator[](common::name const& n)
- {
- return env_vars(this->implementation.vars_)[n];
- }
-
- /// Get a `common::env_map&` of all the environment variables.
- env_map& operator[](common::env_data_type const&)
- {
- return env_vars(this->implementation.vars_);
- }
-
- /// Get a `common::get_map&` of all the GET variables.
- get_map& operator[](common::get_data_type const&)
+ /// Get a hashed interpretation of the request.
+ /**
+ * You cannot consider this completely unique to each
+ * request, but it should be quite useful anyway.
+ * You can use this for logging or tracking, for example.
+ */
+ std::size_t hash()
{
- return get_vars(this->implementation.vars_);
+ return boost::hash<self_type>()(*this);
}
- /// Get a `common::post_map&` of all the POST variables.
- post_map& operator[](common::post_data_type const&)
+ /// Get / Set the status of a request.
+ /**
+ * The usual way to set the request status is to set it
+ * when calling `close`.
+ */
+ common::request_status status() const
{
- return post_vars(this->implementation.vars_);
+ return this->service.status(this->implementation);
}
-
- /// Get a `common::cookie_map&` of all the cookies.
- cookie_map& operator[](common::cookie_data_type const&)
+
+ void status(common::request_status const& status)
{
- return cookie_vars(this->implementation.vars_);
+ this->service.status(this->implementation, status);
}
-
- /// Get a `common::form_map&` of either the GET or POST variables.
- form_map& operator[](common::form_data_type const&)
+
+ common::http::status_code status(common::http::status_code const& status) const
{
- if (request_method() == "GET")
- return get_vars(this->implementation.vars_);
- else
- if (request_method() == "POST")
- return post_vars(this->implementation.vars_);
- else
- return env_vars(this->implementation.vars_);
+ return this->service.status(this->implementation);
}
- ////////////////////////////////////////////////////////////
-
- /// The id of this request.
- /**
- * This is 1 for CGI/aCGI requests, but may be != 1 for FastCGI requests.
- * Note that for FastCGI requests, the id's are assigned on a
- * *per-connection* policy, so in one application you may have several
- * requests with the same id.
- */
- int id()
+
+ void status(common::http::status_code const& status)
{
- return this->service.request_id(this->implementation);
+ this->service.status(this->implementation, status);
}
+ };
- private:
- // Internal shortcut for named env-var functions (eg. script_name() above).
- string_type& env_(const char* name)
- {
- return env_vars(this->implementation.vars_)[name];
- }
- };
+ template<typename P>
+ std::size_t hash_value(basic_request<P> const& req)
+ {
+ boost::hash<typename basic_request<P>::string_type> hasher;
+ return hasher(req.env["REMOTE_ADDR"] + ":"
+ + req.env["REMOTE_PORT"] + ":"
+ + req.env["HTTP_USER_AGENT"] + ":"
+ + req.env["REQUEST_METHOD"] + ":"
+ + req.env["REQUEST_URI"]);
+ }
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
@@ -520,4 +661,3 @@
- The user should supply an abort_handler-derived function if they want
any special handling of aborted requests
*/
-
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/basic_request_acceptor.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -14,14 +14,15 @@
#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"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- /// The interface class for any *cgi::acceptor.
+ /// The interface class for any *BOOST_CGI_NAMESPACE::acceptor.
template<typename RequestAcceptorService>
class basic_request_acceptor
: public boost::asio::basic_io_object<RequestAcceptorService>
@@ -34,71 +35,47 @@
typedef
typename service_type::implementation_type::port_number_type
port_number_type;
- typedef
- typename service_type::implementation_type::acceptor_service_type
- next_layer_type;
- typedef
- typename service_type::endpoint_type
- endpoint_type;
- typedef typename service_type::native_type native_type;
- typedef
- typename service_type::service_impl_type::protocol_service_type
- protocol_service_type;
-
-
- //template<typename IoServiceProvider>
- //explicit basic_request_acceptor(
- // basic_protocol_service<protocol_type, IoServiceProvider>& ps)
- // : boost::asio::basic_io_object<RequestAcceptorService>(ps.io_service())
- //{
- // this->service.set_protocol_service(this->implementation, ps);
- //}
+ typedef typename
+ service_type::acceptor_service_type next_layer_type;
+ typedef typename
+ service_type::endpoint_type endpoint_type;
+ typedef typename service_type::native_type native_type;
+ typedef typename
+ service_type::protocol_service_type protocol_service_type;
+ typedef typename
+ service_type::accept_handler_type accept_handler_type;
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 +93,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 +160,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)
{
@@ -228,7 +213,25 @@
, native_acceptor, ec);
}
- /// Accept one request
+ /// Accept one request and handle it with `handler`.
+ int accept(accept_handler_type handler)
+ {
+ boost::system::error_code ec;
+ int status = this->service.accept(this->implementation, handler, 0, ec);
+ detail::throw_error(ec);
+ return status;
+ }
+
+ int accept(accept_handler_type handler, boost::system::error_code& ec)
+ {
+ return this->service.accept(this->implementation, handler, 0, ec);
+ }
+
+ void async_accept(accept_handler_type handler)
+ {
+ this->service.async_accept(this->implementation, handler);
+ }
+
template<typename CommonGatewayRequest>
void accept(CommonGatewayRequest& request)
{
@@ -242,7 +245,6 @@
boost::system::error_code
accept(CommonGatewayRequest& request, boost::system::error_code& ec)
{
- //std::cerr<< "mine:::: endpoint.port := " << this->implementation.endpoint_.port() << std::endl;
return this->service.accept(this->implementation, request, 0, ec);
}
@@ -254,9 +256,6 @@
return this->service.accept(this->implementation, request, &ep, ec);
}
- //template<typename CommonGatewayRequest, typename Endpoint>
- //boost::system::error_code
-
/// Asynchronously accept one request
template<typename CommonGatewayRequest, typename Handler>
void async_accept(CommonGatewayRequest& request, Handler handler)
@@ -292,7 +291,7 @@
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_REQUEST_ACCEPTOR_HPP_INCLUDED__
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-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,6 +9,8 @@
#ifndef CGI_CGI_HPP_INCLUDED__
#define CGI_CGI_HPP_INCLUDED__
+#include "boost/cgi/config.hpp"
+
// Include all cgi-related headers only.
#include "boost/cgi/cgi/request.hpp"
#include "boost/cgi/cgi/service.hpp"
@@ -16,20 +18,12 @@
// Include headers common to all protocols
#include "boost/cgi/detail/common_headers.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
typedef cgi_request request;
- //typedef cgi::cgi_service service; // to be added
+ using namespace common;
+ //typedef BOOST_CGI_NAMESPACE::cgi_service service; // to be added
-} // namespace cgi
-
-/// Dump acgi stuff into the boost namespace
-namespace boost {
- namespace cgi {
- using namespace ::cgi::cgi;
- using namespace ::cgi;
- using namespace ::cgi::common;
- } // namespace acgi
-} // namespace boost
+BOOST_CGI_NAMESPACE_END
#endif // CGI_CGI_HPP_INCLUDED__
Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/cgi/request_impl.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
+++ (empty file)
@@ -1,71 +0,0 @@
-// -- cgi_request_impl.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_CGI_REQUEST_IMPL_HPP_INCLUDED__
-#define CGI_CGI_REQUEST_IMPL_HPP_INCLUDED__
-
-#include <map>
-#include <string>
-///////////////////////////////////////////////////////////
-#include <boost/shared_ptr.hpp>
-#include <boost/noncopyable.hpp>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/common/map.hpp"
-#include "boost/cgi/basic_client.hpp"
-#include "boost/cgi/common/role_type.hpp"
-#include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/connections/stdio.hpp"
-#include "boost/cgi/detail/cgi_request_impl_base.hpp"
-
-// Make this ProtocolService-independent
-
-namespace cgi {
-
- // Forward declaration
- //template<typename>
- class cgi_service_impl;
-
-
- /// Implementation for a standard CGI request
- /**
- * Note: This isn't noncopyable since there's no real reason it can't be
- * copied around. Since basic_request is noncopyable, basic copying will be
- * restricted but if someone really wants to copy the data, then they can.
- */
- class cgi_request_impl
- : public detail::cgi_request_impl_base<common::stdio_connection>
- {
- public:
- typedef common::basic_client<
- common::stdio_connection, common::tags::cgi
- > client_type;
-
- /// Constructor
- /**
- * Since this request type is synchronous, there is no need for an
- * io_service, so the passed ProtocolService is just ignored.
- */
- template<typename ProtocolService>
- cgi_request_impl(ProtocolService& pserv)
- : detail::cgi_request_impl_base<connection_type>(pserv)
- {
- }
-
- cgi_request_impl()
- : detail::cgi_request_impl_base<connection_type>()
- {
- }
-
- protected:
- friend class cgi_service_impl;
- };
-
-} // namespace cgi
-
-#endif // CGI_CGI_REQUEST_IMPL_HPP_INCLUDED__
-
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/basic_protocol_service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -21,8 +21,9 @@
#include "boost/cgi/detail/protocol_traits.hpp"
#include "boost/cgi/common/io_service_provider.hpp"
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/// Basic Protocol Service
@@ -41,31 +42,20 @@
typedef typename traits::request_type request_type;
typedef typename boost::shared_ptr<request_type> request_ptr;
typedef std::set<request_ptr> set_type;
- //typename boost::mpl::if_<
- // boost::is_same<protocol_type, tags::acgi>::value
- // , request_type::pointer
- // , std::set<request_type::pointer>
- // >::type
-
typedef std::queue<request_ptr> queue_type;
basic_protocol_service(int pool_size_hint = 1)
: ios_provider_(pool_size_hint)
- //, strand_(ios_provider_.io_service())
- //, gateway_(*this)
{
}
basic_protocol_service(boost::asio::io_service& ios)
: ios_provider_(ios)
- //, strand_(ios)
- //, gateway_(*this)
{
}
~basic_protocol_service()
{
- //gateway_.stop();
}
/// Run all the io_services contained by this service
@@ -98,8 +88,6 @@
void reset()
{
request_queue_.clear();
- //std::for_each(request_set_.begin(), request_set_.end()
- // , boost::bind(&request_type::abort, boost::arg<1>()));
request_set_.clear();
ios_provider_.reset();
}
@@ -114,7 +102,7 @@
* The order in which the underlying io_services are returned is determined
* by what policy the IoServiceProvider uses.
*/
- ::cgi::common::io_service& io_service()
+ ::BOOST_CGI_NAMESPACE::common::io_service& io_service()
{
return ios_provider_.get_io_service();
}
@@ -136,9 +124,6 @@
private:
ios_provider_type ios_provider_;
- /// A strand is used for guaranteeing handlers are dispatched sequentially
- //boost::asio::strand strand_;
-
/// A std::set of all the requests.
set_type request_set_;
/// A std::queue of the waiting (ie. not-being-handled) requests.
@@ -153,6 +138,6 @@
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_PROTOCOL_SERVICE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/connection_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/connection_base.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/connection_base.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,32 +9,17 @@
#ifndef CGI_CONNECTION_BASE_HPP_INCLUDED__
#define CGI_CONNECTION_BASE_HPP_INCLUDED__
-namespace cgi {
+#include "boost/cgi/config.hpp"
+
+BOOST_CGI_NAMESPACE_BEGIN
/// Abstract Base Class for all connection types
class connection_base
{
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() { }
};
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_CONNECTION_BASE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/cookie.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/cookie.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/cookie.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,12 +12,19 @@
#include <string>
#include <boost/system/error_code.hpp>
#include <boost/tokenizer.hpp>
+#include "boost/cgi/common/name.hpp"
+#include "boost/cgi/config.hpp"
+
+#ifndef BOOST_CGI_DATE_IN_THE_PAST
+# define BOOST_CGI_DATE_IN_THE_PAST "Fri, 05-Jun-1989 15:30:00 GMT"
+#endif // BOOST_CGI_DATE_IN_THE_PAST
+
+BOOST_CGI_NAMESPACE_BEGIN
-namespace cgi {
namespace common {
template<typename CharT> struct basic_cookie;
-
+
// typedefs for common usage
typedef basic_cookie<char> cookie;
typedef basic_cookie<wchar_t> wcookie;
@@ -25,8 +32,8 @@
/// A `basic_cookie<>` object that can be (out-) streamed
/**
* Either set the parameters in the constructor, or set them directly.
- * Note: If you want to set the parameters individually, remember that each
- * parameter must NOT have a trailing semi-colon!
+ * Note: If you want to set the parameters individually, remember that
+ * each parameter must NOT have a trailing semi-colon!
*
* TODO
* - Data should be URL-encoded, or maybe provide an overload for url_decode
@@ -36,16 +43,26 @@
template<typename CharT>
struct basic_cookie
{
+ typedef basic_cookie<CharT> self_type;
typedef CharT char_type;
typedef typename std::basic_string<CharT> string_type;
basic_cookie() {}
+ basic_cookie(const char* _name)
+ : name(_name)
+ , value()
+ , expires(BOOST_CGI_DATE_IN_THE_PAST)
+ , path("/")
+ , secure(false)
+ , http_only(false)
+ {
+ }
- /// Delete the cookie named `_name`.
+ /// Create a cookie for deleting the cookie named `_name`.
basic_cookie(const string_type& _name)
: name(_name)
, value()
- , expires("Fri, 05-Jun-1989 15:30:00 GMT")
+ , expires(BOOST_CGI_DATE_IN_THE_PAST)
, path("/")
, secure(false)
, http_only(false)
@@ -74,53 +91,16 @@
string_type expires;
string_type path;
string_type domain;
+ /// `true` iff the cookie is only used for secure connections.
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;
- cookie ck = from_string(ec);
- detail::throw_error(ec);
- return ck;
- }
-
- static basic_cookie<string_type> from_string(std::string& str)
- {
- 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
+ /// Make a string out of the cookie.
string_type to_string() const
{
string_type str(name + "=" + value);
@@ -131,18 +111,40 @@
if ( http_only ) str += "; HttpOnly";
return 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>
+ friend std::ostream& operator<<(std::ostream& os, basic_cookie<T> const& ck);
};
+ inline
+ std::pair<common::name, common::cookie>
+ make_pair (const char* n, common::cookie& ck)
+ {
+ ck.value.swap(ck.name);
+ ck.name = n;
+ 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;
+ }
+
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
-template<typename OutStream, typename T>
-inline OutStream& operator<< (OutStream& os, cgi::common::basic_cookie<T> const& ck)
-{
- os<< ck.to_string();
- return os;
-}
#endif // CGI_COOKIE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_parser.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -24,56 +24,122 @@
///////////////////////////////////////////////////////////
#include "boost/cgi/common/map.hpp"
#include "boost/cgi/common/form_part.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
- namespace detail {
-
- /// Destined for better things than an implementation detail (hopefully).
+/// Set the directory that uploads are stored in.
+/**
+ * When files are uploaded, using multipart/form-data, uploaded
+ * files are saved to disk, rather than being held in memory.
+ *
+ * This macro determines where uploaded files are stored. It must
+ * include a trailing slash (eg. "../upload/", which is the default).
+ *
+ * Your web server must run as a user that has read and write
+ * permissions to this directory. You should never allow this to
+ * be the same directory the FastCGI script is running in, or any
+ * directory containing executable files.
+ */
+#if !defined(BOOST_CGI_UPLOAD_DIRECTORY)
+# define BOOST_CGI_UPLOAD_DIRECTORY "../upload/"
+#endif // BOOST_CGI_UPLOAD_DIRECTORY
+
+BOOST_CGI_NAMESPACE_BEGIN
+ namespace common {
+
+ /// A class for parsing POST data sent to a CGI process.
+ /**
+ * Construct this and then call `form_parser::parse` with an
+ * instance of form_parser::context (or compatible struct).
+ *
+ * This is minimal and doesn't extract all meta-data yet, but
+ * is known to work on Windows XP with MSVC9.0 and Ubuntu linux
+ * with gcc 4.2.x and 4.3.x.
+ *
+ * Valid Form Encodings
+ * > `application/x-www-form-urlencoded`
+ * > `multipart/form-data`
+ *
+ * File uploads (ie. in `multipart/form-data` forms) are saved
+ * to disk. See the `BOOST_CGI_UPLOAD_DIRECTORY` macro.
+ *
+ * Should also work for HTTP POST data.
+ *
+ */
class form_parser
{
public:
+ /// The callback functor to read more data.
typedef
boost::function<
std::size_t (boost::system::error_code&)
>
callback_type;
- typedef std::string string_type;
- typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
- typedef std::vector<char> buffer_type;
- typedef ::cgi::common::map map_type;
+ typedef common::map map_type;
+ typedef common::form_part::string_type string_type;
+ typedef common::form_part::buffer_type buffer_type;
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+ /// The context used for parsing.
+ struct context
+ {
+ string_type& content_type;
+ buffer_type& buffer;
+ std::size_t& bytes_left;
+ common::post_map& data_map;
+ common::upload_map& uploads_map;
+ const callback_type callback;
+ bool& stdin_parsed;
+ // A random string, used for marking uploaded files.
+ // Set this to something like the user's REMOTE_ADDR.
+ string_type random_string;
+ std::size_t offset;
+
+ buffer_type::iterator pos;
+ string_type boundary_marker;
+ std::list<string_type> boundary_markers;
+ };
+
+ form_parser() : context_(NULL) {}
/*
- form_parser();
- form_parser(callback_type const& callback);
-*/
form_parser(
buffer_type&, common::post_map&, string_type const&
, callback_type const&, std::size_t&, bool&);
+*/
- std::string buffer_string()
+ string_type buffer_string()
{
- return std::string(buffer_.begin() + offset_, buffer_.end());
+ return string_type(context_->buffer.begin() + context_->offset
+ , context_->buffer.end());
}
+ /// Run the parser on the given `context`.
boost::system::error_code
- parse(boost::system::error_code& ec);
+ parse(context ctx, boost::system::error_code& ec);
+ /// URL-encoded forms.
+ /**
+ * Parse forms where the content-type is "application/www-url-encoded".
+ */
boost::system::error_code
parse_url_encoded_form(boost::system::error_code& ec);
+ /// Parse a multipart form.
+ /**
+ * Parse forms where the content-type is "multipart/form-data".
+ */
boost::system::error_code
parse_multipart_form(boost::system::error_code& ec);
+ /// Parse a single form part.
boost::system::error_code
parse_form_part(boost::system::error_code& ec);
- boost::system::error_code
- parse_form_part_data(boost::system::error_code& ec);
-
- boost::system::error_code
- parse_form_part_meta_data(boost::system::error_code& ec);
-
+ /// Erase any front-cruft on the form data.
+ /**
+ * In multipart forms, any characters that precede the first form
+ * boundary are ignored. This function erases those characters.
+ */
boost::system::error_code
move_to_start_of_first_part(boost::system::error_code& ec);
@@ -81,26 +147,13 @@
boost::system::error_code
parse_boundary_marker(boost::system::error_code& ec);
- //private:
- public:
- string_type const& content_type_;
- buffer_type& buffer_;
- std::size_t& bytes_left_;
- buffer_type::iterator pos_;
- //bool& stdin_data_read_;
- common::post_map& data_map_;
-
- std::string boundary_marker;
- std::list<std::string> boundary_markers;
- std::vector<common::form_part> form_parts_;
-
- const callback_type callback_;
- bool& stdin_parsed_;
- std::size_t offset_;
+private:
+ context* context_;
};
- } // namespace detail
-} // namespace cgi
+ } // namespace common
+
+BOOST_CGI_NAMESPACE_END
//#ifndef BOOST_CGI_BUILD_LIB
# include "boost/cgi/impl/form_parser.ipp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_part.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_part.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/form_part.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -3,15 +3,21 @@
#include <map>
#include <vector>
+#include <string>
#include <boost/range.hpp>
+#include <boost/filesystem.hpp>
+#include "boost/cgi/config.hpp"
+#include "boost/cgi/common/name.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
struct form_part
{
- typedef std::vector<char> 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
@@ -20,36 +26,75 @@
typedef std::pair<iter_t, iter_t> pair_t;
typedef std::map<
- std::string, pair_t
+ string_type, pair_t
> meta_data_map_type;
-
- form_part()
+
+ ~form_part()
{
+ /*
+ try {
+ // Delete any file saved in uploading this.
+ namespace fs = boost::filesystem;
+ if (!path.empty() && fs::exists(path)) {
+#ifndef NDEBUG
+ std::cerr<< "Removing file: " << path << std::endl;
+#endif // NDEBUG
+ fs::remove(path);
+ }
+ } catch(...) {
+ // pass
+ }
+ */
}
-
+
meta_data_map_type meta_data_;
/// The boundary marker that's needed.
// If this is empty, it means the corresponding data has been read.
- std::string boundary_marker_;
+ string_type boundary_marker_;
//range_type buffer_;
pair_t buffer_;
- std::string content_type; // must exist
- std::string name; // must exist (?) **FIXME**
-
- // 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).
- //std::map<std::string, std::string> meta_data_;
-
- // Boolean to show if the form part has been completely read/parsed
- //bool finished_;
+ 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 file uploads.
+ boost::filesystem::path filename;
+ // Where the actual uploaded file is stored.
+ boost::filesystem::path 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);
};
+ 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
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // BOOST_CGI_FORM_PART_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/header.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,8 +11,9 @@
#include <string>
#include <boost/lexical_cast.hpp>
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<typename CharT> struct basic_header;
@@ -47,14 +48,38 @@
{
}
+ /*
/// Construct an header from a cookie.
basic_header(const basic_cookie<char_type>& ck)
: content("Set-cookie: " + ck.to_string())
{
}
+ */
+
+ operator string_type () {
+ return content + "\r\n";
+ }
+
+// const_buffer_type data() {
+// return boost::asio::buffer(
+// }
string_type content;
};
+
+ template<typename CharT>
+ struct charset_header
+ {
+ typedef CharT char_type;
+ typedef typename std::basic_string<CharT> string_type;
+
+ charset_header(const string_type& _content)
+ : content(_content)
+ {
+ }
+
+ string_type content;
+ };
/*
template<typename StringT>
@@ -72,8 +97,13 @@
//{ Some shortcuts, to cut down on typing errors.
- template<typename CharT, typename StringT> basic_header<CharT>
- content_type(StringT const& str)
+ template<
+ typename CharT
+ , typename Traits
+ , typename Alloc
+ >
+ basic_header<CharT>
+ content_type(std::basic_string<CharT,Traits,Alloc> const& str)
{
return basic_header<CharT>("Content-type", str);
}
@@ -84,14 +114,20 @@
return basic_header<CharT>("Content-type", str);
}
+ template<typename CharT> charset_header<CharT>
+ charset(const CharT* str)
+ {
+ return charset_header<CharT>(str);
+ }
+
template<typename CharT> basic_header<CharT>
content_encoding(std::basic_string<CharT> const& str)
{
return basic_header<CharT>("Content-encoding", str);
}
- template<typename CharT, typename T> basic_header<CharT>
- content_length(const T& t)
+ template<typename CharT> basic_header<CharT>
+ content_length(const CharT * t)
{
return basic_header<CharT>("Content-length",
boost::lexical_cast<std::basic_string<CharT> >(t));
@@ -137,7 +173,7 @@
//}
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_HEADER_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/io_service_provider.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -19,8 +19,9 @@
///////////////////////////////////////////////////////////
#include "boost/cgi/import/io_service.hpp"
#include "boost/cgi/fwd/io_service_provider_fwd.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/// Hold a set number of io_services and return them based on the Policy
@@ -53,7 +54,7 @@
{
}
- ::cgi::common::io_service&
+ ::BOOST_CGI_NAMESPACE::common::io_service&
get_io_service()
{
return io_service_;
@@ -74,7 +75,7 @@
io_service_.reset();
}
private:
- ::cgi::common::io_service io_service_;
+ ::BOOST_CGI_NAMESPACE::common::io_service io_service_;
};
@@ -83,7 +84,7 @@
class io_service_provider<tags::service_pool>
{
public:
- typedef std::list<cgi::io_service> impl_type;
+ typedef std::list<BOOST_CGI_NAMESPACE::io_service> impl_type;
io_service_provider(int pool_size)
: io_services_(pool_size)
@@ -91,7 +92,7 @@
{
}
- cgi::io_service& io_service()
+ BOOST_CGI_NAMESPACE::io_service& io_service()
{
return boost::ref(*current_++);
}
@@ -99,19 +100,19 @@
void run()
{
std::for_each(io_services_.begin(), io_services_.end()
- , boost::bind(&cgi::io_service::run, boost::ref(_1)));
+ , boost::bind(&BOOST_CGI_NAMESPACE::io_service::run, boost::ref(_1)));
}
void stop()
{
std::for_each(io_services_.begin(), io_services_.end()
- , boost::bind(&cgi::io_service::stop, boost::ref(_1)));
+ , boost::bind(&BOOST_CGI_NAMESPACE::io_service::stop, boost::ref(_1)));
}
void reset()
{
std::for_each(io_services_.begin(), io_services_.end()
- , boost::bind(&cgi::io_service::reset, boost::ref(_1)));
+ , boost::bind(&BOOST_CGI_NAMESPACE::io_service::reset, boost::ref(_1)));
}
impl_type& impl()
@@ -269,7 +270,7 @@
// **FIXME**
using common::io_service_provider;
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/is_async.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/is_async.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/is_async.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,8 +12,9 @@
#include <boost/mpl/bool.hpp>
///////////////////////////////////////////////////////////
#include "boost/cgi/common/tags.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<typename Protocol>
@@ -31,7 +32,7 @@
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_COMMON_IS_ASYNC_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/map.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/map.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/map.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -3,20 +3,44 @@
#include <map>
#include "boost/cgi/common/name.hpp"
+#include "boost/cgi/common/cookie.hpp"
+#include "boost/cgi/common/form_part.hpp"
-namespace cgi {
+/// You can define your
+#ifndef BOOST_CGI_SESSION_MAP_TYPE
+# define BOOST_CGI_SESSION_MAP_TYPE map
+#endif // BOOST_CGI_SESSION_MAP_TYPE
+
+#include "boost/cgi/config.hpp"
+
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- typedef std::map< ::cgi::common::name, std::string> map;
+ typedef std::map< ::BOOST_CGI_NAMESPACE::common::name, std::string> map;
+ typedef std::multimap< ::BOOST_CGI_NAMESPACE::common::name, std::string> multimap;
+ /**
+ * If you want to add a new data type to a request you need to:
+ * > Update this file
+ * > Update source_enums.hpp
+ * > Update `data_map_type` in the `request_base` class
+ */
typedef map env_map;
typedef map get_map;
typedef map post_map;
typedef map form_map;
- typedef map cookie_map;
+ typedef std::map<
+ ::BOOST_CGI_NAMESPACE::common::name,
+ ::BOOST_CGI_NAMESPACE::common::cookie
+ > cookie_map;
+ typedef std::map<
+ ::BOOST_CGI_NAMESPACE::common::name,
+ ::BOOST_CGI_NAMESPACE::common::form_part
+ > upload_map;
+ typedef map session_map;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // BOOST_CGI_COMMON_MAP_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/name.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/name.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/name.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -14,11 +14,12 @@
#define BOOST_CGI_COMMON_NAME_HPP_INCLUDED__
#include <string>
-#include <ostream>
+//#include <ostream>
#include <cstdlib>
#include <ctype.h>
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template <typename CharT>
@@ -61,7 +62,7 @@
};
- // typedef for typical usage.
+ // typedefs for typical usage.
typedef std::basic_string<char, ichar_traits<char> > name;
typedef std::basic_string<wchar_t, ichar_traits<wchar_t> > wname;
@@ -72,10 +73,10 @@
, std::basic_string<CharT, ichar_traits<CharT> > const& str)
{
return os<< str.c_str();
- }
+ }
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // BOOST_CGI_COMMON_NAME_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/parse_options.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/parse_options.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/parse_options.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -1,23 +1,33 @@
#ifndef BOOST_CGI_COMMON_PARSE_OPTIONS_HPP_INCLUDED_
#define BOOST_CGI_COMMON_PARSE_OPTIONS_HPP_INCLUDED_
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
+ // Parser options for loading requests. Note that you should *always*
+ // parse the environment before using a request object. If you don't parse
+ // anything you will have unspecified behaviour.
enum parse_options
{
- parse_none = 0 // you should *always* parse the environment.
- , 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_form_only = parse_get_only | parse_post_only
+ , parse_cookie_only = 8
+ , parse_cookie = parse_cookie_only | parse_env
+ , parse_cookies_only = parse_cookie_only
+ , parse_cookies = parse_cookies_only | parse_env
+ , parse_all = parse_env | parse_form | parse_cookie
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // BOOST_CGI_COMMON_PARSE_OPTIONS_HPP_INCLUDED_
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-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -7,36 +7,78 @@
#include <boost/algorithm/string/classification.hpp>
///////////////////////////////////////////////////////////
#include "boost/cgi/fwd/basic_request_fwd.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
-
- struct path_info
- {
- typedef std::string value_type;
- typedef std::vector<value_type> vector_type;
- typedef vector_type::iterator iterator;
-
- template<typename S, typename P, typename A>
- path_info(basic_request<S,P,A> & request)
- : value(boost::algorithm::trim_copy_if(request["path_info"],
- boost::algorithm::is_any_of("/")))
- {
- boost::algorithm::split(parts, value, boost::algorithm::is_any_of("/"));
- }
-
- path_info(value_type const& str)
- : value(boost::algorithm::trim_copy_if(str, boost::algorithm::is_any_of("/")))
- {
- boost::algorithm::split(parts, value, boost::algorithm::is_any_of("/"));
- }
-
- 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
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // BOOST_CGI_COMMON_PATH_INFO_HPP_INCLUDED_
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_acceptor_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_acceptor_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_acceptor_service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,8 +12,9 @@
#include "boost/cgi/detail/throw_error.hpp"
#include "boost/cgi/detail/service_base.hpp"
#include "boost/cgi/detail/protocol_traits.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
template<typename Protocol>
class request_acceptor_service
@@ -96,6 +97,6 @@
// basic_protocol_service<protocol_type>& pservice_;
};
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_REQUEST_ACCEPTOR_SERVICE_HPP_INCLUDED
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-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -17,12 +17,19 @@
////////////////////////////////////////////////////////////////
#include <boost/asio/buffer.hpp>
#include <boost/system/error_code.hpp>
+#include <boost/algorithm/string/find.hpp>
+#include <boost/fusion/include/vector.hpp>
////////////////////////////////////////////////////////////////
#include "boost/cgi/common/map.hpp"
+#include "boost/cgi/common/form_part.hpp"
#include "boost/cgi/common/parse_options.hpp"
+#include "boost/cgi/common/request_status.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"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/// ABC that defines the common interface for basic_request<>s
@@ -30,44 +37,146 @@
* 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>
- int request_id(ImplType& impl)
- {
- return impl.client_.request_id_;
- }
-
+ protected:
// impl_base is the common base class for all request types'
// 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 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
+ * > Add a member variable to basic_request<>
+ */
typedef boost::fusion::vector<
common::env_map, common::get_map
, common::post_map, common::cookie_map
+ , common::upload_map, common::session_map
> var_map_type;
-
- var_map_type vars_;
- buffer_type post_buffer_;
+
+ /// Construct.
+ impl_base()
+ : service_(NULL)
+ , vars_(), post_buffer_()
+ , stdin_parsed_(false)
+ , all_done_(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() const { return request_status_; }
+ void status(common::request_status& st) { request_status_ = st; }
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);
}
+
+ protocol_service_type* service_;
+
+ var_map_type vars_;
+ buffer_type post_buffer_;
+ /// Whether the post data has been parsed yet.
+ bool stdin_parsed_;
+
+ bool all_done_;
+
+ // 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_;
};
-
+
+ template<typename ImplType, typename Service>
+ struct callback_functor
+ {
+ callback_functor(ImplType& impl, Service* service)
+ : impl_(impl)
+ , service_(service)
+ {
+ }
+
+ std::size_t operator()(boost::system::error_code& ec)
+ {
+ return service_->read_some(impl_, ec);
+ }
+
+ private:
+ ImplType& impl_;
+ Service* service_;
+ };
+
+ public:
+
+ /// Get the request ID of a FastCGI request, or 1.
+ template<typename ImplType>
+ boost::uint16_t const& request_id(ImplType& impl) const
+ {
+ return impl.client_.request_id();
+ }
+
+ /// 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.
+ */
+ template<typename ImplType>
+ 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);
+ }
+
/// Read some data into the internal buffer.
template<typename ImplType>
std::size_t
@@ -85,6 +194,52 @@
return impl.client_.read_some(buf,ec);
}
+ template<typename ImplType>
+ void destroy(ImplType& impl)
+ {
+ }
+
+ /// Return the connection associated with the request
+ template<typename ImplType>
+ typename ImplType::client_type&
+ client(ImplType& impl)
+ {
+ return impl.client_;
+ }
+
+ template<typename ImplType>
+ void set_service(
+ ImplType& impl,
+ typename ImplType::protocol_service_type& ps
+ )
+ {
+ impl.service_ = &ps;
+ }
+
+ /// Get the request status.
+ template<typename ImplType>
+ common::request_status status(ImplType& impl) const
+ {
+ return impl.status();
+ }
+
+ /// Set the request status.
+ template<typename ImplType>
+ void status(ImplType& impl, common::request_status status)
+ {
+ impl.status(status);
+ }
+
+ /// Return if the request is still open.
+ template<typename ImplType>
+ bool is_open(ImplType& impl)
+ {
+ return !impl.all_done_
+ && impl.status() >= common::accepted
+ && impl.status() <= common::aborted
+ && impl.client_.is_open();
+ }
+
/// Synchronously read/parse the request meta-data
template<typename ImplType>
boost::system::error_code
@@ -98,30 +253,35 @@
}
std::string const& cl = env_vars(impl.vars_)["CONTENT_LENGTH"];
- impl.characters_left_ = cl.empty() ? 0 : boost::lexical_cast<std::size_t>(cl);
- impl.client_.bytes_left() = impl.characters_left_;
-
- std::string const& request_method = env_vars(impl.vars_)["REQUEST_METHOD"];
-
- if (request_method == "GET" && parse_opts & common::parse_get)
+ // This will throw if the content-length isn't a valid number
+ // (which shouldn't ever happen).
+ impl.bytes_left_
+ = cl.empty() ? 0 : boost::lexical_cast<std::size_t>(cl);
+ impl.client_.bytes_left() = impl.bytes_left_;
+
+ // We could check the request method to determine if the query string
+ // should be parsed, but it is useful to always parse it. AFAIK this is
+ // portable.
+ if (parse_opts & common::parse_get_only)
{
- parse_get_vars(impl, ec);
+ if (!parse_get_vars(impl, ec))
+ return ec;
}
- else
- if (request_method == "POST" && parse_opts & common::parse_post)
+
+ if (env_vars(impl.vars_)["REQUEST_METHOD"] == "POST"
+ && parse_opts & common::parse_post_only)
{
- parse_post_vars(impl, ec);
+ if (!parse_post_vars(impl, ec))
+ return ec;
}
- if (ec) return ec;
-
- if (parse_opts & common::parse_cookie)
+ if (parse_opts & common::parse_cookies_only)
{
if (!parse_cookie_vars(impl, ec)) // returns an error_code
return ec;
}
- set_status(impl, common::loaded);
+ status(impl, common::loaded);
return ec;
}
@@ -133,14 +293,16 @@
{
// Make sure the request is in a pre-loaded state
//BOOST_ASSERT (impl.status() <= unloaded);
-
- std::string const& vars (env_vars(impl.vars_)["QUERY_STRING"]);
- if (!vars.empty())
- detail::extract_params(vars, get_vars(impl.vars_)
- , boost::char_separator<char>
- ("", "=&", boost::keep_empty_tokens)
- , ec);
-
+ if (!(status(impl) & common::get_read))
+ {
+ std::string const& vars (env_vars(impl.vars_)["QUERY_STRING"]);
+ if (!vars.empty())
+ detail::extract_params(vars, get_vars(impl.vars_)
+ , boost::char_separator<char>
+ ("", "=&", boost::keep_empty_tokens)
+ , ec);
+ status(impl, (common::request_status)(status(impl) | common::get_read));
+ }
return ec;
}
@@ -151,20 +313,53 @@
{
// Make sure the request is in a pre-loaded state
//BOOST_ASSERT (impl.status() <= unloaded);
-
- std::string const& vars (env_vars(impl.vars_)["HTTP_COOKIE"]);
- if (!vars.empty())
- detail::extract_params(vars, cookie_vars(impl.vars_)
- , boost::char_separator<char>
- ("", "=;", boost::keep_empty_tokens)
- , ec);
-
+ if (!(status(impl) & common::cookies_read))
+ {
+ std::string const& vars (env_vars(impl.vars_)["HTTP_COOKIE"]);
+ if (!vars.empty())
+ detail::extract_params(vars, cookie_vars(impl.vars_)
+ , boost::char_separator<char>
+ ("", "=;", boost::keep_empty_tokens)
+ , ec);
+ status(impl, (common::request_status)(status(impl) | common::cookies_read));
+ }
+ return ec;
+ }
+
+ /// Read and parse the cgi POST meta variables.
+ template<typename ImplType, typename Callback>
+ boost::system::error_code&
+ parse_post_vars(ImplType& impl, Callback callback, boost::system::error_code& ec)
+ {
+ if (!(status(impl) & common::post_read))
+ {
+ if (!impl.fp_)
+ // Construct a form_parser instance.
+ impl.fp_.reset(new typename ImplType::form_parser_type());
+
+ // Create a context for this request.
+ typename ImplType::form_parser_type::context
+ context
+ = { env_vars(impl.vars_)["CONTENT_TYPE"]
+ , impl.post_buffer_
+ , impl.client_.bytes_left_
+ , post_vars(impl.vars_)
+ , upload_vars(impl.vars_)
+ , callback
+ , impl.stdin_parsed_
+ , env_vars(impl.vars_)["REMOTE_ADDR"]
+ };
+
+ // Parse the current request.
+ impl.fp_->parse(context, ec);
+ status(impl, (common::request_status)(status(impl) | common::post_read));
+ }
return ec;
}
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_COMMON_REQUEST_BASE_HPP_INCLUDE_
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -17,8 +17,9 @@
#include "boost/cgi/detail/service_base.hpp"
#include "boost/cgi/detail/protocol_traits.hpp"
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/// The generic service class for basic_request<>s
@@ -44,13 +45,7 @@
typedef Protocol protocol_type;
typedef common::basic_protocol_service<Protocol> protocol_service_type;
- /// The unique service identifier
- //static boost::asio::io_service::id id;
- //explicit request_service()
- //{
- //}
-
- request_service(::cgi::common::io_service& ios)
+ request_service(::BOOST_CGI_NAMESPACE::common::io_service& ios)
: detail::service_base<request_service<Protocol> >(ios)
, service_impl_(boost::asio::use_service<service_impl_type>(ios))
{
@@ -123,7 +118,6 @@
{
return service_impl_.read_some(impl, buf, ec);
}
-*/
std::string
GET(impl_type& impl, const std::string& name
, boost::system::error_code& ec)
@@ -145,6 +139,7 @@
return service_impl_.cookie(impl, name, ec);
}
+*/
/*
std::string
header(impl_type& impl, const std::string& name
@@ -159,7 +154,7 @@
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_status.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_status.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/request_status.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -8,22 +8,29 @@
////////////////////////////////////////////////////////////////
#ifndef CGI_COMMON_REQUEST_STATUS_HPP_INCLUDED__
#define CGI_COMMON_REQUEST_STATUS_HPP_INCLUDED__
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
enum request_status
- { null
- , unloaded
- , activated
- , loaded
- , ok = loaded
+ { null = 0
+ , unloaded = null
+ , activated = 1
+ , accepted = activated
+ , begin_request_found = 2
+ , env_read = 4
+ , get_read = 8
+ , post_read = 16
+ , cookies_read = 32
+ , loaded = 64
+ , ok = loaded
, aborted
, closed
};
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_COMMON_REQUEST_STATUS_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/response.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -23,19 +23,20 @@
#include "boost/cgi/import/streambuf.hpp"
#include "boost/cgi/detail/throw_error.hpp"
#include "boost/cgi/fwd/basic_request_fwd.hpp"
+#include "boost/cgi/config.hpp"
-
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/// The response class: a helper for responding to requests.
- template<typename T>
+ template<typename CharT>
class basic_response
{
public:
- 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);
@@ -44,13 +45,13 @@
* Takes the buffer and uses it internally, does nothing with it on
* destruction.
*/
- basic_response(::cgi::common::streambuf* buf,
+ basic_response(::BOOST_CGI_NAMESPACE::common::streambuf* buf,
common::http::status_code sc = common::http::ok);
~basic_response();
/// Clear the response buffer.
- void clear();
+ void clear(bool clear_headers = true);
/// Return the response to the 'just constructed' state.
void reset();
@@ -122,28 +123,59 @@
/// Set the status code associated with the response.
basic_response<char_type>&
- set_status(const http::status_code& num);
+ status(const http::status_code& num);
/// Get the status code associated with the response.
- http::status_code& status();
+ http::status_code status() const;
/// Allow more headers to be added (WARNING: avoid using this).
void unterminate_headers();
- /// Get the length of the body of the response
+ /// Get the length of the body of the response (ie. not including the headers).
std::size_t content_length();
/// Add a header after appending the CRLF sequence.
basic_response<char_type>&
- set_header(const string_type& value);
+ set(basic_header<char_type> const& hdr)
+ {
+ if (hdr.content.empty())
+ end_headers();
+ else
+ set_header(hdr.content);
+ return *this;
+ }
+ basic_response<char_type>&
+ set(const basic_cookie<char_type>& ck)
+ {
+ set_header("Set-Cookie", ck.to_string());
+ return *this;
+ }
+
+ basic_response<char_type>&
+ set_header(const string_type& value);
+
/// Format and add a header given name and value, appending CRLF.
basic_response<char_type>&
set_header(string_type const& name, string_type const& value);
-
+
+ /// Get the contents of the response as a string.
+ /**
+ * This copies the contents of the response into a string.
+ * Headers aren't included in the dump unless `include_header` is true.
+ */
+ string_type str(bool include_header = false) const;
+
+ string_type header_value(string_type const& name);
+
void clear_headers();
void reset_headers();
+
+ /// Get the charset.
+ string_type& charset() const { return charset_; }
+ /// Set the charset.
+ void charset(string_type const& cs) { charset_ = cs; }
bool headers_terminated() const;
@@ -152,10 +184,61 @@
/// Get the ostream containing the response body.
ostream_type& ostream();
+
+ /// Get the headers
+ std::vector<string_type>& headers();
+
+ template<typename T>
+ self_type& operator<<(T t)
+ {
+ ostream_<< t;
+ return *this;
+ }
+
+ self_type& operator<< (charset_header<char_type> const& hdr)
+ {
+ charset(hdr.content);
+ return *this;
+ }
+
+ self_type& operator<< (basic_header<char_type> const& hdr)
+ {
+ return set(hdr);
+ }
+
+ self_type& operator<< (basic_cookie<char_type> const& ck)
+ {
+ return set(ck);
+ }
+
+ self_type& operator<< (http::status_code stat)
+ {
+ status(stat);
+ return *this;
+ }
+
+ self_type& operator<< (self_type& other)
+ {
+ if (!headers_terminated())
+ {
+ typedef std::vector<std::string>::const_iterator iter_t;
+ for(iter_t iter (other.headers().begin()), end (other.headers().end());
+ iter != end;
+ ++iter
+ )
+ {
+ if (iter->substr(0,13) != "Content-type:") // Don't overwrite the content-type.
+ headers_.push_back(*iter);
+ }
+ }
+ ostream_<< other.ostream().rdbuf();
+ return *this;
+ }
+
protected:
- // Vector of all the headers, each followed by a CRLF
+ // Vector of all the headers, each followed by a CRLF
std::vector<string_type> headers_;
-
+
// The buffer is a shared_ptr, so you can keep it cached elsewhere.
boost::shared_ptr<common::streambuf> buffer_;
@@ -163,10 +246,12 @@
http::status_code http_status_;
- // True if no more headers can be appended.
+ // True if no more headers can be appended.
bool headers_terminated_;
- private:
+ string_type charset_;
+
+ private:
// Send the response headers and mark that they've been sent.
template<typename ConstBufferSequence>
void prepare_headers(ConstBufferSequence& headers);
@@ -174,22 +259,20 @@
/// Typedefs for typical usage.
typedef basic_response<char> response;
- typedef basic_response<wchar_t> wresponse; // **FIXME** (untested)
+ typedef basic_response<wchar_t> wresponse; // **TODO** (untested)
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
- /// Generic ostream template
- template<typename CharT, typename T>
- cgi::common::basic_response<CharT>&
- operator<< (cgi::common::basic_response<CharT>& resp, const T& t);
- template<typename CharT>
- cgi::common::basic_response<CharT>&
- operator<< (cgi::common::basic_response<CharT>& resp
- , cgi::common::basic_header<CharT> const& hdr);
- /// You can stream a cgi::cookie into a response.
+ /// Generic ostream template
+ /*
+ template<typename CharT, typename T>
+ BOOST_CGI_NAMESPACE::common::basic_response<CharT>&
+ operator<< (BOOST_CGI_NAMESPACE::common::basic_response<CharT>& resp, T t);
+ */
+ /// You can stream a BOOST_CGI_NAMESPACE::cookie into a response.
/**
* This is just a shorthand way of setting a header that will set a
* client-side cookie.
@@ -200,20 +283,17 @@
* http://tinyurl.com/33znkj), but this is outside the scope of this
* library.
*/
- template<typename charT, typename T>
- cgi::common::basic_response<charT>&
- operator<< (cgi::common::basic_response<charT>&
- , cgi::common::basic_cookie<T>&);
-
- template<typename charT, typename T>
- cgi::common::basic_response<charT>&
- operator<< (cgi::common::basic_response<charT>&
- , cgi::common::http::status_code);
-
+
+ /*
+ template<typename charT>
+ BOOST_CGI_NAMESPACE::common::basic_response<charT>&
+ operator<< (BOOST_CGI_NAMESPACE::common::basic_response<charT>&
+ , BOOST_CGI_NAMESPACE::common::basic_cookie<charT>);
+ */
#include "boost/cgi/detail/pop_options.hpp"
-//#if !defined(BOOST_CGI_BUILD_LIB)
+#if !defined(BOOST_CGI_BUILD_LIB)
# include "boost/cgi/impl/response.ipp"
-//#endif
+#endif
#endif // CGI_RESPONSE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/return.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/return.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/return.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -20,25 +20,26 @@
#include "boost/cgi/common/response.hpp"
#include "boost/cgi/basic_request.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<typename Response, typename Request>
boost::system::error_code
- return_helper(Response& resp, Request& req, int program_status)
+ return_helper(Response& response, Request& request, int program_status)
{
boost::system::error_code ec;
- resp.send(req.client(), ec);
+ response.send(request.client(), ec);
if (ec) return ec;
- req.close(resp.status(), program_status);
+ request.close(response.status(), program_status);
return ec;
}
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
/// If an error occurs during the sending or closing then `status` will be
// incremented by the value of this macro.
@@ -46,18 +47,18 @@
# define BOOST_CGI_RETURN_ERROR_INCREMENT 100
#endif
-#define BOOST_CGI_RETURN(resp, req, status) \
- if ( ::cgi::common::return_helper(resp, req, status)) \
- /** error **/ \
- return status + BOOST_CGI_RETURN_ERROR_INCREMENT; \
+#define BOOST_CGI_RETURN(response, request, status) \
+ if ( ::BOOST_CGI_NAMESPACE::common::return_helper(response, request, status)) \
+ /** error **/ \
+ return status + BOOST_CGI_RETURN_ERROR_INCREMENT; \
return status;
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
-#define return_(resp, req, status) BOOST_CGI_RETURN(resp, req, status)
+#define return_(response, request, status) BOOST_CGI_RETURN(response, request, status)
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_RETURN_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/role_type.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/role_type.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/role_type.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -1,8 +1,10 @@
#ifndef CGI_ROLE_TYPE_HPP_INCLUDED__
#define CGI_ROLE_TYPE_HPP_INCLUDED__
+#include "boost/cgi/config.hpp"
-namespace cgi {
- namespace role {
+BOOST_CGI_NAMESPACE_BEGIN
+ namespace common {
+ namespace role {
struct responder {};
struct authorizer {};
@@ -17,6 +19,7 @@
, filter
};
-} // namespace cgi
+ } // namespace common
+BOOST_CGI_NAMESPACE_END
#endif // CGI_ROLE_TYPE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/source_enums.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/source_enums.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/source_enums.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -4,28 +4,45 @@
#include <boost/fusion/include/at.hpp>
///////////////////////////////////////////////////////////
+#include "boost/cgi/config.hpp"
#include "boost/cgi/common/map.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- enum env_data_type { env, env_data };
- enum get_data_type { get, get_data };
- enum post_data_type { post, post_data };
- enum cookie_data_type { cookies, cookie_data };
- enum form_data_type { form, form_data };
+ /// Types of data sources and related enums.
+ /**
+ * Each data source is given a unique type. This is so the accessor
+ * operators on a `basic_request<>` are compile-time aliases to the
+ * internal data maps.
+ *
+ * If you want to add a new data type to a request you need to:
+ * > Update this file
+ * > Update map.hpp with a new map type
+ * > Update `data_map_type` in the `request_base` class
+ */
template<typename Impl>
- env_map& env_vars(Impl& impl) { return boost::fusion::at_c<0>(impl); }
+ env_map&
+ env_vars(Impl& impl) { return boost::fusion::at_c<0>(impl); }
template<typename Impl>
- get_map& get_vars(Impl& impl) { return boost::fusion::at_c<1>(impl); }
+ get_map&
+ get_vars(Impl& impl) { return boost::fusion::at_c<1>(impl); }
template<typename Impl>
- post_map& post_vars(Impl& impl) { return boost::fusion::at_c<2>(impl); }
+ post_map&
+ post_vars(Impl& impl) { return boost::fusion::at_c<2>(impl); }
template<typename Impl>
- cookie_map& cookie_vars(Impl& impl) { return boost::fusion::at_c<3>(impl); }
+ cookie_map&
+ cookie_vars(Impl& impl) { return boost::fusion::at_c<3>(impl); }
+ template<typename Impl>
+ upload_map&
+ upload_vars(Impl& impl) { return boost::fusion::at_c<4>(impl); }
+ template<typename Impl>
+ session_map&
+ session_vars(Impl& impl) { return boost::fusion::at_c<5>(impl); }
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // BOOST_CGI_COMMON_SOURCE_ENUMS_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/common/tags.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -13,14 +13,11 @@
#pragma once
#endif
-namespace cgi {
+#include "boost/cgi/config.hpp"
+
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- /// SCGI (note, this must be removed)
- struct scgi_{};
- /// FastCGI
- struct fcgi_{};
-
namespace tags {
// the null tag type
@@ -28,8 +25,6 @@
// protocol types
struct cgi {};
- struct async_cgi {}; // call it acgi?
- struct acgi {};
struct fcgi {};
struct scgi {};
@@ -40,6 +35,7 @@
// Connection types
struct stdio {};
+ //struct stderr {};
struct async_stdio {};
struct tcp_socket {};
// A shareable tcp_socket (ie. one that can be locked)
@@ -47,6 +43,6 @@
} // namespace tags
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_TAGS_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/async_stdio.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -18,10 +18,16 @@
#include "boost/cgi/connections/stdio.hpp"
#include "boost/cgi/import/io_service.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- // Asynchronous access to stdio
+ // Asynchronous access to stdio.
+ /**
+ * This class doesn't do real async I/O, but fakes it by posting
+ * a read / write to an io_service, which may be run in a background
+ * thread. On most systems this won't actually mean true async I/O,
+ * but this emulates it as an interim solution.
+ */
template<>
class basic_connection<tags::async_stdio>
: public basic_connection<tags::stdio>
@@ -47,7 +53,7 @@
is_open_ = false;
}
- static pointer create(::cgi::common::io_service& ios)
+ static pointer create(::BOOST_CGI_NAMESPACE::common::io_service& ios)
{
return pointer(new basic_connection<tags::async_stdio>(ios));
}
@@ -119,19 +125,15 @@
}
private:
- ::cgi::common::io_service& io_service_;
+ ::BOOST_CGI_NAMESPACE::common::io_service& io_service_;
};
- typedef basic_connection<tags::async_stdio> async_stdio_connection;
-
+ } // namespace common
- // template<typename ProtocolService = detail::async_cgi_service>
- //struct async_stdio_connection
- //{
- // typedef basic_connection<tags::async_cgi, ProtocolService> type;
- //};
+ namespace connections {
+ typedef common::basic_connection<common::tags::async_stdio> async_stdio;
+ } // namespace connections
- } // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_ASYNC_STDIO_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/shareable_tcp_socket.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -27,7 +27,7 @@
#include "boost/cgi/detail/protocol_traits.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/*** 05.02.2008 :
@@ -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 ::cgi::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;
@@ -107,7 +106,7 @@
void wait()
{
scoped_lock_type lock(mutex_);
- if (locked_ = false)
+ if (locked_ == false)
return;
condition_.wait(lock);
}
@@ -210,15 +209,14 @@
std::set<int> deletable_request_ids_;
};
- // probably deletable typedef (leaving it here to keep an open mind)
- typedef basic_connection<tags::shareable_tcp_socket> shareable_tcp_connection;
+ } // namespace common
- namespace connection {
- typedef basic_connection<tags::shareable_tcp_socket> shareable_tcp;
- } // namespace connection
+ namespace connections {
+ typedef common::basic_connection<
+ common::tags::shareable_tcp_socket> shareable_tcp;
+ } // namespace connections
- } // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/stdio.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/stdio.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/stdio.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,6 +11,11 @@
#include <cstdio>
#include <string>
+#if BOOST_WINDOWS
+# include <stdio.h> // for _setmode
+# include <io.h> // for _setmode
+# include <fcntl.h> // for _setmode
+#endif // BOOST_WINDOWS
///////////////////////////////////////////////////////////
#include <boost/system/error_code.hpp>
#include <boost/asio.hpp>
@@ -21,7 +26,7 @@
#include "boost/cgi/common/connection_base.hpp"
#include "boost/cgi/fwd/basic_connection_fwd.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<>
@@ -34,12 +39,26 @@
basic_connection()
: is_open_(true)
{
+#if BOOST_WINDOWS
+ // We have to open stdin in binary mode on windows,
+ // or "\r\n" sequences are truncated to "\n".
+ _setmode(_fileno(stdin),_O_BINARY);
+ _setmode(_fileno(stdout),_O_BINARY);
+ _setmode(_fileno(stderr),_O_BINARY);
+#endif
}
template<typename T>
basic_connection(T&)
: is_open_(true)
{
+#if BOOST_WINDOWS
+ // We have to open stdin in binary mode on windows,
+ // or "\r\n" sequences are truncated to "\n".
+ _setmode(_fileno(stdin),_O_BINARY);
+ _setmode(_fileno(stdout),_O_BINARY);
+ _setmode(_fileno(stderr),_O_BINARY);
+#endif
}
bool is_open() const
@@ -60,7 +79,7 @@
template<typename MutableBufferSequence>
std::size_t read_some(MutableBufferSequence buf
, boost::system::error_code& ec)
- {
+ {
if (std::fread(boost::asio::buffer_cast<void *>(buf)
, boost::asio::buffer_size(buf)
, 1, stdin))
@@ -69,12 +88,12 @@
}
if (std::feof(stdin))
- ec = boost::asio::error::eof;
+ ec = ::BOOST_CGI_NAMESPACE::error::eof;
else
if (std::ferror(stdin))
- ec = ::cgi::error::bad_read;
+ ec = ::BOOST_CGI_NAMESPACE::error::bad_read;
else
- ec = ::cgi::error::broken_pipe;
+ ec = ::BOOST_CGI_NAMESPACE::error::broken_pipe;
return 0;
}
@@ -83,22 +102,34 @@
std::size_t write_some(ConstBufferSequence& buf
, boost::system::error_code& ec)
{
+ ec = boost::system::error_code();
+
std::size_t bytes_transferred(0);
- for(typename ConstBufferSequence::const_iterator i = buf.begin()
- ; i != buf.end(); ++i)
+ for(typename ConstBufferSequence::const_iterator i = buf.begin(),
+ end (buf.end())
+ ; !ec && i != end; ++i)
{
std::size_t buf_len = boost::asio::buffer_size(*i);
bytes_transferred += buf_len;
- int ret( fputs(boost::asio::buffer_cast<const char*>(*i), stdout) );
- if (ret == EOF)
+ //int ret(fputs(boost::asio::buffer_cast<const char*>(*i), stdout));
+ //if (ret == EOF)
+ //{
+ // return ::BOOST_CGI_NAMESPACE::error::broken_pipe;
+ //}
+ //std::cerr<< "[buf] "
+ // << std::string(boost::asio::buffer_cast<const char*>(*i), buf_len)
+ // << std::endl;
+ if (!std::fwrite(boost::asio::buffer_cast<const void *>(*i)
+ , buf_len, 1, stdout))
{
- return ::cgi::error::broken_pipe;
+ if (std::feof(stdout))
+ ec = ::BOOST_CGI_NAMESPACE::error::eof;
+ else
+ if (std::ferror(stdout))
+ ec = ::BOOST_CGI_NAMESPACE::error::bad_write;
+ else
+ ec = ::BOOST_CGI_NAMESPACE::error::broken_pipe;
}
- //else
- //if (ret < 0)
- //{
- // return ::cgi::error::
- //std::cout.write(boost::asio::buffer_cast<const char*>(*i), buf_len);
}
return bytes_transferred;
}
@@ -107,22 +138,12 @@
bool is_open_;
};
- namespace connection {
-
- typedef basic_connection<tags::stdio> stdio;
-
- } // namespace connection
-
- // Deprecated
- typedef basic_connection<tags::stdio> stdio_connection;
+ } // namespace common
- // template<typename ProtocolService = detail::cgi_service>
- //struct stdio_connection
- //{
- // typedef basic_connection<tags::stdio, ProtocolService> type;
- //};
+ namespace connections {
+ typedef common::basic_connection<common::tags::stdio> stdio;
+ } // namespace connections
- } // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_STDIO_CONNECTION_IMPL_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/connections/tcp_socket.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -18,7 +18,7 @@
#include "boost/cgi/detail/push_options.hpp"
#include "boost/cgi/common/connection_base.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<>
@@ -95,18 +95,14 @@
private:
next_layer_type sock_;
};
+
+ } // namespace common
- namespace connection {
-
- typedef basic_connection<tags::tcp_socket> tcp;
-
- } // namespace connection
-
- // Deprecated
- typedef basic_connection<tags::tcp_socket> tcp_connection;
+ namespace connections {
+ typedef common::basic_connection<common::tags::tcp_socket> tcp;
+ } // namespace connections
- } // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/basic_sync_io_object.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/basic_sync_io_object.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/basic_sync_io_object.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,7 +11,7 @@
#include <boost/noncopyable.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
/// basic_io_object alternative when an io_service isn't used
@@ -39,7 +39,7 @@
};
} // namespace detail
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_DETAIL_BASIC_SYNC_IO_OBJECT_HPP_INCLUDED__
Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_request_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_request_impl_base.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
+++ (empty file)
@@ -1,87 +0,0 @@
-// -- cgi_request_impl_base.hpp --
-//
-// Copyright (c) Darren Garvey 2007.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-////////////////////////////////////////////////////////////////
-#ifndef CGI_CGI_REQUEST_IMPL_BASE_HPP_INCLUDED__
-#define CGI_CGI_REQUEST_IMPL_BASE_HPP_INCLUDED__
-
-#include <map>
-#include <string>
-///////////////////////////////////////////////////////////
-#include <boost/shared_ptr.hpp>
-#include <boost/noncopyable.hpp>
-#include <boost/fusion/support.hpp>
-#include <boost/fusion/include/vector.hpp>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/common/map.hpp"
-#include "boost/cgi/common/role_type.hpp"
-#include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/connections/stdio.hpp"
-#include "boost/cgi/common/request_status.hpp"
-
-namespace cgi {
- namespace detail {
-
- //Forward declaration
- template<typename T>
- class cgi_service_impl_base;
-
-
- /// Implementation for a standard CGI request
- /**
- * Note: This isn't noncopyable since there's no real reason it can't be
- * copied around. Since basic_request is noncopyable, basic copying will be
- * restricted but if someone really wants to copy the data, then they can.
- */
- template<typename Connection>
- class cgi_request_impl_base
-
- {
- public:
- typedef ::cgi::common::map map_type;
- typedef Connection connection_type;
- typedef
- common::basic_client<Connection, common::tags::acgi> client_type;
- typedef typename connection_type::pointer conn_ptr;
-
- /// Constructor
- cgi_request_impl_base()
- : stdin_parsed_(false)
- , stdin_data_read_(false)
- , stdin_bytes_left_(-1)
- , http_status_(common::http::ok)
- , request_status_(common::unloaded)
- {
- }
-
- 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_; }
- public:
- //conn_ptr connection() { return connection_; }
-
- //friend class cgi_service_impl_base<RequestImpl>;
-
- public:
- bool stdin_parsed_;
- bool stdin_data_read_;
- std::size_t stdin_bytes_left_;
- protected:
-
- common::http::status_code http_status_;
- common::request_status request_status_;
-
- conn_ptr connection_;
- };
-
- } // namespace detail
-} // namespace cgi
-
-#endif // CGI_CGI_REQUEST_IMPL_BASE_HPP_INCLUDED__
-
Deleted: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_service_impl_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/cgi_service_impl_base.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
+++ (empty file)
@@ -1,277 +0,0 @@
-// -- detail/cgi_service_impl_base.hpp --
-//
-// Copyright (c) Darren Garvey 2007-2008.
-// 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_SERVICE_IMPL_BASE_HPP_INCLUDED__
-#define CGI_CGI_SERVICE_IMPL_BASE_HPP_INCLUDED__
-
-#include "boost/cgi/detail/push_options.hpp"
-
-#include <string>
-#include <cstdlib>
-///////////////////////////////////////////////////////////
-#include <boost/bind.hpp>
-#include <boost/assert.hpp>
-#include <boost/regex.hpp>
-#include <boost/tokenizer.hpp>
-#include <boost/lexical_cast.hpp>
-#include <boost/system/error_code.hpp>
-#include <boost/algorithm/string/find.hpp>
-///////////////////////////////////////////////////////////
-#include "boost/cgi/common/map.hpp"
-#include "boost/cgi/basic_client.hpp"
-#include "boost/cgi/common/role_type.hpp"
-#include "boost/cgi/common/form_part.hpp"
-#include "boost/cgi/detail/throw_error.hpp"
-#include "boost/cgi/common/form_parser.hpp"
-#include "boost/cgi/common/request_base.hpp"
-#include "boost/cgi/common/parse_options.hpp"
-#include "boost/cgi/common/request_status.hpp"
-#include "boost/cgi/detail/extract_params.hpp"
-#include "boost/cgi/detail/save_environment.hpp"
-
-namespace cgi {
-// **FIXME** Wrong namespace (should be cgi::detail?).
-
- template<typename RequestImplType>
- class cgi_service_impl_base
- : public common::request_base<cgi_service_impl_base<RequestImplType> >//, struct cgi_service_impl_base<RequestImplType>::implementation_type >
- {
- public:
- typedef cgi_service_impl_base<RequestImplType> self_type;
- typedef common::request_base<self_type> base_type;
- typedef ::cgi::common::map map_type;
-
- struct implementation_type
- : RequestImplType
- , base_type::impl_base
- {
- typedef typename RequestImplType::client_type client_type;
- typedef detail::form_parser form_parser_type;
-
- implementation_type()
- : fp_(NULL)
- {
- }
-
- client_type client_;
-
- // The number of characters left to read (ie. "content_length - bytes_read")
- std::size_t characters_left_;
-
- boost::scoped_ptr<form_parser_type> fp_;
- };
-
- template<typename Service>
- struct callback_functor
- {
- callback_functor(implementation_type& impl, Service* service)
- : impl_(impl)
- , service_(service)
- {
- }
-
- std::size_t operator()(boost::system::error_code& ec)
- {
- return service_->read_some(impl_, ec);
- }
-
- private:
- implementation_type& impl_;
- Service* service_;
- };
-
- cgi_service_impl_base()
- {
- }
-
- template<typename T>
- cgi_service_impl_base(T&)
- {
- }
-
- typedef implementation_type impl_type;
-
- /// Return if the request is still open
- /**
- * For CGI, this always returns true. However, in the case that a
- * "Location: xxx" header is sent and the header is terminated, the
- * request can be taken to be 'closed'.
- */
- bool is_open(implementation_type& impl)
- {
- return impl.status() >= common::aborted;
- }
-
- /// Return the connection associated with the request
- typename implementation_type::client_type&
- client(implementation_type& impl)
- {
- return impl.client_;
- }
-
- int request_id(implementation_type& impl) { return 1; }
-
- // **FIXME** should return error_code
- int close(implementation_type& impl, common::http::status_code& http_s
- , int status, boost::system::error_code& ec)
- {
- impl.status() = common::closed;
- impl.http_status() = http_s;
- return status;
- }
-/*
- /// Synchronously read/parse the request meta-data
- boost::system::error_code&
- load(implementation_type& impl, common::parse_options parse_opts
- , boost::system::error_code& ec)
- {
- if (parse_opts & common::parse_env)
- {
- if (read_env_vars(impl, ec)) // returns an error_code
- return ec;
- }
-
- std::string const& cl = env_vars(impl.vars_)["CONTENT_LENGTH"];
- impl.characters_left_ = cl.empty() ? 0 : boost::lexical_cast<std::size_t>(cl);
- impl.client_.bytes_left() = impl.characters_left_;
-
- std::string const& request_method = env_vars(impl.vars_)["REQUEST_METHOD"];
-
- if (request_method == "GET" && parse_opts & common::parse_get)
- {
- parse_get_vars(impl, ec);
- }
- else
- if (request_method == "POST" && parse_opts & common::parse_post)
- {
- parse_post_vars(impl, ec);
- }
-
- if (ec) return ec;
-
- if (parse_opts & common::parse_cookie)
- {
- if (parse_cookie_vars(impl, ec)) // returns an error_code
- return ec;
- }
-
- set_status(impl, common::loaded);
-
- return ec;
- }
-*/
- /// Synchronously read/parse the request meta-data
- /**
- * @param parse_stdin if true then STDIN data is also read/parsed
- */
- boost::system::error_code&
- load(implementation_type& impl, bool parse_stdin
- , boost::system::error_code& ec)
- {
- detail::save_environment(env_vars(impl.vars_));
- std::string const& cl = env_vars(impl.vars_)["CONTENT_LENGTH"];
- impl.characters_left_ = cl.empty() ? 0 : boost::lexical_cast<std::size_t>(cl);
- impl.client_.bytes_left() = impl.characters_left_;
-
- std::string const& request_method = env_vars(impl.vars_)["REQUEST_METHOD"];
- if (request_method == "GET")
- parse_get_vars(impl, ec);
- else
- if (request_method == "POST" && parse_stdin)
- parse_post_vars(impl, ec);
-
- if (ec) return ec;
-
- parse_cookie_vars(impl, ec);
- impl.status() = common::loaded;
-
- //BOOST_ASSERT(impl.status() >= loaded);
-
- return ec;
- }
-
- role_type
- get_role(implementation_type& impl)
- {
- return responder;
- }
-
- /// Set the http status (this does nothing for aCGI)
- void set_status(implementation_type& impl, common::http::status_code&)
- {
- // **FIXME**
- }
-
- /// Set the request status
- void set_status(implementation_type& impl, common::request_status status)
- {
- impl.request_status_ = status;
- }
-
- std::size_t
- read_some(implementation_type& impl, boost::system::error_code& ec)
- {
- return impl.client_.read_some(impl.prepare(64), ec);
- }
-
- protected:
- /// Read the environment variables into an internal map.
- template<typename RequestImpl>
- boost::system::error_code
- read_env_vars(RequestImpl& impl, boost::system::error_code& ec)
- {
- detail::save_environment(env_vars(impl.vars_));
- return ec;
- }
-
- /// Read and parse the cgi POST meta variables (greedily)
- template<typename RequestImpl>
- boost::system::error_code
- parse_post_vars(RequestImpl& impl, boost::system::error_code& ec)
- {
- // Make sure this function hasn't already been called
- //BOOST_ASSERT (!impl.stdin_parsed());
-
- ;
-
- impl.fp_.reset
- (
- new typename implementation_type::form_parser_type
- ( impl.post_buffer_
- , post_vars(impl.vars_)
- , env_vars(impl.vars_)["CONTENT_TYPE"]
- , callback_functor<self_type>(impl, this)
- //boost::bind(
- //&self_type::read_some
- //& typename ::cgi::common::request_base<
- // ::cgi::cgi_service_impl_base<
- // RequestImplType
- // > >::read_some<
- // typename ::cgi::cgi_service_impl_base<
- // RequestImplType
- // >::implementation_type
- // >
- //&cgi::common::base_type::read_some<typename self_type::implementation_type>
- //, this
- //, boost::ref(impl)
- //)
- , impl.client_.bytes_left_
- , impl.stdin_parsed_
- )
- );
- impl.fp_->parse(ec);
- return ec;
- }
- };
-
-} // namespace cgi
-
-#include "boost/cgi/detail/pop_options.hpp"
-
-#endif // CGI_CGI_SERVICE_IMPL_HPP_INCLUDED__
-
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/common_headers.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -13,17 +13,20 @@
// headers can just include this after other headers.
//#include "boost/cgi/logger.hpp"
-#include "boost/cgi/common/map.hpp"
-#include "boost/cgi/import/read.hpp"
-#include "boost/cgi/import/write.hpp"
+#include "boost/cgi/config.hpp"
#include "boost/cgi/basic_request.hpp"
-#include "boost/cgi/import/buffer.hpp"
#include "boost/cgi/common/header.hpp"
-#include "boost/cgi/common/return.hpp"
+#include "boost/cgi/common/map.hpp"
+#include "boost/cgi/common/commit.hpp"
#include "boost/cgi/common/response.hpp"
-#include "boost/cgi/import/streambuf.hpp"
+#include "boost/cgi/common/source_enums.hpp"
+#include "boost/cgi/common/parse_options.hpp"
#include "boost/cgi/http/status_code.hpp"
+#include "boost/cgi/import/buffer.hpp"
#include "boost/cgi/import/io_service.hpp"
+#include "boost/cgi/import/read.hpp"
+#include "boost/cgi/import/streambuf.hpp"
+#include "boost/cgi/import/write.hpp"
#endif // CGI_DETAIL_COMMON_HEADERS_HPP_INCLUDED__
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-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -14,34 +14,41 @@
#include <boost/system/error_code.hpp>
#include "boost/cgi/detail/url_decode.hpp"
+#include "boost/cgi/common/cookie.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
- /// Extract name/value pairs from a supplied string buffer
- template<typename Map, typename Separator>
- boost::system::error_code& extract_params(const std::string& input
- , Map& destination
- , const Separator& separator
- , boost::system::error_code& ec)
+ /// Extract name/value pairs from a supplied string buffer.
+ /**
+ * Name/value pairs can be separated by either '&' or ';', and the
+ * format is: name=value
+ *
+ */
+ template<typename String, typename Map, typename Separator>
+ boost::system::error_code&
+ extract_params(const String& input
+ , Map& destination
+ , const Separator& separator
+ , boost::system::error_code& ec)
{
if( input.empty() )
return ec;// = boost::system::error_code(34, boost::system::errno_ecat);
typedef typename boost::tokenizer<Separator> tokenizer;
+ typedef typename Map::value_type value_type;
+ typedef typename Map::mapped_type mapped_type;
tokenizer toker(input, separator);
std::string name, current_token;
+ using std::make_pair;
+
for(typename tokenizer::iterator iter = toker.begin()
; iter != toker.end()
; ++iter)
{
-// if( *iter == "%" )
-// {
-// current_token += detail::url_decode( *++iter );
-// }else
if(*iter == "=")
{
name = current_token;
@@ -49,7 +56,21 @@
}else
if( *iter == "&" || *iter == ";" )
{
- destination[name.c_str()] = current_token;
+// Empty parameters (eg. `empty` in /path/to/script?empty&foo=bar) aren't
+// guaranteed by the CGI spec to be kept, but you might want to use them.
+// You just have to define `BOOST_CGI_KEEP_EMPTY_VARS` (**TODO** currently
+// on by default).
+// Note that you'll want to check that your server keeps empty query string
+// parameters.
+ mapped_type val(name.empty() ? "" : current_token);
+#if defined(BOOST_CGI_KEEP_EMPTY_VARS)
+ if (name.empty())
+ destination.insert(
+ make_pair(current_token.c_str(), val));
+ else
+#endif // BOOST_CGI_KEEP_EMPTY_VARS
+ destination.insert(
+ make_pair(name.c_str(), val));
current_token.clear();
name.clear();
}else
@@ -57,13 +78,21 @@
current_token = url_decode(*iter);
}
}
- if( !name.empty() )
- destination[name.c_str()] = current_token;
+
+ mapped_type val(name.empty() ? "" : current_token);
+ // Save the name if the last n/v pair has no value.
+ if ( !name.empty() )
+ destination.insert(make_pair(name.c_str(), val));
+#if defined(BOOST_CGI_KEEP_EMPTY_VARS)
+ else // Save the final 'toggle' - eg /path/to/script?foo=bar&toggle
+ if ( !current_token.empty() )
+ destination.insert(make_pair(current_token.c_str(), val));
+#endif
return ec;
}
} // namespace detail
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_DETAIL_EXTRACT_PARAMS_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/protocol_traits.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -16,82 +16,50 @@
#ifndef CGI_REQUEST_TRAITS_HPP_INCLUDED__
#define CGI_REQUEST_TRAITS_HPP_INCLUDED__
+#include <boost/asio/ip/tcp.hpp>
+#include <boost/none.hpp>
#include <boost/shared_ptr.hpp>
///////////////////////////////////////////////////////////
-#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/common/parse_options.hpp"
+#include "boost/cgi/common/role_type.hpp"
#include "boost/cgi/common/tags.hpp"
-#include "boost/cgi/fwd/basic_request_fwd.hpp"
+#include "boost/cgi/fcgi/specification.hpp"
+#include "boost/cgi/fwd/basic_client_fwd.hpp"
#include "boost/cgi/fwd/basic_connection_fwd.hpp"
+#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/fwd/basic_request_fwd.hpp"
+#include "boost/cgi/fwd/form_parser_fwd.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace cgi {}
- namespace acgi
- {
- //class acgi_service;
- class request_service;
- class request_impl;
- typedef common::basic_protocol_service<common::tags::acgi> service;
- typedef
- common::basic_request<
- acgi::request_service, acgi::service
- >
- request;
- }
namespace fcgi
{
- class fcgi_request_impl;
class fcgi_service_impl;
- class fcgi_gateway_impl;
- class fcgi_gateway_service;
class fcgi_request_service;
class fcgi_acceptor_service;
}
namespace scgi
{
- class scgi_request_impl;
class scgi_service_impl;
- class scgi_gateway_impl;
- class scgi_gateway_service;
class scgi_request_service;
class scgi_acceptor_service;
}
// Forward declarations
- class cgi_request_impl;
- class acgi_request_impl;
- class async_cgi_request_impl;
- class fcgi_request_impl;
-
- //template<typename>
class cgi_service_impl;
- class acgi_service_impl;
- class async_cgi_service_impl;
class fcgi_service_impl;
- class cgi_gateway_impl;
- class acgi_gateway_impl;
- class async_cgi_gateway_impl;
- class fcgi_gateway_impl;
-
- class cgi_gateway_service;
- class acgi_gateway_service;
- class async_cgi_gateway_service;
- class fcgi_gateway_service;
- template<typename> class gateway_service;
-
- class acgi_acceptor_service;
class fcgi_acceptor_service;
class cgi_request_service;
- class acgi_request_service;
class fcgi_request_service;
namespace detail {
- namespace tags = ::cgi::common::tags;
-
+ namespace tags = ::BOOST_CGI_NAMESPACE::common::tags;
+
template<typename Protocol>
struct protocol_traits
{
@@ -101,120 +69,109 @@
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::stdio> connection_type;
-// typedef cgi_gateway_impl gateway_impl_type;
-// typedef cgi_gateway_service gateway_service_impl_type;
- };
-
- template<>
- struct protocol_traits<tags::async_cgi>
- {
- typedef protocol_traits<tags::async_cgi> type;
- typedef async_cgi_request_impl impl_type;
- typedef acgi::request_service request_service_impl;
- typedef common::basic_protocol_service<
- tags::acgi
- > protocol_service_type;
- typedef common::basic_request<
- request_service_impl
- , protocol_service_type
- > request_type;
- typedef async_cgi_service_impl service_impl_type;
typedef common::basic_connection<
tags::async_stdio
> connection_type;
- typedef async_cgi_gateway_impl gateway_impl_type;
- typedef async_cgi_gateway_service gateway_service_type;
- };
-
- template<>
- struct protocol_traits<tags::acgi>
- // : protocol_traits<tags::async_cgi>
- {
- typedef protocol_traits<tags::acgi> type;
- typedef acgi::request_impl impl_type;
- typedef acgi::request_service request_service_impl;
- typedef common::basic_protocol_service<
- tags::acgi
- > protocol_service_type;
- typedef common::basic_request<
- request_service_impl
- , protocol_service_type
- > request_type;
- typedef common::basic_connection<
- tags::async_stdio
- > connection_type;
- typedef acgi_gateway_impl gateway_impl_type;
- typedef acgi_gateway_service gateway_service_type;
+ typedef common::basic_client<
+ connection_type,
+ tags::cgi
+ > client_type;
+ typedef common::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_request_service
- // ::implementation_type request_impl_type;
typedef fcgi::fcgi_service_impl service_impl_type;
typedef fcgi::fcgi_acceptor_service acceptor_service_impl;
typedef common::basic_connection<
tags::shareable_tcp_socket
> connection_type;
- //typedef fcgi_gateway_impl gateway_impl_type;
- //typedef fcgi_gateway_service gateway_service_type;
+ typedef boost::asio::ip::tcp native_protocol_type;
+ typedef boost::asio::socket_acceptor_service<
+ native_protocol_type
+ > acceptor_service_type;
+ typedef
+ acceptor_service_type::implementation_type acceptor_impl_type;
+ typedef acceptor_service_type::native_type native_type;
+ typedef unsigned short port_number_type;
+ typedef boost::asio::ip::tcp::endpoint endpoint_type;
+ typedef common::basic_client<
+ connection_type,
+ tags::fcgi
+ > client_type;
+ typedef common::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 scgi_gateway_impl gateway_impl_type;
- //typedef scgi_gateway_service gateway_service_type;
- };
+ typedef common::basic_client<
+ connection_type,
+ tags::scgi
+ > client_type;
+ typedef common::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< ::cgi::common::scgi_>
- : protocol_traits<tags::scgi>
- {
- };
-
- // **FIXME** (remove)
- template<>
- struct protocol_traits< ::cgi::common::fcgi_>
- : protocol_traits<tags::fcgi>
- {
+ static const common::parse_options parse_opts = common::parse_none;
};
} // namespace detail
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_REQUEST_TRAITS_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/push_options.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,11 +9,13 @@
//#ifdef _MSC_VER
-//#pragma warning (disable:)
-//#define _CRT_SECURE_NO_DEPRECATE 1
-//#pragma warning (disable:4996)
-
-//#endif
+// You may want to remove these.
+#if defined (BOOST_WINDOWS)
+# define _CRT_SECURE_NO_DEPRECATE 1
+# define _SCL_SECURE_NO_WARNINGS 1
+# define _CRT_SECURE_NO_WARNINGS 1
+# define NOMINMAX
+#endif // defined (BOOST_WINDOWS)
#if !defined(BOOST_CGI_INLINE)
# if defined(BOOST_CGI_BUILD_LIB)
@@ -23,3 +25,19 @@
# endif
#endif
+#ifdef BOOST_CGI_EXPORTS
+# define BOOST_CGI_API __declspec(dllexport)
+#else
+# define BOOST_CGI_API __declspec(dllimport)
+#endif // BOOST_CGI_EXPORTS
+
+/// Keep empty query string variables.
+/** Empty query string parameters (eg.
+ * `empty` in /path/to/script?empty&foo=bar)
+ * aren't guaranteed by the CGI spec to be kept, but you might want to use
+ * them. You just have to define `BOOST_CGI_KEEP_EMPTY_VARS` (**FIXME**
+ * currently on by default).
+ */
+#define BOOST_CGI_KEEP_EMPTY_VARS
+
+#include "boost/cgi/config.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/save_environment.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/save_environment.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/save_environment.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -15,7 +15,7 @@
#include "boost/cgi/common/map.hpp"
// The process' environment
-#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
+#if BOOST_WINDOWS
// MSVC warns of 'inconsistent dll linkage' here...
_CRTIMP extern char** _environ;
#else
@@ -23,27 +23,35 @@
#endif
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
/// Save all information from `environment` to env_map
/**
* @param env This defaults to `::environ`, or the current process'
* environment.
+ *
+ * Note: empty variables are not guaranteed to be set by the server, so
+ * we are free to ignore them too. Whether we do or not depends on the
+ * macro: BOOST_CGI_KEEP_EMPTY_VARS
*/
template<typename MapT>
- void save_environment(MapT& env_map, char** env =
-#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1500))
- _environ
-#else
- environ
-#endif
- )
+ void save_environment(MapT& env_map, char** env =
+ // Windows calls the environment environ_
+# if BOOST_WINDOWS
+ _environ
+# else
+ environ
+# endif
+ )
{
- std::string sa;
- std::string sb;
+
+ BOOST_ASSERT(env && "Trying to save environment, but the passed in environment is empty / invalid.");
+
+ typename MapT::key_type sa;
+ typename MapT::mapped_type sb;
- for(; *env; ++env)
+ for(; env && *env; ++env)
{
int i=0;
int j=strlen(*env);
@@ -51,43 +59,25 @@
if ((*env)[i] == '=')
break;
- // Note: empty variables are not guaranteed to be set by the server, so
- // we are free to ignore them too.
+#if defined(BOOST_CGI_KEEP_EMPTY_VARS)
+ sa.assign(*env, i);
+ if ((*env)[i+1] != '\0')
+ sb.assign((*env+i+1), j-i-1);
+ else
+ sb.clear();
+ env_map[sa] = sb;
+#else
if ((*env)[i+1] != '\0')
{
sa.assign(*env, i);
sb.assign((*env+i+1), j-i-1);
- env_map[sa.c_str()] = sb;
+ env_map[sa] = sb;
}
- }
+#endif
+ }
}
} // namespace detail
-} // namespace cgi
-
-/* Alternative version which doesn't copy the 'value' of the variable
- ******************************************************************************
- void save_environment(std::map<std::string,const char*>& env_map
- , char** env = ::environ)
- {
- for(; *env; ++env)
- {
- int i=0;
- int j=strlen(*env);
- for(; i < j; ++i)
- if ((*env)[i] == '=')
- break;
-
- // Note: empty variables are not guaranteed to be set by the server, so
- // we are free to ignore them too.
- if ((*env)[i+1] != '\0')
- {
- std::string sa(*env, i);
- env_map[sa] = (*env+i+1);
- }
- }
- }
- ******************************************************************************
- */
+BOOST_CGI_NAMESPACE_END
#endif // CGI_DETAIL_SAVE_ENVIRONMENT_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_base.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_base.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_base.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,12 +12,14 @@
#ifndef CGI_DETAIL_SERVICE_ID_HPP_INCLUDED__
#define CGI_DETAIL_SERVICE_ID_HPP_INCLUDED__
-#include <boost/asio/detail/push_options.hpp>
-
+#include <boost/noncopyable.hpp>
#include <boost/asio/io_service.hpp>
+////////////////////////////////////////////////////////////////
+#include "boost/cgi/config.hpp"
#include "boost/cgi/detail/service_id.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
+
namespace detail {
// Special service base class to keep classes header-file only.
@@ -34,13 +36,12 @@
{
}
};
-
+
template <typename Type>
boost::asio::detail::service_id<Type> service_base<Type>::id;
} // namespace detail
-} // namespace cgi
-
-#include <boost/asio/detail/pop_options.hpp>
+
+BOOST_CGI_NAMESPACE_END
#endif // CGI_DETAIL_SERVICE_ID_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_id.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_id.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/service_id.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -16,7 +16,7 @@
#include <boost/asio/io_service.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
// Special derived service id type to keep classes header-file only.
@@ -27,7 +27,7 @@
};
} // namespace detail
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include <boost/asio/detail/pop_options.hpp>
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/throw_error.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/throw_error.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/throw_error.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,8 +12,10 @@
#include <boost/system/error_code.hpp>
#include <boost/system/system_error.hpp>
#include <boost/throw_exception.hpp>
+/////////////////////////////////////////////////
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
inline void throw_error(const boost::system::error_code& ec)
@@ -21,11 +23,12 @@
if(ec)
{
boost::system::system_error err(ec);
- boost::throw_exception(err);
+ //boost::throw_exception(err);
+ throw err;
}
}
} // namespace detail
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_THROW_ERROR_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -13,7 +13,7 @@
#include <string>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
/// Convert a char into a hexadecimal value
@@ -30,7 +30,7 @@
BOOST_CGI_INLINE std::string url_decode( const std::string& str );
} // namespace detail
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#if !defined( BOOST_CGI_BUILD_LIB )
# include "boost/cgi/detail/url_decode.ipp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.ipp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/detail/url_decode.ipp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,14 +11,14 @@
#include "boost/cgi/detail/url_decode.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
/// Convert a char into a hexadecimal value
BOOST_CGI_INLINE
std::string char_to_hex(char const& ch)
{
- return std::string(); // **FIXME**
+ return std::string(); // **FIXME**
}
/// Convert two characters into a single, hex-encoded character
@@ -40,7 +40,7 @@
}
/// Take two characters (a hex sequence) and return a char
- // **DEPRECATED**
+ // **DEPRECATED** (use the above function)
BOOST_CGI_INLINE
char url_decode( const char& c1, const char& c2 )
{
@@ -64,6 +64,9 @@
typedef std::string string_type; // Ahem.
string_type result;
+ if (str.length() == 0)
+ return str;
+
for( string_type::const_iterator iter (str.begin()), end (str.end())
; iter != end; ++iter )
{
@@ -83,7 +86,7 @@
}
else // we've got a properly encoded hex value.
{
- char ch = *++iter; // need this because order of function arg
+ char ch = *++iter; // need this because order of function arg
// evaluation is UB.
result.append(1, hex_to_char(ch, *++iter));
}
@@ -97,7 +100,7 @@
}
} // namespace detail
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/error.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/error.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/error.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,7 +11,9 @@
// The errors for everything are defined in here. ie. FastCGI,
// CGI and SCGI errors.
//
-// **FIXME** This is a mess.
+// **FIXME** There should likely be a common set of errors and
+// then protocol-specific errors. So far, everything
+// is an fcgi_error, which clearly isn't right.
//
////////////////////////////////////////////////////////////////
#ifndef CGI_ERROR_HPP_INCLUDED__
@@ -19,112 +21,16 @@
#include <string>
#include <boost/system/error_code.hpp>
+#include "boost/cgi/common/error.hpp"
+#include "boost/cgi/fcgi/error.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace error {
-enum fcgi_errors
-{
- bad_header_type = 1,
-
- /// A packet arrived for a request id that doesn't exist and the packet
- // wasn't a BEGIN_REQUEST record.
- bad_request_id,
-
- /// When trying to write a packet, the client::write_some() call didn't
- // transmit enough data before returning.
- couldnt_write_complete_packet,
-
- // Tried to read/write from/to the client associated to a request when it
- // was closed.
- client_closed,
-
- // Self-explanatory (not much a user can do about this though).
- abort_request_record_recieved_for_invalid_request,
-
- // For now a user has to recognise this error and construct a request
- // themselves. This is an ugly hack.
- multiplexed_request_incoming,
-
- duplicate_request,
-
- // Calling async_accept on a request that hasn't been closed isn't
- // allowed.
- accepting_on_an_open_request,
-
- invalid_socket,
-
- // The CONTENT_TYPE for form data wasn't recognised.
- invalid_form_type,
-
- // Used in basic_connection<tags::stdio>
- // **FIXME**
- broken_pipe,
-
- // **FIXME**
- bad_read
-};
-
- namespace detail {
-
-class fcgi_category
- : public boost::system::error_category
-{
-public:
- const char* name() const { return "fcgi_error"; }
- std::string message(int e) const
- {
- switch(e)
- {
- case client_closed:
- return "You are trying to read from or write to a closed client.";
- case multiplexed_request_incoming:
- return "A new request is pending on this connection (ie. it is "
- "multiplexed). This isn't handled for now. **FIXME**";
- case accepting_on_an_open_request:
- return "You called async_accept before closing a request.";
- default:
- return "(FastCGI) BOOM!!!";
- }
- }
-};
-
- } // namespace detail
-
-inline const boost::system::error_category& get_fcgi_category()
-{
- static detail::fcgi_category instance;
- return instance;
-}
-
-static const boost::system::error_category& fcgi_category
- = ::cgi::error::get_fcgi_category();
-
- } // namespace error
-} // namespace cgi
-
-namespace boost {
- namespace system {
-
- template<> struct is_error_code_enum< ::cgi::error::fcgi_errors>
- {
- BOOST_STATIC_CONSTANT(bool, value = true);
- };
-
- } // namespace system
-} // namespace boost
-
-namespace cgi {
- namespace error {
-
- inline boost::system::error_code make_error_code(fcgi_errors e)
- {
- return boost::system::error_code(
- static_cast<int>(e), get_fcgi_category());
- }
+ using namespace ::BOOST_CGI_NAMESPACE::common::error;
} // namespace error
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_ERROR_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -10,26 +10,25 @@
#define CGI_FCGI_HPP_INCLUDED__
// #include all fcgi-related files only
-#include "boost/cgi/fcgi/service.hpp"
+#include "boost/cgi/config.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"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
- //using namespace ::cgi; // **FIXME** this must go.
- using namespace ::cgi::common; // import common elements.
+ using namespace ::BOOST_CGI_NAMESPACE::common; // import common elements.
} // namespace fcgi
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
/// Dump fcgi stuff into the boost namespace
namespace boost {
namespace fcgi {
- using namespace ::cgi::fcgi;
- } // namespace acgi
+ using namespace ::BOOST_CGI_NAMESPACE::fcgi;
+ using namespace ::BOOST_CGI_NAMESPACE::common; // import common elements.
+ } // namespace fcgi
} // namespace boost
#endif // CGI_FCGI_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,17 +12,21 @@
#include "boost/cgi/basic_request_acceptor.hpp"
#include "boost/cgi/fcgi/request_acceptor_service.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
/// Typedef for common usage (FCGI)
typedef
- ::cgi::common::basic_request_acceptor<
- fcgi_request_acceptor_service<>
- >
+ ::BOOST_CGI_NAMESPACE::common::basic_request_acceptor<
+ fcgi_request_acceptor_service<>
+ >
acceptor;
} // namespace fcgi
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
+
+namespace boost { namespace fcgi {
+ using ::BOOST_CGI_NAMESPACE::fcgi::acceptor;
+} }
#endif // CGI_FCGI_ACCEPTOR_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/acceptor_service_impl.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -13,13 +13,15 @@
#include <boost/ref.hpp>
#include <boost/bind.hpp>
-#include <boost/asio.hpp> // **FIXME**
+#include <boost/asio.hpp>
#include <boost/thread.hpp>
+#include <boost/function.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/static_assert.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/system/error_code.hpp>
///////////////////////////////////////////////////////////
+#include "boost/cgi/fcgi/error.hpp"
#include "boost/cgi/fcgi/request.hpp"
#include "boost/cgi/import/io_service.hpp"
#include "boost/cgi/detail/throw_error.hpp"
@@ -27,8 +29,8 @@
#include "boost/cgi/detail/protocol_traits.hpp"
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
-namespace cgi {
-
+BOOST_CGI_NAMESPACE_BEGIN
+
namespace detail {
/// Helper functions for async_accept operation.
@@ -54,7 +56,7 @@
typename T::implementation_type::request_type& request;
Handler handler;
};
-
+
} // namespace detail
namespace fcgi {
@@ -62,77 +64,74 @@
/// The service_impl class for FCGI basic_request_acceptor<>s
/**
* Note: this is near enough to being generic. It will hopefully translate
- * directly to the fcgi_acceptor_service_impl. In other words you would
- * then have one acceptor_service_impl<>, so you'd use
+ * directly to the fcgi_acceptor_service_impl. In other words you
+ * would then have one acceptor_service_impl<>, so you'd use
* acceptor_service_impl<scgi> acceptor_service_impl_; // and
* acceptor_service_impl<fcgi> acceptor_service_impl_; // etc...
*
- * Note: If the protocol is an asynchronous protocol, which means it requires
- * access to a boost::asio::io_service instance, then this class becomes a
- * model of the Service concept (**LINK**) and must only use the constructor
- * which takes a ProtocolService (**LINK**). If the protocol isn't async then
- * the class can be used without a ProtocolService.
+ * 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_ = ::cgi::common::fcgi_>
+ template<typename Protocol = common::tags::fcgi>
class acceptor_service_impl
- : public detail::service_base< ::cgi::fcgi::acceptor_service_impl<Protocol_> >
+ : public detail::service_base<
+ ::BOOST_CGI_NAMESPACE::fcgi::acceptor_service_impl<Protocol>
+ >
{
public:
+
+ typedef acceptor_service_impl<Protocol> self_type;
+ typedef Protocol protocol_type;
+ typedef detail::protocol_traits<Protocol> traits;
+ typedef typename traits::protocol_service_type protocol_service_type;
+ typedef typename traits::native_protocol_type native_protocol_type;
+ typedef typename traits::native_type native_type;
+ typedef typename traits::request_type request_type;
+ typedef typename traits::pointer request_ptr;
+ typedef typename traits::acceptor_service_type acceptor_service_type;
+ typedef typename traits::acceptor_impl_type acceptor_impl_type;
+ typedef typename traits::port_number_type port_number_type;
+ typedef typename traits::endpoint_type endpoint_type;
+ typedef std::pair<
+ typename std::set<request_ptr>::iterator, bool> request_iter;
+ typedef boost::function<int (request_type&)> accept_handler_type;
- /// The unique service identifier
- //static boost::asio::io_service::id id;
-
struct implementation_type
{
- typedef Protocol_ protocol_type;
- typedef common::basic_protocol_service<
- protocol_type
- > protocol_service_type;
- typedef boost::asio::ip::tcp native_protocol_type;
- typedef fcgi::request request_type;
+ typedef Protocol protocol_type;
+ typedef detail::protocol_traits<Protocol> traits;
+ typedef typename traits::protocol_service_type protocol_service_type;
+ typedef typename traits::native_protocol_type native_protocol_type;
+ typedef typename traits::request_type request_type;
typedef boost::asio::socket_acceptor_service<
native_protocol_type
> acceptor_service_type;
- typedef unsigned short port_number_type;
- typedef boost::asio::ip::tcp::endpoint endpoint_type;
- //typedef typename
- // acceptor_service_type::native_type native_type;
-
- acceptor_service_type::implementation_type acceptor_;
+ typedef typename
+ acceptor_service_type::implementation_type acceptor_impl_type;
+ typedef typename traits::port_number_type port_number_type;
+ typedef typename traits::endpoint_type endpoint_type;
+
+ acceptor_impl_type acceptor_;
boost::mutex mutex_;
std::queue<boost::shared_ptr<request_type> > waiting_requests_;
+ std::set<request_ptr> running_requests_;
protocol_service_type* service_;
port_number_type port_num_;
endpoint_type endpoint_;
- };
-
- typedef acceptor_service_impl<Protocol_> type;
- typedef typename
- type::implementation_type::protocol_type
- protocol_type;
- typedef typename
- type::implementation_type::protocol_service_type
- protocol_service_type;
- typedef typename
- type::implementation_type::acceptor_service_type
- acceptor_service_type;
- typedef typename
- type::implementation_type::native_protocol_type
- native_protocol_type;
- typedef typename
- acceptor_service_type::native_type native_type;
-
- typedef typename
- type::implementation_type::endpoint_type endpoint_type;
-
+
+ };
- explicit acceptor_service_impl(::cgi::common::io_service& ios)
- : detail::service_base< ::cgi::fcgi::acceptor_service_impl<Protocol_> >(ios)
+ explicit acceptor_service_impl(::BOOST_CGI_NAMESPACE::common::io_service& ios)
+ : detail::service_base< ::BOOST_CGI_NAMESPACE::fcgi::acceptor_service_impl<Protocol> >(ios)
, acceptor_service_(boost::asio::use_service<acceptor_service_type>(ios))
- //, endpoint(boost::asio::ip::tcp::v4())
+ , strand_(ios)
{
}
-
+
protocol_service_type&
service(implementation_type const& impl) const
{
@@ -143,25 +142,10 @@
boost::system::error_code
default_init(implementation_type& impl, boost::system::error_code& ec)
{
+ // I've never got the default initialisation working on Windows...
#if ! defined(BOOST_WINDOWS)
- //assign(impl.acceptor_, , 0, ec);
return acceptor_service_.assign(impl.acceptor_, boost::asio::ip::tcp::v4()
, 0, ec);
- #else
-//# error "Windows isn't supported at the moment"
- HANDLE hListen = INVALID_HANDLE_VALUE;
- boost::asio::detail::socket_type sock;
- struct sockaddr sa;
- int sa_len = sizeof(sa);
-#if NO_WSAACCEPT
- sock = accept((boost::asio::detail::socket_type)hListen, &sa, &sa_len);
- if (sock == INVALID_SOCKET)
- return cgi::error::invalid_socket;
-#else
- sock = WSAAccept((unsigned int)hListen, &sa, &sa_len, NULL, (DWORD)NULL);
- if (sock == INVALID_SOCKET)
- return ::cgi::error::invalid_socket;
-#endif
#endif
return ec;
}
@@ -172,7 +156,7 @@
impl.protocol_service_ = &ps;
}
- protocol_service_type&
+ protocol_service_type&
get_protocol_service(implementation_type& impl)
{
BOOST_ASSERT(impl.service_ != NULL);
@@ -182,27 +166,25 @@
void construct(implementation_type& impl)
{
acceptor_service_.construct(impl.acceptor_);
- //impl.acceptor_ptr().reset(impl::acceptor_type(this->io_service()));
}
-
+
void destroy(implementation_type& impl)
{
// close/reject all the waiting requests
- /***/
acceptor_service_.destroy(impl.acceptor_);
}
-
+
void shutdown_service()
{
acceptor_service_.shutdown_service();
}
-
+
/// Check if the given implementation is open.
bool is_open(implementation_type& impl)
{
return acceptor_service_.is_open(impl.acceptor_);
}
-
+
/// Open a new *socket* acceptor implementation.
boost::system::error_code
open(implementation_type& impl, const native_protocol_type& protocol
@@ -210,7 +192,7 @@
{
return acceptor_service_.open(impl.acceptor_, protocol, ec);
}
-
+
template<typename Endpoint>
boost::system::error_code
bind(implementation_type& impl, const Endpoint& endpoint
@@ -220,7 +202,7 @@
boost::asio::socket_base::reuse_address(true), ec);
return acceptor_service_.bind(impl.acceptor_, endpoint, ec);
}
-
+
/// Assign an existing native acceptor to a *socket* acceptor.
boost::system::error_code
assign(implementation_type& impl, const native_protocol_type& protocol
@@ -229,41 +211,140 @@
{
return acceptor_service_.assign(impl.acceptor_, protocol
, native_acceptor, ec);
- }
-
+ }
+
boost::system::error_code
listen(implementation_type& impl, int backlog, boost::system::error_code& ec)
{
return acceptor_service_.listen(impl.acceptor_, backlog, ec);
}
-
- /// Accepts one request.
- template<typename CommonGatewayRequest>
- boost::system::error_code
- accept(implementation_type& impl, CommonGatewayRequest& request
+
+ void do_accept(implementation_type& impl
+ , accept_handler_type handler)
+ {
+ request_ptr new_request;
+
+ if (impl.waiting_requests_.empty())
+ {
+ // Accepting on new request.
+ new_request = request_type::create(*impl.service_);
+ }
+ else
+ {
+ // Accepting on existing request.
+ new_request = impl.waiting_requests_.front();
+ impl.waiting_requests_.pop();
+ }
+
+ impl.running_requests_.insert(new_request);
+
+ // The waiting request may be open if it is a multiplexed request.
+ // If we can reuse this request's connection, return.
+ if (!new_request->is_open() && !new_request->client().keep_connection())
+ {
+ // ...otherwise accept a new connection.
+ //std::cerr<< "Accepting a new connection." << std::endl;
+ acceptor_service_.async_accept(impl.acceptor_,
+ new_request->client().connection()->next_layer(), 0,
+ strand_.wrap(
+ boost::bind(&self_type::handle_accept
+ , this, boost::ref(impl), new_request, handler, _1
+ )
+ )
+ );
+ }
+ else
+ {
+ //std::cerr<< "Reusing existing connection." << std::endl;
+ impl.service_->post(
+ strand_.wrap(
+ boost::bind(&self_type::handle_accept
+ , this, boost::ref(impl), new_request, handler, boost::system::error_code()
+ )
+ )
+ );
+ }
+ }
+
+ void handle_accept(
+ implementation_type& impl, request_ptr new_request,
+ accept_handler_type handler, const boost::system::error_code& ec
+ )
+ {
+ new_request->status(common::accepted);
+ int status = handler(*new_request);
+ impl.running_requests_.erase(impl.running_requests_.find(new_request));
+ if (new_request->is_open()) {
+ new_request->close(http::ok, status);
+ }
+ new_request->clear();
+ impl.waiting_requests_.push(new_request);
+ }
+
+ /// Accepts a request and runs the passed handler.
+ void async_accept(implementation_type& impl
+ , accept_handler_type handler)
+ {
+ //impl.service_->post(
+ strand_.post(
+ boost::bind(&self_type::do_accept,
+ this, boost::ref(impl), handler)
+ );
+ //);
+ }
+
+ int accept(implementation_type& impl, accept_handler_type handler
, endpoint_type* endpoint, boost::system::error_code& ec)
{
- /* THIS BIT IS BROKEN:
- *-- The noncopyable semantics of a basic_request<> don't allow the
- assignment. There are a couple of ways around this; the one that
- seems sensible is to keep the basic_request<>s noncopyable, but
- allow the actual data be copied. At the moment the actual data is
- held in a vector<string> headers container and a cgi::streambuf.
- These two bits should really be factored out into a message type.
- IOW, the message type will be copyable (but should probably have
- unique-ownership semantics).
- --*
+ typedef std::pair<std::set<request_type::pointer>::iterator, bool> pair_t;
+
+ request_ptr new_request;
+ pair_t insert_result;
+
+ if (impl.waiting_requests_.empty())
+ {
+ // Accepting on new request.
+ new_request = request_type::create(*impl.service_);
+ }
+ else
{
- boost::mutex::scoped_lock lk(impl.mutex_);
- if (!impl.waiting_requests_.empty())
+ // Accepting on existing request.
+ new_request = impl.waiting_requests_.front();
+ impl.waiting_requests_.pop();
+ }
+
+ insert_result = impl.running_requests_.insert(new_request);
+
+ // The waiting request may be open if it is a multiplexed request.
+ if (!new_request->is_open())
+ {
+ // If we can reuse this request's connection, return.
+ if (!new_request->client().keep_connection())
{
- request = *(impl.waiting_requests_.front());
- impl.waiting_requests_.pop();
- return ec;
+ // ...otherwise accept a new connection.
+ ec = acceptor_service_.accept(impl.acceptor_,
+ new_request->client().connection()->next_layer(), endpoint, ec);
}
}
- */
+ new_request->status(common::accepted);
+ int status = handler(*new_request);
+
+ impl.running_requests_.erase(insert_result.first);
+ if (new_request->is_open()) {
+ new_request->close(http::ok, status);
+ }
+ new_request->clear();
+ impl.waiting_requests_.push(new_request);
+
+ return status;
+ }
+ /// Accepts one request.
+ template<typename CommonGatewayRequest>
+ boost::system::error_code
+ accept(implementation_type& impl, CommonGatewayRequest& request
+ , endpoint_type* endpoint, boost::system::error_code& ec)
+ {
BOOST_ASSERT
( ! request.is_open()
&& "Error: Calling accept on open request (close it first?)."
@@ -275,26 +356,27 @@
{
request.clear();
}
- //request.clear(); // **FIXME** (this should be cleverer)
// If we can reuse this request's connection, return.
if (request.client().keep_connection())
return ec;
// ...otherwise accept a new connection.
- return acceptor_service_.accept(impl.acceptor_,
+ ec = acceptor_service_.accept(impl.acceptor_,
request.client().connection()->next_layer(), endpoint, ec);
+ if (!ec)
+ request.status(common::accepted);
+ return ec;
}
-
+
/// Asynchronously accepts one request.
- //template<typename CommonGatewayRequest, typename Handler>
- //void async_accept(implementation_type& impl, CommonGatewayRequest& request
template<typename Handler>
- void async_accept(implementation_type& impl, typename implementation_type::request_type& request
+ void async_accept(implementation_type& impl
+ , typename implementation_type::request_type& request
, Handler handler)
{
this->io_service().post(
- detail::accept_handler<type, Handler>(*this, impl, request, handler)
+ detail::accept_handler<self_type, Handler>(*this, impl, request, handler)
);
}
@@ -321,19 +403,24 @@
is_cgi(implementation_type& impl)
{
boost::system::error_code ec;
-#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);
- return ( ret != 0 && errno == ENOTCONN ) ? false : true;
+ socklen_t len (
+ static_cast<socklen_t>(local_endpoint(impl,ec).capacity()) );
+ int check (
+ getpeername(native(impl), local_endpoint(impl,ec).data(), &len) );
+
+ /// The FastCGI check works differently on Windows and UNIX.
+#if defined(BOOST_WINDOWS)
+ return ( check == SOCKET_ERROR &&
+ WSAGetLastError() == WSAENOTCONN ) ? false : true;
#else
- return false;
+ return ( check == -1 &&
+ errno == ENOTCONN ) ? false : true;
#endif
}
-
+
public:
template<typename CommonGatewayRequest, typename Handler>
- void check_for_waiting_request(implementation_type& impl
+ int check_for_waiting_request(implementation_type& impl
, CommonGatewayRequest& request
, Handler handler)
{
@@ -353,19 +440,20 @@
return handler(boost::system::error_code());
// ...otherwise accept a new connection (asynchronously).
- return acceptor_service_.async_accept(impl.acceptor_,
+ acceptor_service_.async_accept(impl.acceptor_,
request.client().connection()->next_layer(), 0, handler);
+ return 0;
}
-
+
public:
/// The underlying socket acceptor service.
- acceptor_service_type& acceptor_service_;
+ acceptor_service_type& acceptor_service_;
+ boost::asio::io_service::strand strand_;
};
-
+
} // namespace fcgi
-} // namespace cgi
-
+BOOST_CGI_NAMESPACE_END
+
#include "boost/cgi/detail/pop_options.hpp"
#endif // CGI_FCGI_ACCEPTOR_SERVICE_IMPL_HPP_INCLUDED__
-
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/client.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -15,318 +15,246 @@
#include <boost/logic/tribool.hpp>
#include <boost/asio/buffer.hpp>
///////////////////////////////////////////////////////////
-#include "boost/cgi/error.hpp"
+#include "boost/cgi/basic_client.hpp"
#include "boost/cgi/common/map.hpp"
#include "boost/cgi/common/tags.hpp"
+#include "boost/cgi/connections/shareable_tcp_socket.hpp"
+#include "boost/cgi/detail/throw_error.hpp"
+#include "boost/cgi/detail/protocol_traits.hpp"
+#include "boost/cgi/fcgi/specification.hpp"
+#include "boost/cgi/fwd/basic_request_fwd.hpp"
+#include "boost/cgi/error.hpp"
#include "boost/cgi/import/read.hpp"
-#include "boost/cgi/basic_client.hpp"
#include "boost/cgi/import/buffer.hpp"
#include "boost/cgi/import/io_service.hpp"
-#include "boost/cgi/fcgi/specification.hpp"
-#include "boost/cgi/detail/throw_error.hpp"
-#include "boost/cgi/fwd/basic_request_fwd.hpp"
-#include "boost/cgi/detail/protocol_traits.hpp"
-#include "boost/cgi/connections/shareable_tcp_socket.hpp"
-namespace cgi {
- namespace common {
+#undef min
+#undef max
+#include <algorithm>
+
+#ifndef NDEBUG
+# include <iostream>
+#endif
- enum client_status
- {
- none_, // **FIXME** !
- constructed,
- params_read,
- stdin_read,
- end_request_sent,
- closed_, // **FIXME** !
- //aborted
- };
+BOOST_CGI_NAMESPACE_BEGIN
+ namespace common {
/// A client that uses a TCP socket that owned by it.
- template<typename Protocol>
- class basic_client<common::shareable_tcp_connection, Protocol>
+ /// Construct
+ template<>
+ basic_client<
+ connections::shareable_tcp
+ , ::BOOST_CGI_NAMESPACE::common::tags::fcgi
+ >::basic_client()
+ : request_id_(-1)
+ , status_(none_)
+ , total_sent_bytes_(0)
+ , total_sent_packets_(0)
+ , header_()
+ , outbuf_()
+ , keep_connection_(false)
{
- public:
- typedef ::cgi::common::io_service io_service_type;
- typedef ::cgi::common::map map_type;
- typedef Protocol protocol_type;
- typedef common::shareable_tcp_connection connection_type;
- typedef typename connection_type::pointer connection_ptr;
- typedef boost::array<
- unsigned char
- , fcgi::spec::header_length::value
- > header_buffer_type;
- typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
- typedef fcgi::spec_detail::role_t role_type;
-
- /// Construct
- basic_client()
- : request_id_(-1)
- , status_(none_)
- , keep_connection_(false)
- {
- }
-
- /// Construct
- basic_client(io_service_type& ios)
- : request_id_(-1)
- , status_(none_)
- , keep_connection_(false)
- //, io_service_(ios)
- //, connection_(new connection_type::pointer(ios))
- {
- }
+ }
- /// Destroy
- /** Closing the connection as early as possible is good for efficiency */
- ~basic_client()
- {
- close();
- }
-
- /// Construct the client by claiming a request id.
- /**
- * Before loading a request, it will usually not have a request id. This
- * function reads headers (and corresponding bodies if necessary) until
- * a BEGIN_REQUEST record is found. The calling request then claims and
- * serves that request.
- */
- template<typename RequestImpl>
- boost::system::error_code
- construct(RequestImpl& req, boost::system::error_code& ec)
- {
- status_ = constructed;
-
- return ec;
- }
-
- bool is_open() const
- {
- return connection_->is_open();
- }
-
- void close(boost::uint64_t app_status = 0)
- {
- boost::system::error_code ec;
- close(app_status, ec);
- detail::throw_error(ec);
- }
-
- boost::system::error_code
- close(boost::uint64_t app_status, boost::system::error_code& ec)
- {
- if (status_ == closed_) return ec;
+ /// Construct
+ template<>
+ basic_client<
+ connections::shareable_tcp
+ , ::BOOST_CGI_NAMESPACE::common::tags::fcgi
+ >::basic_client(io_service_type& ios)
+ : request_id_(-1)
+ , status_(none_)
+ , total_sent_bytes_(0)
+ , total_sent_packets_(0)
+ , header_()
+ , outbuf_()
+ , keep_connection_(false)
+ {
+ }
- std::vector<boost::asio::const_buffer> bufs;
+ /// Override basic_client::close().
+ /**
+ * Closing a FastCGI means sending an END_REQUEST header
+ * to the HTTP server and potentially closing the connection.
+ *
+ * Note that in general the HTTP server is responsible for the
+ * lifetime of the connection, but can hand that control over
+ * to the library (eg. if the server is set up to recycle
+ * connections after N requests).
+ */
+ template<>
+ boost::system::error_code
+ basic_client<
+ connections::shareable_tcp
+ , ::BOOST_CGI_NAMESPACE::common::tags::fcgi
+ >::close(boost::uint64_t app_status, boost::system::error_code& ec)
+ {
+ // Note that the request may already be closed if the client aborts
+ // the connection.
+ if (!is_open())
+ ec = error::already_closed;
+ else
+ {
+ status_ = closed_;
+ outbuf_.clear();
+ header_.reset(fcgi::spec_detail::END_REQUEST, request_id_, 8);
// Write an EndRequest packet to the server.
- out_header_[0] = static_cast<unsigned char>(1); // FastCGI version
- out_header_[1] = static_cast<unsigned char>(3); // END_REQUEST
- out_header_[2] = static_cast<unsigned char>(request_id_ >> 8) & 0xff;
- out_header_[3] = static_cast<unsigned char>(request_id_) & 0xff;
- out_header_[4] = static_cast<unsigned char>(8 >> 8) & 0xff;
- out_header_[5] = static_cast<unsigned char>(8) & 0xff;
- out_header_[6] = static_cast<unsigned char>(0);
- out_header_[7] = 0;
-
- //BOOST_ASSERT(role_ == fcgi::spec_detail::RESPONDER
- // && "Only supports Responder role for now (**FIXME**)");
-
- header_buffer_type end_request_body =
- {{
- static_cast<unsigned char>(app_status >> 24) & 0xff
- , static_cast<unsigned char>(app_status >> 16) & 0xff
- , static_cast<unsigned char>(app_status >> 8) & 0xff
- , static_cast<unsigned char>(app_status >> 0) & 0xff
- , static_cast<unsigned char>(fcgi::spec_detail::REQUEST_COMPLETE)
- , static_cast<unsigned char>(0)
- , static_cast<unsigned char>(0)
- , static_cast<unsigned char>(0)
- }};
+ fcgi::spec::end_request_body body(
+ app_status, fcgi::spec_detail::REQUEST_COMPLETE);
- bufs.push_back(buffer(out_header_));
- bufs.push_back(buffer(end_request_body));
+ outbuf_.push_back(header_.data());
+ outbuf_.push_back(body.data());
- write(*connection_, bufs, boost::asio::transfer_all(), ec);
+ write(*connection_, outbuf_, boost::asio::transfer_all(), ec);
- if (!keep_connection_)
+ if (!ec && !keep_connection_)
+ {
connection_->close();
-
- return ec;
+ }
}
+ return ec;
+ }
- //io_service_type& io_service() { return io_service_; }
-
- /// Associate a connection with this client
- /**
- * Note: the connection must have been created using the new operator
- */
- bool set_connection(connection_type* conn)
- {
- // make sure there isn't already a connection associated with the client
- //if (!connection_) return false;
- connection_.reset(conn);
- return true;
- }
+
+ template<>
+ template<typename ConstBufferSequence>
+ void
+ basic_client<
+ connections::shareable_tcp
+ , ::BOOST_CGI_NAMESPACE::common::tags::fcgi
+ >::prepare_buffer(const ConstBufferSequence& buf)
+ {
+ typename ConstBufferSequence::const_iterator iter = buf.begin();
+ typename ConstBufferSequence::const_iterator end = buf.end();
- /// Associate a connection with this client
- bool set_connection(const connection_type::pointer& conn)
- {
- // make sure there isn't already a connection associated with the client
- //if (!connection_) return false;
- connection_ = conn;
- return true;
- }
+ outbuf_.clear();
+ outbuf_.push_back(boost::asio::buffer(header_.data()));
- /// Get a shared_ptr of the connection associated with the client.
- connection_type::pointer&
- connection() { return connection_; }
-
- /// Write some data to the client.
- template<typename ConstBufferSequence>
- std::size_t
- write_some(const ConstBufferSequence& buf, boost::system::error_code& ec)
+ int total_buffer_size(0);
+ for(; iter != end; ++iter)
{
- typename ConstBufferSequence::const_iterator iter = buf.begin();
- typename ConstBufferSequence::const_iterator end = buf.end();
-
- std::vector<boost::asio::const_buffer> bufs;
- bufs.push_back(boost::asio::buffer(out_header_));
-
- int total_buffer_size(0);
- for(; iter != end; ++iter)
+ boost::asio::const_buffer buffer(*iter);
+ std::size_t new_buf_size( boost::asio::buffer_size(*iter) );
+ if (total_buffer_size + new_buf_size
+ > static_cast<std::size_t>(fcgi::spec::max_packet_size::value))
{
- boost::asio::const_buffer buffer(*iter);
- int new_buf_size( boost::asio::buffer_size(buffer) );
- // only write a maximum of 65535 bytes
- if (total_buffer_size + new_buf_size
- > fcgi::spec::max_packet_size::value)
+ // If the send buffer is empty, extract a chunk of the
+ // new buffer to send. If there is already some data
+ // ready to send, don't add any more data to the pack.
+ if (total_buffer_size == 0)
+ {
+ total_buffer_size
+ = std::min<std::size_t>(new_buf_size,65500);
+ /*
+ std::cerr<< "Oversized buffer: " << total_buffer_size
+ << " / " << new_buf_size << " bytes sent\n";
+ */
+ outbuf_.push_back(
+ boost::asio::buffer(*iter, total_buffer_size));
+ break;
+ }
+ else
break;
+ }
+ else
+ {
total_buffer_size += new_buf_size;
- bufs.push_back(*iter);
+ outbuf_.push_back(*iter);
}
- std::cerr<< "Size of write buffer := " << total_buffer_size << std::endl;
- //detail::make_header(out_header_, buf
- out_header_[0] = static_cast<unsigned char>(1);
- out_header_[1] = static_cast<unsigned char>(6);
- out_header_[2] = static_cast<unsigned char>(request_id_ >> 8) & 0xff;
- out_header_[3] = static_cast<unsigned char>(request_id_) & 0xff;
- out_header_[4] = static_cast<unsigned char>(total_buffer_size >> 8) & 0xff;
- out_header_[5] = static_cast<unsigned char>(total_buffer_size) & 0xff;
- out_header_[6] = static_cast<unsigned char>(0);
- out_header_[7] = 0;
-
- std::size_t bytes_transferred
- = boost::asio::write(*connection_, bufs, boost::asio::transfer_all(), ec);
-
- if (0 != (total_buffer_size + fcgi::spec::header_length::value
- - bytes_transferred))
- ec = error::couldnt_write_complete_packet;
-
- return bytes_transferred;
- }
-
- /// Read data into the supplied buffer.
- /**
- * Reads some data that, correctly checking and stripping FastCGI headers.
- *
- * Returns the number of bytes read and sets `ec` such that `ec` evaluates
- * to `true` iff an error occured during the read operation.
- *
- * Notable errors:
- * - `fcgi::error::data_for_another_request`
- * - `fcgi::error::connection_locked`
- *
- * These must be dealt with by user code if they choose to read through the
- * client (reading through the request is recommended).
- */
- template<typename MutableBufferSequence>
- std::size_t
- read_some(const MutableBufferSequence& buf, boost::system::error_code& ec)
- {
- std::size_t bytes_read(0);
-
- return bytes_read;
- }
-
- /// Asynchronously write some data to the client.
- template<typename ConstBufferSequence, typename Handler>
- void async_write_some(const ConstBufferSequence& buf, Handler handler)
- {
- connection_->async_write_some(buf, handler);
- }
-
- /// Asynchronously read some data from the client.
- template<typename MutableBufferSequence, typename Handler>
- void async_read_some(const MutableBufferSequence& buf, Handler handler)
- {
- connection_->async_read_some(buf, handler);
- }
-
-
- const client_status& status() const
- {
- return status_;
- }
-
- bool keep_connection() const
- {
- return keep_connection_;
}
-
- //int id() { return request_id_; }
-
- std::size_t& bytes_left()
- {
- return bytes_left_;
- }
-
- public:
- friend class fcgi_request_service;
- boost::uint16_t request_id_;
- client_status status_;
- std::size_t bytes_left_;
- //request_impl_type* current_request_;
+ header_.reset(fcgi::spec_detail::STDOUT, request_id_, total_buffer_size);
+ }
+
+ template<>
+ void
+ basic_client<
+ connections::shareable_tcp
+ , ::BOOST_CGI_NAMESPACE::common::tags::fcgi
+ >::handle_write(std::size_t bytes_transferred, boost::system::error_code& ec)
+ {
+ total_sent_bytes_ += bytes_transferred;
+ total_sent_packets_ += 1;
- /// A marker to say if the final STDIN (and/or DATA) packets have been
- // read. Note: having data on the connection doesn't imply it's for
- // this request; we can save time by knowing when to not even try.
- //bool closed_;
-
- connection_ptr connection_;
-
- //fcgi::spec_detail::Header hdr_;
- /// Buffer used to check the header of each packet.
- header_buffer_type out_header_;
-
- bool keep_connection_;
- role_type role_;
-
- public:
+ std::size_t total_buffer_size = static_cast<std::size_t>(header_.content_length());
+
+#ifndef NDEBUG
+ if (ec)
+ std::cerr<< "Error " << ec << ": " << ec.message() << '\n';
+ else
+ std::cerr
+ << "Transferred " << total_buffer_size
+ << " (+" << (bytes_transferred - total_buffer_size)
+ << " protocol) 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 want to know about them.
+ bytes_transferred -= fcgi::spec::header_length::value;
+ // Check everything was written ok.
+ if (!ec && bytes_transferred != total_buffer_size)
+ ec = ::BOOST_CGI_NAMESPACE::fcgi::error::couldnt_write_complete_packet;
+ }
+
+
+ /// Write some data to the client.
+ template<>
+ template<typename ConstBufferSequence>
+ std::size_t
+ basic_client<
+ connections::shareable_tcp
+ , ::BOOST_CGI_NAMESPACE::common::tags::fcgi
+ >::write_some(
+ const ConstBufferSequence& buf
+ , boost::system::error_code& ec
+ )
+ {
+ prepare_buffer(buf);
+
+ std::size_t bytes_transferred
+ = boost::asio::write(*connection_, outbuf_
+ , boost::asio::transfer_all(), ec);
- //template<typename Request>
- //Request& lookup_request(boost::uint16_t id)
- //{
+ handle_write(bytes_transferred, ec);
+
+ return bytes_transferred;
+ }
- //*/
- };
+ /// Write some data to the client.
+ template<>
+ template<typename ConstBufferSequence, typename Handler>
+ void
+ basic_client<
+ connections::shareable_tcp
+ , ::BOOST_CGI_NAMESPACE::common::tags::fcgi
+ >::async_write_some(
+ const ConstBufferSequence& buf
+ , Handler handler
+ )
+ {
+ prepare_buffer(buf);
+
+ std::size_t bytes_transferred
+ = boost::asio::write(*connection_, outbuf_
+ , boost::asio::transfer_all(), ec);
-//#include "boost/cgi/fcgi/client_fwd.hpp"
+ handle_write(bytes_transferred, ec);
+ }
} // namespace common
namespace fcgi {
typedef
common::basic_client<
- common::shareable_tcp_connection, ::cgi::common::fcgi_
+ connections::shareable_tcp, ::BOOST_CGI_NAMESPACE::common::tags::fcgi
>
client;
} // namespace fcgi
-
-
-}// namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_FCGI_CLIENT_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -14,18 +14,22 @@
#include "boost/cgi/fcgi/request_service.hpp"
#include "boost/cgi/fwd/basic_request_fwd.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
// typedef for typical usage (FCGI)
typedef
common::basic_request<
- fcgi_request_service, service
+ common::tags::fcgi
>
request;
} // namespace fcgi
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
+
+namespace boost { namespace fcgi {
+ using ::BOOST_CGI_NAMESPACE::fcgi::request;
+} }
#include "boost/cgi/basic_request.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_acceptor_service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -15,21 +15,22 @@
#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"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
/// 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_> >
{
@@ -38,11 +39,12 @@
typedef fcgi::acceptor_service_impl<> service_impl_type;
typedef service_impl_type::implementation_type implementation_type;
- typedef
- typename implementation_type::protocol_type protocol_type;
+ typedef service_impl_type::native_type native_type;
+ typedef service_impl_type::protocol_service_type protocol_service_type;
+ typedef service_impl_type::accept_handler_type accept_handler_type;
+ typedef implementation_type::protocol_type protocol_type;
typedef implementation_type::endpoint_type endpoint_type;
- typedef typename service_impl_type::native_type native_type;
- //typedef basic_protocol_service<protocol_type> protocol_service_type;
+ typedef implementation_type::acceptor_service_type acceptor_service_type;
/// The unique service identifier
//static boost::asio::io_service::id id;
@@ -120,13 +122,17 @@
return service_impl_.listen(impl, backlog, ec);
}
-// template<typename CommonGatewayRequest>
-// boost::system::error_code
-// accept(implementation_type& impl, CommonGatewayRequest& request
-// , boost::system::error_code& ec)
-// {
-// return service_impl_.accept(impl, request, NULL, ec);
-// }
+ int accept(implementation_type& impl, accept_handler_type handler
+ , endpoint_type * ep, boost::system::error_code& ec)
+ {
+ return service_impl_.accept(impl, handler, ep, ec);
+ }
+
+ void async_accept(implementation_type& impl
+ , accept_handler_type handler)
+ {
+ return service_impl_.async_accept(impl, handler);
+ }
template<typename CommonGatewayRequest>
boost::system::error_code
@@ -178,7 +184,7 @@
service_impl_type service_impl_;
};
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/request_fwd.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,7 +11,7 @@
#include "boost/cgi/basic_request_fwd.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
typedef service service_t;
@@ -20,7 +20,7 @@
typedef basic_request<fcgi_request_service, service_t> request;
} // namespace fcgi
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_FCGI_REQUEST_FWD_HPP_INCLUDED__
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-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -13,77 +13,57 @@
#include <boost/system/error_code.hpp>
#include <boost/fusion/include/vector.hpp>
////////////////////////////////////////////////////////////////
+#include "boost/cgi/common/form_parser.hpp"
#include "boost/cgi/common/map.hpp"
+#include "boost/cgi/common/parse_options.hpp"
+#include "boost/cgi/common/request_base.hpp"
+#include "boost/cgi/common/role_type.hpp"
+#include "boost/cgi/common/source_enums.hpp"
#include "boost/cgi/common/tags.hpp"
+#include "boost/cgi/connections/shareable_tcp_socket.hpp"
+#include "boost/cgi/detail/service_base.hpp"
+#include "boost/cgi/detail/throw_error.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/read.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/detail/service_base.hpp"
-#include "boost/cgi/common/parse_options.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
/// 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 ::cgi::common::fcgi_ protocol_type;
- typedef ::cgi::fcgi::client client_type;
- typedef client_type::connection_type connection_type;
- typedef client_type::header_buffer_type header_buffer_type;
- typedef detail::protocol_traits<
- protocol_type
- >::protocol_service_type protocol_service_type;
- typedef detail::protocol_traits<
- protocol_type
- >::request_type request_type;
+ typedef client_type::header_buffer_type header_buffer_type;
+ typedef spec_detail::Header header_type;
implementation_type()
- : client_()
- , stdin_parsed_(false)
- , http_status_(::cgi::common::http::no_content)
- , request_status_(common::unloaded)
+ : id_(0)
, request_role_(spec_detail::ANY)
- , all_done_(false)
{
}
- protocol_service_type* service_;
-
- client_type client_;
-
- bool stdin_parsed_;
- ::cgi::common::http::status_code http_status_;
- common::request_status request_status_;
- fcgi::spec_detail::role_t request_role_;
- std::size_t characters_left_;
+ boost::uint16_t id_;
- bool all_done_;
+ fcgi::spec_detail::role_types request_role_;
- /************** New stuff *****************/
header_buffer_type header_buf_;
- boost::uint16_t id_;
- typedef detail::form_parser form_parser_type;
-
- boost::scoped_ptr<form_parser_type> fp_;
+ header_type header_;
+
// Buffer to hold param records and filter data, etc.
buffer_type param_buffer_;
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(¶m_buffer_[bufsz], size);
@@ -91,31 +71,14 @@
};
typedef fcgi_request_service self_type;
- typedef ::cgi::fcgi::fcgi_request_service full_type;
+ typedef fcgi_request_service full_type;
typedef self_type::implementation_type::protocol_type protocol_type;
+ typedef self_type::implementation_type::string_type string_type;
typedef self_type::implementation_type::request_type request_type;
- template<typename Service>
- struct callback_functor
- {
- callback_functor(implementation_type& impl, Service* service)
- : impl_(impl)
- , service_(service)
- {
- }
-
- std::size_t operator()(boost::system::error_code& ec)
- {
- return service_->read_some(impl_, ec);
- }
-
- private:
- implementation_type& impl_;
- Service* service_;
- };
-
- fcgi_request_service(::cgi::common::io_service& ios)
+ fcgi_request_service(::BOOST_CGI_NAMESPACE::common::io_service& ios)
: detail::service_base<fcgi_request_service>(ios)
+ , strand_(ios)
{
}
@@ -125,43 +88,24 @@
void construct(implementation_type& impl)
{
- // **FIXME** move this to the client class
- impl.client_.set_connection(//new implementation_type::connection_type(this->io_service()));
- implementation_type::connection_type::create(this->io_service())
+ impl.client_.set_connection(
+ implementation_type::connection_type::create(this->get_io_service())
);
}
- void destroy(implementation_type& impl)
- {
- //if (!impl.all_done_)
- // detail::abort_impl(impl); // this function isn't implemented yet!
- //impl.set_state(aborted);
- }
-
void shutdown_service()
{
}
- void set_service(implementation_type& impl
- , implementation_type::protocol_service_type& ps)
- {
- impl.service_ = &ps;
- }
-
- bool is_open(implementation_type& impl)
- {
- return !impl.all_done_ && impl.client_.is_open();
- }
-
/// Close the request.
- int close(implementation_type& impl, ::cgi::common::http::status_code& hsc
+ int close(implementation_type& impl, ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
, int program_status);
/// Close the request.
- int close(implementation_type& impl, ::cgi::common::http::status_code& hsc
+ int close(implementation_type& impl, ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
, int program_status, boost::system::error_code& ec);
- /// Clear all request data (object is then safe to remove).
+ /// Clear all request data (object is then safe to reuse).
void clear(implementation_type& impl);
/// Load the request to a point where it can be usefully used.
@@ -174,24 +118,21 @@
* packet for this request arrives from the server.
*
*/
- boost::system::error_code
- load(implementation_type& impl, bool parse_stdin
- , boost::system::error_code& ec);
boost::system::error_code
- load(implementation_type& impl, common::parse_options parse_opts
+ load(implementation_type& impl, common::parse_options opts
, boost::system::error_code& ec);
// **FIXME**
template<typename Handler>
- void async_load(implementation_type& impl, bool parse_stdin, Handler handler);
+ void async_load(implementation_type& impl, common::parse_options opts, Handler handler);
/// Returns true if the request environment params have been read.
bool params_read(implementation_type& impl);
- role_type get_role(implementation_type& impl)
+ common::role_type role(implementation_type& impl) const
{
- return responder;
+ return common::responder;
}
implementation_type::client_type&
@@ -199,8 +140,35 @@
{
return impl.client_;
}
+
+ private:
+
+ template<typename Handler>
+ void do_load(
+ implementation_type& impl, common::parse_options opts,
+ Handler handler, boost::system::error_code const& ec
+ );
+
+ template<typename Handler>
+ void handle_read_header(
+ implementation_type& impl,
+ Handler handler,
+ boost::system::error_code const& ec,
+ const std::size_t bytes_transferred
+ );
+
+ template<typename Handler>
+ void handle_begin_request_header(
+ implementation_type& impl,
+ Handler handler,
+ boost::system::error_code const& ec
+ );
- void set_status(implementation_type& impl, common::request_status status);
+ template<typename Handler>
+ void async_read_header(
+ implementation_type& impl
+ , Handler handler
+ , boost::system::error_code& ec);
protected:
/// Read and parse the cgi POST meta variables (greedily)
@@ -233,6 +201,18 @@
boost::system::error_code
read_header(implementation_type& impl, boost::system::error_code& ec);
+ /// Asynchronously read a single header, but do nothing with it.
+ template<typename Handler>
+ void async_read_header(implementation_type& impl, Handler handler)
+ {
+ // clear the header first (might be unneccesary).
+ impl.header_buf_ = implementation_type::header_buffer_type();
+
+ async_read(*impl.client_.connection(), buffer(impl.header_buf_)
+ , boost::asio::transfer_all(), handler);
+ }
+
+
/*** Various handlers go below here; they might find a
* better place to live ***/
@@ -245,22 +225,22 @@
// **FIXME**
boost::system::error_code
process_begin_request(implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t
+ , const unsigned char* buf, boost::uint32_t
, boost::system::error_code& ec);
boost::system::error_code
process_abort_request(implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t
+ , const unsigned char* buf, boost::uint32_t
, boost::system::error_code& ec);
boost::system::error_code
process_params(implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t len
+ , const unsigned char* buf, boost::uint32_t len
, boost::system::error_code& ec);
boost::system::error_code
process_stdin(implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t len
+ , const unsigned char* buf, boost::uint32_t len
, boost::system::error_code& ec);
/// Parse the current header
@@ -272,12 +252,12 @@
// Mammoth typedef corresponding to function signature of process_*
// functions.
- typedef boost::system::error_code
- ( full_type::* proc_func_t)
- (implementation_type& impl, boost::uint16_t, const unsigned char*
- , boost::uint16_t, boost::system::error_code&);
+ //typedef boost::system::error_code
+ // ( full_type::* proc_func_t)
+ // (implementation_type& impl, boost::uint16_t, const unsigned char*
+ // , boost::uint32_t, boost::system::error_code&);
- static const proc_func_t proc_funcs[];
+ //const proc_func_t proc_funcs[8];
boost::system::error_code
parse_packet(implementation_type& impl, boost::system::error_code& ec);
@@ -297,10 +277,13 @@
begin_request_helper(implementation_type& impl
, implementation_type::header_buffer_type& header
, boost::system::error_code& ec);
+
+ private:
+ boost::asio::io_service::strand strand_;
};
} // namespace fcgi
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/fcgi/request.hpp"
#include "boost/cgi/basic_request.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,16 +12,21 @@
#include "boost/cgi/common/tags.hpp"
#include "boost/cgi/common/basic_protocol_service.hpp"
-namespace cgi {
-
- //typedef basic_protocol_service<tags::scgi> scgi_service;
-
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
-
- // typedef for standard scgi::service (a model of ProtocolService)
- typedef ::cgi::common::basic_protocol_service< ::cgi::common::fcgi_> service;
-
- }
-} // namespace cgi
+
+ // typedef for standard fcgi::service (a model of ProtocolService)
+ typedef
+ common::basic_protocol_service<
+ common::tags::fcgi
+ >
+ service;
+
+ } // namespace fcgi
+BOOST_CGI_NAMESPACE_END
+
+namespace boost { namespace fcgi {
+ using ::BOOST_CGI_NAMESPACE::fcgi::service;
+} }
#endif // CGI_FCGI_SERVICE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/specification.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/specification.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fcgi/specification.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,13 +9,13 @@
#ifndef CGI_FCGI_SPECIFICATION_HPP_INCLUDED__
#define CGI_FCGI_SPECIFICATION_HPP_INCLUDED__
-//#include <inttypes.h>
#include <boost/cstdint.hpp>
+#include <boost/asio/buffer.hpp>
// NOTE: CamelCase style mimicks the FastCGI specification
// SEE: http://www.fastcgi.com/devkit/doc/fcgi-spec.html#S8
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
namespace spec_detail {
@@ -37,18 +37,19 @@
= (unsigned char)BOOST_CGI_FASTCGI_VERSION_1;
// Values for the type component of Header
- enum request_t { BEGIN_REQUEST = 1
- , ABORT_REQUEST = 2
- , END_REQUEST = 3
- , PARAMS = 4
- , STDIN = 5
- , STDOUT = 6
- , STDERR = 7
- , DATA = 8
- , GET_VALUES = 9
- , GET_VALUES_RESULT = 10
- , UNKNOWN_TYPE = 11
- , MAXTYPE = UNKNOWN_TYPE
+ enum request_types
+ { BEGIN_REQUEST = 1
+ , ABORT_REQUEST = 2
+ , END_REQUEST = 3
+ , PARAMS = 4
+ , STDIN = 5
+ , STDOUT = 6
+ , STDERR = 7
+ , DATA = 8
+ , GET_VALUES = 9
+ , GET_VALUES_RESULT = 10
+ , UNKNOWN_TYPE = 11
+ , MAXTYPE = UNKNOWN_TYPE
};
// a null request id is a management record
@@ -61,14 +62,14 @@
const boost::uint16_t MAX_MSG_LEN = 65535;
// Values for role component of BeginRequestBody
- enum role_t { RESPONDER = 1
+ enum role_types { RESPONDER = 1
, AUTHORIZER = 2
, FILTER = 3
, ANY
};
// Values for protocolStatus component of EndRequestBody
- enum status_t { REQUEST_COMPLETE = 0
+ enum status_types { REQUEST_COMPLETE = 0
, CANT_MPX_CONN = 1
, OVERLOADED = 2
, UNKNOWN_ROLE = 3
@@ -93,16 +94,37 @@
unsigned char paddingLength_;
unsigned char reserved_;
} impl;
-
+
public:
- Header() { memset(static_cast<void*>(&this->impl), 0, sizeof(this->impl)); }
+ typedef boost::asio::const_buffers_1 const_buffers_type;
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+
+ Header()
+ {
+ memset(static_cast<void*>(&this->impl)
+ , 0, sizeof(this->impl));
+ }
- Header(request_t t, int id, int len)
+ Header(request_types t, int id, int len)
{
reset(t, id, len);
}
+
+ mutable_buffers_type data()
+ {
+ return boost::asio::buffer(
+ static_cast<void*>(&impl)
+ , sizeof(impl));
+ }
- void reset(request_t t, int id, int len)
+ const_buffers_type data() const
+ {
+ return boost::asio::buffer(
+ static_cast<const void*>(&impl)
+ , sizeof(impl));
+ }
+
+ void reset(request_types t, int id, int len)
{
impl.version_ = (VERSION_NUM);
impl.type_ = ((unsigned char)t);
@@ -197,16 +219,18 @@
} impl;
public:
+ typedef boost::asio::const_buffers_1 const_buffers_type;
+
EndRequestBody() {}
EndRequestBody( boost::uint64_t appStatus
- , status_t procStatus
+ , status_types procStatus
)
{
reset(appStatus, procStatus);
}
- void reset( boost::uint64_t appStatus, status_t procStatus)
+ void reset( boost::uint64_t appStatus, status_types procStatus)
{
impl.appStatusB3_ = ( (appStatus >> 24) & 0xff );
impl.appStatusB2_ = ( (appStatus >> 16) & 0xff );
@@ -216,6 +240,13 @@
memset(impl.reserved_, 0, sizeof(impl.reserved_));
}
+
+ const_buffers_type data() const
+ {
+ return boost::asio::buffer(
+ static_cast<const void*>(&impl)
+ , sizeof(impl));
+ }
};
class EndRequestRecord
@@ -234,7 +265,7 @@
public:
EndRequestRecord( boost::uint16_t id
, boost::uint64_t appStatus
- , status_t procStatus
+ , status_types procStatus
)
{
impl.header_.reset( END_REQUEST, id, sizeof(EndRequestBody) );
@@ -301,9 +332,14 @@
namespace specification {
#include <boost/mpl/int.hpp>
+
+ /// Define the FastCGI spec using types.
+ /**
+ * Types are better than macros.
+ */
struct max_packet_size
- : boost::mpl::int_<65535>
+ : boost::mpl::int_<65535u>
{};
struct header_length
@@ -324,9 +360,9 @@
int get_version(Array& a) { return static_cast<int>(a[0]); }
template<typename Array>
- spec_detail::request_t get_type(Array& a)
+ spec_detail::request_types get_type(Array& a)
{
- return static_cast<spec_detail::request_t>(a[1]);
+ return static_cast<spec_detail::request_types>(a[1]);
}
template<typename Array>
@@ -389,6 +425,9 @@
}
}
};
+
+ typedef spec_detail::Header header;
+ typedef spec_detail::EndRequestBody end_request_body;
struct begin_request
: boost::mpl::int_<1>
@@ -397,32 +436,136 @@
{
typedef boost::mpl::int_<8> size;
};
+
+ typedef boost::array<
+ unsigned char
+ , header_length::value
+ > buffer_type;
+
+ buffer_type impl;
+
+ begin_request(buffer_type& buf)
+ : impl(buf)
+ {
+ }
+
+ spec_detail::role_types role()
+ {
+ return static_cast<spec_detail::role_types>(
+ (impl[0] << 8) + impl[1] );
+ }
+
+ unsigned char flags()
+ {
+ return impl[2];
+ }
template<typename Array>
- static spec_detail::role_t
- get_role(Array& a)
+ static spec_detail::role_types
+ role(Array& a)
{
- return static_cast<spec_detail::role_t>( (a[0] << 8) + a[1] );
+ return static_cast<spec_detail::role_types>(
+ (a[0] << 8) + a[1] );
}
template<typename Array>
static unsigned char
- get_flags(Array& a)
+ flags(Array& a)
{
return a[2];
}
+ };
+
+ struct stdout_header
+ : spec_detail::Header
+ {
+ explicit stdout_header()
+ : Header(spec_detail::STDOUT,0,0)
+ {
+ }
+ explicit stdout_header(int request_id, int content_len)
+ : Header(spec_detail::STDOUT, request_id, content_len)
+ {
+ }
+ void reset(int request_id, int content_len)
+ {
+ spec_detail::Header::reset(
+ spec_detail::STDOUT
+ , request_id
+ , content_len);
+ }
+ };
+
+ struct end_request
+ : header
+ , end_request_body
+ {
+ explicit end_request
+ (
+ int request_id = 0
+ , boost::uint64_t app_status = 0
+ , spec_detail::status_types proc_status
+ = spec_detail::REQUEST_COMPLETE
+ )
+ : header(spec_detail::END_REQUEST, request_id
+ , sizeof(end_request_body))
+ , end_request_body(app_status, proc_status)
+ {
+ }
- //typedef spec_detail::BEGIN_REQUEST type;
+ void reset
+ (
+ int request_id
+ , boost::uint64_t app_status = 0
+ , spec_detail::status_types proc_status
+ = spec_detail::REQUEST_COMPLETE
+ )
+ {
+ header::reset(
+ spec_detail::END_REQUEST
+ , request_id
+ , sizeof(end_request_body));
+ end_request_body::reset(
+ app_status, proc_status);
+ }
+ };
+
+ class BeginRequestBody
+ {
+ /// The underlying type of a BeginRequestBody sub-header.
+ /**
+ * To guarantee the header is laid out exactly as we want, the
+ * structure must be a POD-type (see http://tinyurl.com/yo9eav).
+ */
+ struct implementation_type
+ {
+ unsigned char roleB1_;
+ unsigned char roleB0_;
+ unsigned char flags_;
+ unsigned char reserved_[5];
+ } impl;
+
+ public:
+
+ int role() const
+ {
+ return (impl.roleB1_ << 8 ) + impl.roleB0_;
+ }
+ unsigned char flags() const
+ {
+ return impl.flags_;
+ }
};
+
struct role_type
{
template<typename Array>
static std::string to_string(Array& a)
{
using namespace spec_detail;
- switch(begin_request::get_role(a))
+ switch(begin_request::role(a))
{
case RESPONDER:
return "RESPONDER";
@@ -435,12 +578,12 @@
}
}
};
- //using namespace ::cgi::fcgi::detail;
+ //using namespace ::BOOST_CGI_NAMESPACE::fcgi::detail;
}
namespace spec = specification;
} // namespace fcgi
-}// namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_FCGI_SPECIFICATION_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_connection_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_connection_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_connection_fwd.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,13 +9,13 @@
#ifndef CGI_BASIC_CONNECTION_FWD_HPP_INCLUDED__
#define CGI_BASIC_CONNECTION_FWD_HPP_INCLUDED__
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<typename ConnectionType>
class basic_connection;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_CONNECTION_FWD_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_protocol_service_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_protocol_service_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_protocol_service_fwd.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -15,7 +15,7 @@
#include "boost/cgi/fwd/io_service_provider_fwd.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<
@@ -25,7 +25,7 @@
class basic_protocol_service;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_PROTOCOL_SERVICE_FWD_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_acceptor_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_acceptor_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_acceptor_fwd.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,11 +9,11 @@
#ifndef CGI_BASIC_ACCEPTOR_FWD_HPP_INCLUDED__
#define CGI_BASIC_ACCEPTOR_FWD_HPP_INCLUDED__
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
template<typename>
class basic_acceptor;
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_ACCEPTOR_FWD_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/basic_request_fwd.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,16 +12,14 @@
#include "boost/cgi/fwd/request_service_fwd.hpp"
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
- template<typename RequestService
- , typename ProtocolService
- , typename Allocator = std::allocator<char> >
+ template<typename Protocol>
class basic_request;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_BASIC_REQUEST_FWD_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/io_service_provider_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/io_service_provider_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/io_service_provider_fwd.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -15,14 +15,14 @@
#include "boost/cgi/common/tags.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
template<typename = tags::single_service>
class io_service_provider;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_IO_SERVICE_PROVIDER_FWD_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/request_service_fwd.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/request_service_fwd.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/fwd/request_service_fwd.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -10,7 +10,7 @@
#define CGI_REQUEST_SERVICE_FWD_HPP_INCLUDED
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
/// The generic service class for basic_request<>s
/**
@@ -23,6 +23,6 @@
template<typename Protocol>
class request_service;
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_REQUEST_SERVICE_FWD_HPP_INCLUDED
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/http/status_code.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/http/status_code.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/http/status_code.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,7 +9,7 @@
#ifndef CGI_HTTP_STATUS_CODE_HPP_INCLUDED__
#define CGI_HTTP_STATUS_CODE_HPP_INCLUDED__
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
namespace http {
@@ -84,9 +84,11 @@
} // namespace http
} // namespace common
- using namespace common::http; // **FIXME**
+BOOST_CGI_NAMESPACE_END
-} // namespace cgi
+namespace boost { namespace http {
+ using namespace ::BOOST_CGI_NAMESPACE::common::http;
+} } // namespace boost::http
#endif // CGI_HTTP_STATUS_CODE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/basic_request.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/basic_request.ipp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/basic_request.ipp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -38,8 +38,10 @@
#include "boost/cgi/import/basic_io_object.hpp"
#include "boost/cgi/detail/basic_sync_io_object.hpp"
#include "boost/cgi/fwd/basic_protocol_service_fwd.hpp"
+#include "boost/cgi/config.hpp"
+
+BOOST_CGI_NAMESPACE_BEGIN
-namespace cgi {
namespace common {
/// The basic_request class, primary entry point to the library
@@ -58,61 +60,10 @@
* protected request object).
**/
- // Throws
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>::basic_request
- (
- bool load_now = true, bool parse_post = true
- )
- : detail::basic_sync_io_object<service_type>()
- {
- if (load_now) load(parse_post);
- }
-
- // Won't throw
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>::basic_request
- (
- boost::system::error_code& ec
- , const bool load_now = true
- , const bool parse_post = true
- )
- : detail::basic_sync_io_object<service_type>()
- {
- if (load_now) load(ec, parse_post);
- }
-
- // Throws
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>::basic_request
- (
- protocol_service_type& s, const bool load_now = false
- , const bool parse_post = false
- )
- : basic_io_object<service_type>(s.io_service())
- {
- set_protocol_service(s);
- if (load_now) load(parse_post);
- }
-
- // Won't throw
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>::basic_request
- (
- protocol_service_type& s
- , boost::system::error_code& ec
- , const bool load_now = false, const bool parse_post = false
- )
- : basic_io_object<service_type>(s.io_service())
- {
- set_protocol_service(s);
- if(load_now) load(ec, parse_post);//this->service.load(this->implementation, false, ec);
- }
-
/// Make a new mutiplexed request from an existing connection.
// Throws.
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>:: basic_request(implementation_type& impl)
+ template<typename RequestService, typename ProtocolService, typename Acceptor>
+ basic_request<RequestService,ProtocolService,Acceptor>:: basic_request(implementation_type& impl)
: basic_io_object<service_type>(impl.service_->io_service())
{
set_protocol_service(*impl.service_);
@@ -124,8 +75,8 @@
/// Make a new mutiplexed request from an existing connection.
// Won't throw.
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>:: basic_request(implementation_type& impl, boost::system::error_code& ec)
+ template<typename RequestService, typename ProtocolService, typename Acceptor>
+ basic_request<RequestService,ProtocolService,Acceptor>:: basic_request(implementation_type& impl, boost::system::error_code& ec)
: basic_io_object<service_type>(impl.service_->io_service())
{
set_protocol_service(*impl.service_);
@@ -139,21 +90,21 @@
// close(http::internal_server_error, 0);
}
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>:: static pointer create(protocol_service_type& ps)
+ template<typename RequestService, typename ProtocolService, typename Acceptor>
+ basic_request<RequestService,ProtocolService,Acceptor>:: static pointer create(protocol_service_type& ps)
{
return pointer(new type(ps));
}
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>:: void set_protocol_service(protocol_service_type& ps)
+ template<typename RequestService, typename ProtocolService, typename Acceptor>
+ basic_request<RequestService,ProtocolService,Acceptor>:: void set_protocol_service(protocol_service_type& ps)
{
this->service.set_service(this->implementation, ps);
}
/// Return `true` if the request is still open (ie. not aborted or closed)
- template<typename RS, typename PS, typename A>
- basic_request<RS,PS,A>:: bool is_open()
+ template<typename RequestService, typename ProtocolService, typename Acceptor>
+ basic_request<RequestService,ProtocolService,Acceptor>:: bool is_open()
{
return this->service.is_open(this->implementation);
}
@@ -308,7 +259,7 @@
* Set the output sink as `stdout_`, `stderr_`, or `stdout_ | stderr_`
*/
/*
- void set_output(cgi::sink dest, boost::system::error_code& ec)
+ void set_output(BOOST_CGI_NAMESPACE::sink dest, boost::system::error_code& ec)
{
this->service(this->implementation, dest, ec);
}
@@ -489,7 +440,8 @@
};
} // namespace common
-} // namespace cgi
+
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/detail/pop_options.hpp"
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-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -10,27 +10,37 @@
#define CGI_FCGI_REQUEST_SERVICE_IPP_INCLUDED__
#include <boost/fusion/support.hpp>
+#include <boost/fusion/include/algorithm.hpp>
#include <boost/system/error_code.hpp>
#include <boost/fusion/include/vector.hpp>
////////////////////////////////////////////////////////////////
+#include "boost/cgi/fcgi/error.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"
+#include "boost/cgi/config.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace detail {
+ /// Helper class to asynchronously load a request.
+ /**
+ * This is just a function object that can be posted to another
+ * thread to do the actual work of loading. It's operator()() does
+ * the work.
+ */
template<typename T, typename Handler>
struct async_load_helper
{
@@ -55,6 +65,14 @@
bool parse_stdin_;
Handler handler_;
};
+
+ struct clear_data
+ {
+ template<typename T>
+ void operator()(T& x) const {
+ x.clear();
+ }
+ };
} // namespace detail
@@ -63,20 +81,35 @@
/// Close the request.
BOOST_CGI_INLINE int
fcgi_request_service::close(
- implementation_type& impl, ::cgi::common::http::status_code& hsc
+ implementation_type& impl
+ , ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
, int program_status)
{
- impl.all_done_ = true;
- impl.client_.close(program_status);
- impl.request_status_ = common::closed;
+ boost::system::error_code ec;
+ close(impl, hsc, program_status, ec);
+ detail::throw_error(ec);
return program_status;
}
BOOST_CGI_INLINE int
fcgi_request_service::close(
- implementation_type& impl, ::cgi::common::http::status_code& hsc
- , int program_status, boost::system::error_code& ec)
+ implementation_type& impl
+ , ::BOOST_CGI_NAMESPACE::common::http::status_code& hsc
+ , int program_status
+ , boost::system::error_code& ec)
{
+ /**
+ * Apache on Windows with mod_fcgid requires that all of the
+ * pending data for the connection is read before the response
+ * is sent.
+ */
+ while(!ec
+ && impl.client_.status() < common::stdin_read
+ && impl.request_status_ != common::loaded)
+ {
+ parse_packet(impl, ec);
+ }
+
impl.all_done_ = true;
impl.client_.close(program_status, ec);
impl.request_status_ = common::closed;
@@ -86,26 +119,15 @@
BOOST_CGI_INLINE void
fcgi_request_service::clear(implementation_type& impl)
{
- /*
- BOOST_ASSERT
- ( impl.request_status_ < common::activated
- && impl.request_status_ > common::ok
- && "Are you trying to clear() a request without closing it?"
- );
- */
-
impl.post_buffer_.clear();
impl.param_buffer_.clear();
- common::get_vars(impl.vars_).clear();
- common::post_vars(impl.vars_).clear();
- common::cookie_vars(impl.vars_).clear();
- common::env_vars(impl.vars_).clear();
+ // Clear all request data.
+ boost::fusion::for_each(impl.vars_, detail::clear_data());
impl.stdin_parsed_ = false;
impl.http_status_ = common::http::no_content;
impl.request_status_ = common::null;
impl.request_role_ = spec_detail::ANY;
impl.all_done_ = false;
-
impl.client_.status_ = common::none_;
impl.client_.request_id_ = -1;
}
@@ -120,219 +142,248 @@
* packet for this request arrives from the server.
*
*/
-/*
- /// Synchronously read/parse the request meta-data
BOOST_CGI_INLINE boost::system::error_code
fcgi_request_service::load(
- implementation_type& impl, common::parse_options parse_opts
+ implementation_type& impl, common::parse_options opts
, boost::system::error_code& ec)
{
- if (parse_opts & common::parse_env)
- {
- if (!read_env_vars(impl, ec)) // returns an error_code
- return ec;
- }
-
- std::string const& cl = env_vars(impl.vars_)["CONTENT_LENGTH"];
- impl.characters_left_ = cl.empty() ? 0 : boost::lexical_cast<std::size_t>(cl);
- impl.client_.bytes_left() = impl.characters_left_;
-
- std::string const& request_method = env_vars(impl.vars_)["REQUEST_METHOD"];
+ impl.client_.construct(impl, ec);
+ // Bomb out if the client isn't open here.
+ if (!impl.client_.connection()->is_open())
+ return error::client_not_open;
- if (request_method == "GET" && parse_opts & common::parse_get)
+ while(!ec)
{
- parse_get_vars(impl, ec);
+ if (read_header(impl, ec))
+ break;
+ int id(spec::get_request_id(impl.header_buf_));
+ if (id == spec::null_request_id::value)
+ handle_admin_request(impl);
+ else
+ if (impl.id_ && impl.id_ != id)
+ {
+ // The library doesn't support multiplexed connections yet,
+ // mainly because I've never had access to a server that
+ // supports it.
+ //
+ // If you have one, can I use it?
+ ec = error::multiplexing_not_supported;
+ }
+ else
+ if (spec::get_type(impl.header_buf_)
+ == spec::begin_request::value)
+ {
+ impl.id_ = id;
+ impl.client_.request_id_ = id;
+ if (!read_header(impl, ec))
+ {
+ spec::begin_request packet(impl.header_buf_);
+ impl.request_role_ = packet.role();
+ impl.client_.keep_connection_
+ = packet.flags() & spec::keep_connection;
+ break;
+ }
+ }else
+ handle_other_request_header(impl);
}
- else
- if (request_method == "POST" && parse_opts & common::parse_post)
+
+ if (//impl.request_status_ < common::env_read &&
+ opts & common::parse_env)
{
- parse_post_vars(impl, ec);
+ read_env_vars(impl, ec);
+ //impl.request_status_ = common::env_read;
}
- if (ec) return ec;
-
- if (parse_opts & common::parse_cookie)
+ string_type const&
+ request_method (env_vars(impl.vars_)["REQUEST_METHOD"]);
+
+ if (request_method == "GET")
{
- if (!parse_cookie_vars(impl, ec)) // returns an error_code
+ if (parse_get_vars(impl, ec))
return ec;
}
+ else
+ if (request_method == "POST"
+ && opts & common::parse_post_only)
+ {
+ //std::cerr<< "Parsing post vars now.\n";
- set_status(impl, common::loaded);
+ if (opts & common::parse_post_only)
+ {
+ while(!ec
+ && impl.client_.status() < common::stdin_read
+ && impl.request_status_ != common::loaded)
+ {
+ parse_packet(impl, ec);
+ }
+ }
+
+ if (parse_post_vars(impl, ec))
+ return ec;
+ }
+ if (opts & common::parse_cookies_only)
+ parse_cookie_vars(impl, ec);
+
+ if (ec == error::eof) {
+ ec = boost::system::error_code();
+ return ec;
+ }
+ else if (ec) return ec;
+
+ //bool check = impl.client_.is_open();
return ec;
}
-*/
- BOOST_CGI_INLINE boost::system::error_code
- fcgi_request_service::load(
- implementation_type& impl, bool parse_stdin
- , boost::system::error_code& ec)
+
+ template<typename Handler>
+ BOOST_CGI_INLINE
+ void fcgi_request_service::do_load(
+ implementation_type& impl, common::parse_options opts,
+ Handler handler, boost::system::error_code const& ec
+ )
{
- //int header_len( get_length_of_header(impl, ec) );
- BOOST_ASSERT(!ec && "Can't load request due to previous errors.");
-
impl.client_.construct(impl, ec);
- BOOST_ASSERT(impl.client_.connection_->is_open());
+ // Bomb out if the client isn't open here.
+ if (!impl.client_.connection()->is_open())
+ ec = error::client_not_open;
- for(;;)
+ }
+
+ template<typename Handler>
+ BOOST_CGI_INLINE
+ void fcgi_request_service::handle_read_header(
+ implementation_type& impl,
+ Handler handler,
+ boost::system::error_code const& ec,
+ const std::size_t bytes_transferred
+ )
+ {
+ if(ec)
+ handler(ec);
+ else
{
- if (read_header(impl, ec))
- break;
- int id(fcgi::spec::get_request_id(impl.header_buf_));
- if (id == fcgi::spec::null_request_id::value)
+ int id(spec::get_request_id(impl.header_buf_));
+ if (id == spec::null_request_id::value)
handle_admin_request(impl);
else
- if (fcgi::spec::get_type(impl.header_buf_)
- == fcgi::spec::begin_request::value)
+ if (impl.id_ && impl.id_ != id)
+ {
+ // The library doesn't "officially" support multiplexed
+ // connections yet, because I've never had access to a server
+ // that supports it.
+ //
+ // If you have one, can I use it?
+ handler(error::multiplexing_not_supported);
+ }
+ else
+ if (spec::get_type(impl.header_buf_)
+ == spec::begin_request::value)
{
impl.id_ = id;
impl.client_.request_id_ = id;
- if (read_header(impl, ec))
- break;
- impl.request_role_ = fcgi::spec::begin_request::get_role(impl.header_buf_);
- //std::cerr<< "[hw] New request role: " << impl.request_role_
- // << " (" << fcgi::spec::role_type::to_string(impl.header_buf_) << ")"
- // << std::endl;
- impl.client_.keep_connection_
- = fcgi::spec::begin_request::get_flags(impl.header_buf_)
- & fcgi::spec::keep_connection;
- //std::cerr<< "keep connection := " << impl.client_.keep_connection_ << std::endl;
- break;
+ if (!read_header(impl, ec))
+ {
+ spec::begin_request packet(impl.header_buf_);
+ impl.request_role_ = packet.role();
+ impl.client_.keep_connection_
+ = packet.flags() & spec::keep_connection;
+ strand_.post(&self_type::handle_begin_request_header,
+ this, boost::ref(impl), handler, _1
+ );
+ }
}else
handle_other_request_header(impl);
}
-
- read_env_vars(impl, ec);
-
- if (parse_stdin)
+ }
+
+ template<typename Handler>
+ BOOST_CGI_INLINE
+ void fcgi_request_service::handle_begin_request_header(
+ implementation_type& impl,
+ Handler handler,
+ boost::system::error_code const& ec
+ )
+ {
+ if (//impl.request_status_ < common::env_read &&
+ opts & common::parse_env)
{
- while(!ec
- && impl.client_.status() < common::stdin_read
- && impl.request_status_ != common::loaded)
- {
- parse_packet(impl, ec);
- }
+ read_env_vars(impl, ec);
+ //impl.request_status_ = common::env_read;
}
- const std::string& request_method = env_vars(impl.vars_)["REQUEST_METHOD"];
+
+ string_type const&
+ 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_post_only)
+ {
+ //std::cerr<< "Parsing post vars now.\n";
+
+ if (opts & common::parse_post_only)
+ {
+ while(!ec
+ && impl.client_.status() < common::stdin_read
+ && impl.request_status_ != common::loaded)
+ {
+ parse_packet(impl, ec);
+ }
+ }
+
if (parse_post_vars(impl, ec))
return ec;
-
- parse_cookie_vars(impl, ec);
-
- return ec;
+ }
+ if (opts & common::parse_cookies_only)
+ parse_cookie_vars(impl, ec);
+
+ if (ec == error::eof) {
+ ec = boost::system::error_code();
+ }
}
// **FIXME**
template<typename Handler> BOOST_CGI_INLINE
void fcgi_request_service::async_load(
- implementation_type& impl, bool parse_stdin, Handler handler)
+ implementation_type& impl, common::parse_options opts, Handler handler)
{
+ strand_.post(
+ boost::bind(&self_type::do_load<Handler>,
+ this, boost::ref(impl), opts, handler
+ )
+ );
+
this->io_service().post(
- detail::async_load_helper<self_type, Handler>(this, parse_stdin, handler)
+ detail::async_load_helper<self_type, Handler>(this, opts & common::parse_post_only, handler)
);
}
+ /// Check if the params have been read (ie. FCGI_PARAMS packets)
BOOST_CGI_INLINE
bool fcgi_request_service::params_read(implementation_type& impl)
{
return impl.client_.status() >= common::params_read;
}
- BOOST_CGI_INLINE
- void fcgi_request_service::set_status(
- implementation_type& impl, common::request_status status)
- {
- impl.request_status_ = status;
- }
-
/// Read and parse the cgi POST meta variables (greedily)
BOOST_CGI_INLINE boost::system::error_code&
fcgi_request_service::parse_post_vars(
implementation_type& impl
, boost::system::error_code& ec)
{
- // Make sure this function hasn't already been called
- //BOOST_ASSERT( impl.post_vars().empty() );
-
- //# error "Not implemented"
- // **FIXME** should use form_parser, when it's ready.
- // Only works with url-encoded forms (ie. not with multipart forms)
- /*
- std::string name;
- std::string str;
-
- char ch;
- char ch1;
- while( impl.client_.bytes_left_ )
- {
- ch = getchar();
- --impl.client_.bytes_left_;
-
- switch(ch)
- {
- case '%': // unencode a hex character sequence
- if (impl.client_.bytes_left_ >= 2)
- {
- ch = getchar();
- ch1 = getchar();
- if (std::isxdigit(ch) && std::isxdigit(ch1))
- {
- str.append(1, detail::hex_to_char(ch, ch1));
- }
- else // we don't have a hex sequence
- {
- str.append(1, '%').append(1, ch).append(1, ch1);
- }
- impl.client_.bytes_left_ -= 2;
- }
- else // There aren't enough characters to make a hex sequence
- {
- str.append(1, '%');
- --impl.client_.bytes_left_;
- }
- break;
- case '+':
- str.append(1, ' ');
- break;
- case ' ': // skip spaces
- break;
- case '=': // the name is complete, now get the corresponding value
- name.swap(str);
- break;
- case '&': // we now have the name/value pair, so save it
- // **FIXME** have to have .c_str() ?
- ::cgi::common::post_vars(impl.vars_)[name.c_str()] = str;
- str.clear();
- name.clear();
- break;
- default:
- str.append(1, ch);
- }
- }
- // save the last param (it won't have a trailing &)
- if( !name.empty() )
- // **FIXME** have to have .c_str() ?
- ::cgi::common::post_vars(impl.vars_)[name.c_str()] = str;
- */
-
- impl.fp_.reset
- (
- new implementation_type::form_parser_type
- ( impl.post_buffer_
- , post_vars(impl.vars_)
- , env_vars(impl.vars_)["CONTENT_TYPE"]
- , callback_functor<self_type>(impl, this)
- , impl.client_.bytes_left_
- , impl.stdin_parsed_
- )
- );
- impl.fp_->parse(ec);
-
- return ec;
+ impl.client_.bytes_left_
+ = boost::lexical_cast<std::size_t>(
+ env_vars(impl.vars_)["CONTENT_LENGTH"]);
+
+ return base_type::parse_post_vars(
+ impl,
+ callback_functor<implementation_type, self_type>(impl, this),
+ ec
+ );
}
/// Read and parse a single cgi POST meta variable (greedily)
@@ -355,12 +406,12 @@
{
if (impl.client_.status_ == common::closed_)
{
- ec = error::client_closed;
+ ec = common::error::client_closed;
return 0;
}
//if (read_header(ec))
- return -1;
+ return 0;
//boost::tribool state = parse_header(impl);
//std::size_t bytes_read;//( connection_->read_some(buf, ec) );
@@ -373,7 +424,7 @@
fcgi_request_service::read_env_vars(
implementation_type& impl, boost::system::error_code& ec)
{
- while(!ec && !params_read(impl))
+ while(!ec && !(status(impl) & common::env_read))
{
if (this->read_header(impl, ec))
return ec;
@@ -381,24 +432,34 @@
boost::tribool state = this->parse_header(impl);
if (state)
- // the header has been handled and all is ok; continue.
- return ec;
+ { // the header has been handled and all is ok; continue.
+ impl.client_.status(common::params_read);
+ status(impl, (common::request_status)(status(impl) | common::env_read));
+ }
else
if (!state)
- // The header is confusing; something's wrong. Abort.
- return error::bad_header_type;
-
- // else => (state == boost::indeterminate)
+ { // The header is confusing; something's wrong. Abort.
+ ec = error::bad_header_type;
+ }
+ else // => (state == boost::indeterminate)
+ {
+ std::size_t remaining(
+ fcgi::spec::get_length(impl.header_buf_));
- implementation_type::mutable_buffers_type buf
- = impl.prepare_misc(fcgi::spec::get_length(impl.header_buf_));
+ if (remaining)
+ {
+ implementation_type::mutable_buffers_type buf
+ = impl.prepare_misc(remaining);
- if (this->read_body(impl, buf, ec))
- return ec;
+ if (this->read_body(impl, buf, ec))
+ return ec;
- this->parse_body(impl, buf, ec);
+ this->parse_body(impl, buf, ec);
+ } else
+ ec = error::couldnt_write_complete_packet;
+ }
- } // while(!ec && !params_read(impl))
+ } // while(!ec && !(status(impl) & common::env_read))
return ec;
}
@@ -411,24 +472,34 @@
// clear the header first (might be unneccesary).
impl.header_buf_ = implementation_type::header_buffer_type();
- if (8 != read(*impl.client_.connection_, buffer(impl.header_buf_)
+ if (8 != read(*impl.client_.connection(), buffer(impl.header_buf_)
, boost::asio::transfer_all(), ec) || ec)
return ec;
- //if (ec) return ec;
+ return ec;
+ }
- /*
- std::cerr<< std::endl
- << "[hw] Header details {" << std::endl
- << " RequestId := " << fcgi::spec::get_request_id(impl.header_buf_) << std::endl
- << " FastCGI version := " << fcgi::spec::get_version(impl.header_buf_) << std::endl
- << " Type := " << fcgi::spec::get_type(impl.header_buf_)
- << " (" << fcgi::spec::request_type::to_string(impl.header_buf_) << ")" << std::endl
- << " Content-length := " << fcgi::spec::get_content_length(impl.header_buf_) << std::endl
- << "}" << std::endl;
- */
+ template<typename Handler>
+ BOOST_CGI_INLINE void
+ fcgi_request_service::async_read_header(
+ implementation_type& impl
+ , Handler handler
+ , boost::system::error_code& ec)
+ {
+ // clear the header first (might be unneccesary).
+ impl.header_buf_ = implementation_type::header_buffer_type();
- return ec;
+ boost::asio::async_read(
+ *impl.client_.connection(), buffer(impl.header_buf_)
+ , boost::asio::transfer_all()
+ , strand_.wrap(
+ boost::bind(&self_type::handle_read_header,
+ this, boost::ref(impl), handler,
+ boost::asio::placeholders::error,
+ boost::asio::placeholders::bytes_transferred
+ )
+ )
+ )
}
/*** Various handlers go below here; they might find a
@@ -453,7 +524,7 @@
BOOST_CGI_INLINE boost::system::error_code
fcgi_request_service::process_abort_request(
implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t
+ , const unsigned char* buf, boost::uint32_t
, boost::system::error_code& ec)
{
if (id == fcgi::spec::get_request_id(impl.header_buf_))
@@ -468,39 +539,26 @@
}catch(...){
ec = error::abort_request_record_recieved_for_invalid_request;
}
-/*
- connection_type::request_map_type::iterator i
- = connection_->find(id);
-
- if (i == connection_type::request_map_type::iterator())
- {
- return bad_request_id;
- }
-
- //lookup_request(id).abort();
-*/
return ec;
}
BOOST_CGI_INLINE boost::system::error_code
fcgi_request_service::process_params(
implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t len
+ , const unsigned char* buf, boost::uint32_t len
, boost::system::error_code& ec)
{
if (0 == len)
{ // This is the final param record.
- impl.client_.status_ = common::params_read;
-
- //std::cerr<< "[hw] Final PARAM record found." << std::endl;
+ impl.client_.status(common::params_read);
return ec;
}
while(len)
{
boost::uint32_t name_len, data_len;
- std::string name, data;
+ string_type name, data;
if (*buf >> 7 == 0)
{
name_len = *(buf++);
@@ -535,10 +593,6 @@
buf += (name_len + data_len);
len -= (name_len + data_len);
- //std::cerr<< "[hw] name := " << name << std::endl;
- //std::cerr<< "[hw] data := " << data << std::endl;
-
- // **FIXME**
env_vars(impl.vars_)[name.c_str()] = data;
}
@@ -549,20 +603,14 @@
BOOST_CGI_INLINE boost::system::error_code
fcgi_request_service::process_stdin(
implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t len
+ , const unsigned char* buf, boost::uint32_t len
, boost::system::error_code& ec)
{
if (0 == len)
{
- impl.client_.status_ = common::stdin_read;
-
- // **FIXME**
- //std::cerr<< "[hw] Final STDIN record found." << std::endl;
+ impl.client_.status(common::stdin_read);
return ec;
}
-
- // **FIXME**
- //std::cerr<< "[hw] Found some STDIN stuff." << std::endl;
return ec;
}
@@ -578,11 +626,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;
+ case PARAMS:
+ if (0 == fcgi::spec::get_length(impl.header_buf_)) {
+ impl.client_.status(common::params_read);
+ return true;
+ } else
+ return boost::indeterminate;
case ABORT_REQUEST:
return false;
case UNKNOWN_TYPE:
@@ -595,31 +653,34 @@
fcgi_request_service::parse_packet(
implementation_type& impl, boost::system::error_code& ec)
{
- //current_request_ = &req;
-
if (this->read_header(impl, ec))
return ec;
boost::tribool state = this->parse_header(impl);
if (state)
- { // the header has been handled and all is ok; continue.
- return ec;
- }else
+ {
+ // the header has been handled and all is ok.
+ // **NOOP**
+ } else
if (!state)
{ // The header is confusing; something's wrong. Abort.
- return error::bad_header_type;
+ ec = error::bad_header_type;
}
- // 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;
+ else
+ {
+ 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);
+ }
+ }
return ec;
}
@@ -631,7 +692,8 @@
, boost::system::error_code& ec)
{
std::size_t bytes_read
- = read(*impl.client_.connection_, buf, boost::asio::transfer_all(), ec);
+ = read(*impl.client_.connection(), buf
+ , boost::asio::transfer_all(), ec);
BOOST_ASSERT(bytes_read == fcgi::spec::get_length(impl.header_buf_)
&& "Couldn't read all of the record body.");
@@ -644,14 +706,29 @@
implementation_type& impl, const MutableBuffersType& buf
, boost::system::error_code& ec)
{
- return
- (this->* proc_funcs[fcgi::spec::get_type(impl.header_buf_)])
- (impl, fcgi::spec::get_request_id(impl.header_buf_)
- , boost::asio::buffer_cast<unsigned char*>(buf)
- , boost::asio::buffer_size(buf), ec);
+ switch(fcgi::spec::get_type(impl.header_buf_))
+ {
+ case 1: process_begin_request(impl, fcgi::spec::get_request_id(impl.header_buf_)
+ , boost::asio::buffer_cast<unsigned char*>(buf)
+ , boost::asio::buffer_size(buf), ec);
+ break;
+ case 2: process_abort_request(impl, fcgi::spec::get_request_id(impl.header_buf_)
+ , boost::asio::buffer_cast<unsigned char*>(buf)
+ , boost::asio::buffer_size(buf), ec);
+ break;
+ case 4: process_params(impl, fcgi::spec::get_request_id(impl.header_buf_)
+ , boost::asio::buffer_cast<unsigned char*>(buf)
+ , boost::asio::buffer_size(buf), ec);
+ break;
+ case 5: process_stdin(impl, fcgi::spec::get_request_id(impl.header_buf_)
+ , boost::asio::buffer_cast<unsigned char*>(buf)
+ , boost::asio::buffer_size(buf), ec);
+ break;
+ default: break;
+ }
+ return ec;
}
-
BOOST_CGI_INLINE boost::system::error_code
fcgi_request_service::begin_request_helper(
implementation_type& impl
@@ -668,61 +745,30 @@
if (read_header(impl, ec))
return ec;
- impl.request_role_
- = fcgi::spec::begin_request::get_role(impl.header_buf_);
- // **FIXME** (rm impl.request_role_)
- impl.client_.role_ = impl.request_role_;
+ spec::begin_request packet(impl.header_buf_);
+ impl.request_role_ = packet.role();
+ impl.client_.role_ = packet.role();
impl.client_.keep_connection_
- = fcgi::spec::begin_request::get_flags(impl.header_buf_)
- & fcgi::spec::keep_connection;
+ = packet.flags() & spec::keep_connection;
+
impl.client_.status_ = common::constructed;
return ec;
}
- //template<>
- const fcgi_request_service::proc_func_t fcgi_request_service::proc_funcs[] =
- { 0
- , &fcgi_request_service::process_begin_request
- , &fcgi_request_service::process_abort_request
- , 0
- , &fcgi_request_service::process_params
- , &fcgi_request_service::process_stdin
- , 0
- , 0
- };
-
} // namespace fcgi
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#include "boost/cgi/fcgi/request.hpp"
#include "boost/cgi/basic_request.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace fcgi {
-/*
- fdetail::request_type&
- get_or_make_request(implementation_type& impl, boost::uint16_t id)
- {
- implementation_type::client_type::connection_type::request_vector_type&
- requests = impl.client_.connection_->requests_;
-
- if (!requests.at(id-1))
- {
- if (requests.size() < (id-1))
- requests.resize(id);
- requests.at(id-1) = fdetail::request_type::create(*impl.service_);
- }
-
- return *requests.at(id-1);
- }
-*/
-
BOOST_CGI_INLINE boost::system::error_code
fcgi_request_service::process_begin_request(
implementation_type& impl, boost::uint16_t id
- , const unsigned char* buf, boost::uint16_t
+ , const unsigned char* buf, boost::uint32_t
, boost::system::error_code& ec)
{
if (impl.client_.request_id_ == 0) // ie. hasn't been set yet.
@@ -734,29 +780,14 @@
//std::cerr<< "**FIXME** Role: "
// << fcgi::spec::begin_request::get_role(impl.header_buf_) << std::endl;
- implementation_type::client_type::connection_type&
- conn = *impl.client_.connection_;
-
- if (conn.get_slot(id, ec))
- { // error
- return ec;
- }
-
- // **FIXME** THIS LEAKS MEMORY!!!!!!!
- //requests.at(id-1)
- request_type* new_request = new request_type(impl, ec);
-
- conn.add_request(id, new_request, true, ec);
-
- return ec;//error::multiplexed_request_incoming;
+ //implementation_type::client_type::connection_type&
+ // conn = *impl.client_.connection();
}
-
return ec;
}
-
} // namespace fcgi
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_FCGI_REQUEST_SERVICE_IPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/form_parser.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/form_parser.ipp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/form_parser.ipp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,80 +11,47 @@
#include "boost/cgi/error.hpp"
#include "boost/cgi/basic_client.hpp"
+#include "boost/cgi/common/form_part.hpp"
#include "boost/cgi/detail/url_decode.hpp"
-#include "boost/cgi/common/form_parser.hpp"
#include "boost/cgi/common/source_enums.hpp"
+#include "boost/cgi/config.hpp"
-namespace cgi {
- namespace detail {
+#include <fstream>
+#include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/trim.hpp>
+#include <boost/random/mersenne_twister.hpp>
+
+/// Characters that should be removed from any file uploads.
+/**
+ * The filename of any file uploads is a stripped version of
+ * the provided file's name. As such, we need to clean the uploaded
+ * file's name.
+ */
+#ifndef BOOST_CGI_UNSAFE_FILENAME_CHARS
+# define BOOST_CGI_UNSAFE_FILENAME_CHARS ":~.|"
+#endif // BOOST_CGI_UNSAFE_FILENAME_CHARS
-/*
- BOOST_CGI_INLINE
- form_parser::form_parser (
- )
- : content_type_(env_vars(impl.vars_)["CONTENT_TYPE"])
- , buffer_(impl.buffer_)
- , bytes_left_(impl.client_.bytes_left_)
- //, stdin_data_read_(impl.stdin_data_read_)
- , offset_(0)
- , data_map_(post_vars(impl.vars_))
- , callback_()
- {
- }
-
- BOOST_CGI_INLINE
- form_parser::form_parser (
- , callback_type const& callback
- )
- : content_type_(env_vars(impl.vars_)["CONTENT_TYPE"])
- , buffer_(impl.buffer_)
- , bytes_left_(impl.client_.bytes_left_)
- //, stdin_data_read_(impl.stdin_data_read_)
- , offset_(0)
- , data_map_(post_vars(impl.vars_))
- , callback_(callback)
- {
- }
-*/
+BOOST_CGI_NAMESPACE_BEGIN
- BOOST_CGI_INLINE
- form_parser::form_parser (
- buffer_type& buf
- , common::post_map& data_map
- , form_parser::string_type const& ct
- , callback_type const& callback
- , std::size_t& bytes_left
- , bool& stdin_parsed
- )
- : content_type_(ct)//env_vars(impl.vars_)["CONTENT_TYPE"])
- , buffer_(buf)
- , bytes_left_(bytes_left)
- , data_map_(data_map)
- , callback_(callback)
- , stdin_parsed_(stdin_parsed)
- , offset_(0)
- {
- }
+ namespace common {
BOOST_CGI_INLINE
boost::system::error_code
- form_parser::parse(boost::system::error_code& ec)
+ form_parser::parse(context ctx, boost::system::error_code& ec)
{
- BOOST_ASSERT(!content_type_.empty());
+ context_ = &ctx;
+
+ BOOST_ASSERT(!ctx.content_type.empty());
- if (boost::algorithm::ifind_first(content_type_,
- "application/x-www-form-urlencoded"))
- {
+ if (ctx.content_type.find(
+ "application/x-www-form-urlencoded") != string_type::npos)
parse_url_encoded_form(ec);
- }
else
- if (boost::algorithm::ifind_first(content_type_,
- "multipart/form-data"))
- {
+ if (ctx.content_type.find(
+ "multipart/form-data") != string_type::npos)
parse_multipart_form(ec);
- }
else
- return ec = error::invalid_form_type;
+ return ec = common::error::invalid_form_type;
return ec;
}
@@ -93,63 +60,57 @@
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
- {
- 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);
+ buffer_type& str(context_->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, detail::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();
+ context_->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;
+ if( !name.empty() ) {
+ context_->data_map[name.c_str()] = result;
+ }
+#endif // BOOST_CGI_KEEP_EMPTY_VARS
+ return ec;
}
/// Parse a multipart form.
@@ -158,17 +119,10 @@
form_parser::parse_multipart_form(boost::system::error_code& ec)
{
parse_boundary_marker(ec);
-
move_to_start_of_first_part(ec);
- if (ec && ec != boost::asio::error::eof)
- return ec;
-
- do {
+ while(!ec && !context_->stdin_parsed)
parse_form_part(ec);
- }while( //!impl_.stdin_parsed_
- bytes_left_ // != 0
- );//&& ec != boost::asio::error::eof );
return ec;
}
@@ -178,218 +132,96 @@
boost::system::error_code
form_parser::parse_form_part(boost::system::error_code& ec)
{
- if (!parse_form_part_meta_data(ec)
- && !parse_form_part_data(ec))
- return ec;
+ namespace algo = boost::algorithm;
- return ec;
- }
-
- BOOST_CGI_INLINE
- boost::system::error_code
- form_parser::parse_form_part_data(boost::system::error_code& ec)
- {
- std::string regex("^(.*?)" // the data
- "\\x0D\\x0A" // CR LF
- "--" "(");
- if (boundary_markers.size() > 1)
+ string_type marker(
+ string_type("--") + context_->boundary_markers.front());
+ string_type& buffer(context_->buffer);
+ std::size_t& offset (context_->offset);
+
+ std::size_t end = buffer.find("\r\n\r\n", offset);
+ if (end == string_type::npos)
+ return ec = common::error::multipart_meta_data_not_terminated;
+
+ string_type meta (buffer.substr(offset,end-offset));
+
+ // sic - short-cut check for Content-Disposition.
+ std::size_t pos1 = meta.find("isposition:"); // sic
+ std::size_t pos2 = meta.find(";", pos1);
+ std::size_t pos3 = meta.find("name=");
+ std::size_t pos4 = meta.find(";", pos3);
+ std::size_t pos5 = meta.find("\r\n");
+ std::size_t pos6 = meta.find("filename=", pos2);
+
+ if (pos3 == string_type::npos)
+ pos3 = meta.find("\r\n");
+ string_type field_name (meta.substr(pos3+5, pos4-pos3-5));
+ algo::trim_if(field_name, algo::is_any_of("\" "));
+
+ common::form_part part;
+ part.name = field_name;
+ part.content_disposition = meta.substr(pos1+11, pos2-pos1-11);
+
+ std::size_t next_pos = buffer.find(string_type("\r\n") + marker, end);
+
+ if (pos6 == string_type::npos)
{
- std::list<std::string>::iterator i(boundary_markers.begin());
- regex = regex + "(?:" + *i + ")";
- ++i;
- for(; i != boundary_markers.end(); ++i)
- {
- regex = regex + "|(?:" + *i + ")";
- }
+ string_type content (
+ buffer.substr(meta.length()+4, next_pos-meta.length()-4));
+
+ // Load the data to the request's post map.
+ part.value = content;
}
else
{
- regex += *boundary_markers.begin();
- }
-
- regex += ")(--)?[ ]*\\x0D\\x0A";
- boost::regex re(regex);
-
- typedef buffer_type::iterator buffer_iter;
-
- boost::match_results<buffer_iter> matches;
-
- std::size_t offset = offset_;
-
- //int runs = 0;
- buffer_iter begin(buffer_.begin() + offset);
- buffer_iter end(buffer_.end());
-
- for(;;)
- {
- if (!boost::regex_search(begin, end, matches, re
- , boost::match_default
- | boost::match_partial))
+ 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.
+ //part.value = "<FileUpload: '" + 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
+ // here. Leaving that out as it would not be expected, AFAIK.
+ if (!filename.empty())
{
- return boost::system::error_code(345, boost::system::system_category);
- }
- else
- {
- if (matches[1].matched)
- {
- form_parts_.back().buffer_
- // = boost::range_iterator<;
- = std::make_pair(matches[1].first, matches[1].second);
- // **FIXME**
- data_map_[form_parts_.back().name.c_str()] = matches[1];
- //std::ofstream of("c:/cc/log/post_vars.log");
- //of<< "var == " << matches[1] << std::endl;
- offset_ = offset + matches[0].length();
- pos_ = matches[0].second;
-
- if (matches[3].matched)
- {
- bytes_left_ = 0; // stop reading completely.
- //impl_.stdin_parsed_ = true;
- }
- return ec;
- }
- else
- {
- std::size_t bytes_read
- = callback_(ec);
- //impl_.client_.read_some(prepare(64), ec);
-
- if (bytes_read == 0 && bytes_left_ == 0) // **FIXME**
- {
- //stdin_data_read_ = true;
- return ec;
- }
-
- begin = buffer_.begin() + offset;
- end = buffer_.end();
-
- if (ec)
- return ec;
- }
+ part.filename = filename;
+ // Load the data to a local file.
+ string_type content (
+ buffer.substr(meta.length()+4, next_pos-meta.length()-4));
+ //boost::mt19937 rng(time(NULL));
+ string_type randomatter (
+ boost::lexical_cast<string_type>(time(NULL)));
+ string_type user_ip (context_->random_string);
+ // Clean dangerous characters.
+ algo::trim_if(filename, algo::is_any_of(BOOST_CGI_UNSAFE_FILENAME_CHARS));
+ string_type internal_filename(
+ BOOST_CGI_UPLOAD_DIRECTORY+filename+"."+user_ip+"."+randomatter);
+ part.path = internal_filename;
+ std::ofstream file (
+ internal_filename.c_str()
+ , std::ios::out | std::ios::binary);
+ file<< content;
+ //file.flush();
+ context_->uploads_map[part.name.c_str()] = part;
}
}
-
- return ec;
- }
-
- BOOST_CGI_INLINE
- boost::system::error_code
- form_parser::parse_form_part_meta_data(boost::system::error_code& ec)
- {
- // Oh dear this is ugly. The move to Boost.Spirit will have to be sooner than planned.
- // (it's a nested, recursive pattern, which regexes don't suit, apparently)
- boost::regex re( "(?:" // [IGNORE] the line may be empty, as meta-data is optional
- "^"
- "([-\\w]+)" // name
- ":[ ^]*" // separator
- "([-/\\w]+)" // optional(?) value
- ""
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?"
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?" // mark the extra n/v pairs optional
- "\\x0D\\x0A"
- ")"
- "(?:"
- "([-\\w]+)" // name
- ":[ ^]*" // separator
- "([-/\\w]+)" // optional(?) value
- ""
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?"
- "(?:"
- ";"
- "[ ]*" // additional name/value pairs (don't capture)
- "([-\\w]+)" // name
- "[ \\x0D\\x0A]*=[ \\x0D\\x0A]*" // separator
- "(?:\"?([-.\\w]*)\"?)" // value may be empty
- ")?" // mark the extra n/v pairs optional
- "\\x0D\\x0A" // followed by the end of the line
- ")?"
- "(\\x0D\\x0A)"); // followed by the 'header termination' line
-
- typedef buffer_type::iterator buffer_iter;
-
- boost::match_results<buffer_iter> matches;
-
- std::size_t offset = offset_;
- pos_ = buffer_.begin();
- int runs = 0;
-
- std::size_t bytes_read = 0;
- for(;;)
+ // Load the data to the request's post map.
+ context_->data_map[part.name.c_str()] = part.value;
+
+ buffer.erase(0, next_pos+marker.length()+2);
+ if (buffer.length() >= 2
+ && buffer.substr(0,2) == "--")
{
- buffer_iter begin(buffer_.begin() + offset);
- buffer_iter end(buffer_.end());
-
- if (!boost::regex_search(begin, end, matches, re
- , boost::match_default | boost::match_partial))
- {
- stdin_parsed_ = true;
- return ec;
- }
- if (matches[0].matched)
- {
- common::form_part part;
- for ( unsigned int i = 1
- ; i < matches.size()
- && matches[i].matched
- && !matches[i].str().empty()
- ; i+=2)
- {
- if (matches[i].str() == "name")
- {
- part.name = matches[i+1];
- }
- else
- {
- part.meta_data_[matches[i]]
- = std::make_pair(matches[i+1].first, matches[i+1].second);
- }
- form_parts_.push_back(part);
- }
-
- if (matches[13].str() == "\r\n")
- {
- offset_ = offset + matches[0].length();
- offset += matches[0].length();
- pos_ = matches[0].second;
-
- return ec;
- }
- else
- {
- throw std::runtime_error("Invalid POST data (header wasn't terminated as expected)");
- }
-
- }else{
- bytes_read
- = callback_(ec);
- if (ec)
- return ec;
- if (++runs > 40)
- {
- //std::cerr<< "Done 40 runs; bailing out" << std::endl;
- break;
- }
- }
+ //ec = common::error::eof;
+ context_->stdin_parsed = true;
+ context_->bytes_left = 0;
}
+ else
+ if (buffer.length() == 0)
+ context_->bytes_left = 0;
+
+ buffer.erase(0,2);
return ec;
}
@@ -398,58 +230,19 @@
boost::system::error_code
form_parser::move_to_start_of_first_part(boost::system::error_code& ec)
{
- boost::regex re("((?:.*)?" // optional leading characters
- //"(?:\\x0D\\x0A)|^" // start of line
- "[\\x0D\\x0A^]*?"
- "("
- "--" + boundary_markers.front() + // two dashes and our marker
- ")"
- "(--)?" // optional two dashes (not sure if this is allowed)
- " *\\x0D\\x0A)");
- // on the first marker.
-
- typedef buffer_type::iterator buffer_iter;
- //std::cerr<< "Regex := " << re << std::endl;
-
- boost::match_results<buffer_iter> matches;
-
- // get data into our buffer until we reach the first boundary marker.
- int runs = 0;
- std::size_t offset = 0;
- std::size_t bytes_read = 0;
- for(;;)
- {
- bytes_read
- = callback_(ec);
+ string_type marker(
+ string_type("--") + context_->boundary_markers.front() + "\r\n");
+ string_type& buffer(context_->buffer);
+
+ std::size_t pos = buffer.find(marker);
+
+ if (pos == string_type::npos)
+ ec = common::error::multipart_form_boundary_not_found;
+ else
+ buffer.erase(0, pos+marker.length());
+
+ ec = boost::system::error_code();
- if (ec || (bytes_read == 0))
- return ec;
- buffer_iter begin(buffer_.begin());// + offset);
- buffer_iter end(buffer_.end());
- if (!boost::regex_search(begin, end //impl.buffer_.begin(), impl.buffer_.end()
- , matches, re, boost::match_default | boost::match_partial))
- {
- offset = buffer_.size();
- continue;
- }
- else
- {
- if (matches[2].matched)
- {
- buffer_.erase(buffer_.begin(), matches[0].second);
- offset_ = 0;
- pos_ = buffer_.begin();
- return ec;
- }
- else
- {
- if (++runs > 10)
- return ec;
- continue;
- }
- }
- }
- // skip that line and then erase the buffer
return ec;
}
@@ -457,24 +250,22 @@
boost::system::error_code
form_parser::parse_boundary_marker(boost::system::error_code& ec)
{
- //BOOST_ASSERT(!content_type.empty());
-
- boost::regex re("; ?boundary=\"?([^\"\n\r]+)\"?");
- boost::smatch match_results;
- if (!boost::regex_search(content_type_, match_results, re))
- return boost::system::error_code(666, boost::system::system_category);
-
- boundary_marker = match_results[1].str();
- // New boundary markers are added to the front of the list.
- boundary_markers.push_front(match_results[1].str());
- //std::cerr<< "boundary marker := " << boundary_marker << std::endl;
+ string_type& ctype(context_->content_type);
+ string_type& marker(context_->boundary_marker);
+
+ marker.assign(ctype.substr(ctype.find("boundary=")+9));
+ boost::algorithm::trim(marker);
+ if (marker.empty())
+ ec = common::error::no_boundary_marker;
+ else
+ context_->boundary_markers.push_front(marker);
return ec;
}
-
- } // namespace detail
-} // namespace cgi
+ } // namespace common
+
+BOOST_CGI_NAMESPACE_END
#endif // CGI_DETAIL_FORM_PARSER_IPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/impl/response.ipp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -19,19 +19,22 @@
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
///////////////////////////////////////////////////////////
-#include "boost/cgi/import/write.hpp"
-#include "boost/cgi/import/buffer.hpp"
+#include "boost/cgi/config.hpp"
+
#include "boost/cgi/common/cookie.hpp"
#include "boost/cgi/common/header.hpp"
+#include "boost/cgi/common/name.hpp"
#include "boost/cgi/common/response.hpp"
-#include "boost/cgi/http/status_code.hpp"
-#include "boost/cgi/import/streambuf.hpp"
#include "boost/cgi/detail/throw_error.hpp"
#include "boost/cgi/fwd/basic_request_fwd.hpp"
+#include "boost/cgi/http/status_code.hpp"
+#include "boost/cgi/import/buffer.hpp"
+#include "boost/cgi/import/streambuf.hpp"
+#include "boost/cgi/import/write.hpp"
-/// This mess outputs a default Content-type header if the user hasn't set any.
-/** **FIXME** Not implemented; not sure if it should be...
- * BOOST_CGI_ADD_DEFAULT_HEADER should not persiste beyond this file.
+/// A macro to output an implicit Content-type.
+/**
+ * `BOOST_CGI_ADD_DEFAULT_HEADER` should not persiste beyond this file.
*
* It basically works like (default first):
*
@@ -47,7 +50,6 @@
* Usage:
* ------
* // Default to a HTML content-type.
- * #define BOOST_CGI_DEFAULT_CONTENT_TYPE "text/html"
*/
#if defined(BOOST_CGI_NO_DEFAULT_CONTENT_TYPE)
//{
@@ -63,16 +65,23 @@
#endif // defined(BOOST_CGI_NO_DEFAULT_CONTENT_TYPE)
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
+
namespace common {
template<typename T> BOOST_CGI_INLINE
basic_response<T>::basic_response(http::status_code sc)
: buffer_(new common::streambuf())
+#if defined (BOOST_WINDOWS)
+ , ostream_(buffer_.get()) //, std::ios::out | std::ios::binary)
+#else
, ostream_(buffer_.get())
+#endif // defined (BOOST_WINDOWS)
, http_status_(sc)
, headers_terminated_(false)
+ , charset_("ISO-8859-1")
{
+ //ostream_.openmode =
}
/// Construct with a particular buffer
@@ -83,9 +92,16 @@
template<typename T> BOOST_CGI_INLINE
basic_response<T>::basic_response(common::streambuf* buf,
http::status_code sc)
+#if BOOST_WINDOWS
+ : ostream_(buf, std::ios::out | std::ios::binary)
+#else
: ostream_(buf)
+#endif // defined (BOOST_WINDOWS)
, http_status_(sc)
+ , headers_terminated_(false)
+ , charset_("ISO-8859-1")
{
+ //ostream_.openmode = std::ios::out | std::ios::binary;
}
template<typename T> BOOST_CGI_INLINE
@@ -95,18 +111,28 @@
/// Clear the response buffer.
template<typename T> BOOST_CGI_INLINE
- void basic_response<T>::clear()
+ void basic_response<T>::clear(bool clear_headers)
{
ostream_.clear();
- headers_.clear();
- headers_terminated_ = false;
+ buffer_.reset(new common::streambuf);
+ ostream_.rdbuf(buffer_.get());
+ if (clear_headers) {
+ headers_.clear();
+ headers_terminated_ = false;
+ }
}
- /// Return the response to the 'just constructed' state.
+ /// Return the response to the 'just constructed' state.
+ /**
+ * Clears the response headers and body. Resets the response so it can
+ * be safely used again.
+ */
template<typename T> BOOST_CGI_INLINE
void basic_response<T>::reset()
{
clear();
+ ostream_.flush();
+ buffer_->consume(buffer_->size());
headers_terminated_ = false;
}
@@ -214,7 +240,9 @@
common::write(sws, headers, boost::asio::transfer_all(), ec);
}
- common::write(sws, buffer_->data(), boost::asio::transfer_all(), ec);
+ // Only write the body if it is non-empty.
+ if (content_length())
+ common::write(sws, buffer_->data(), boost::asio::transfer_all(), ec);
return ec;
}
@@ -272,7 +300,7 @@
/// Set the status code associated with the response.
template<typename T> BOOST_CGI_INLINE
basic_response<T>&
- basic_response<T>::set_status(const http::status_code& num)
+ basic_response<T>::status(const http::status_code& num)
{
http_status_ = num;
return *this;
@@ -280,8 +308,8 @@
/// Get the status code associated with the response.
template<typename T> BOOST_CGI_INLINE
- http::status_code&
- basic_response<T>::status()
+ http::status_code
+ basic_response<T>::status() const
{
return http_status_;
}
@@ -300,6 +328,32 @@
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(bool include_header) const
+ {
+ string_type body;
+ if (include_header)
+ {
+ typedef typename std::vector<string_type>::const_iterator iter_t;
+ for (
+ iter_t iter(headers_.begin()), end(headers_.end());
+ iter != end;
+ ++iter
+ ) {
+ body += *iter;
+ }
+ }
+
+ body += string_type(
+ boost::asio::buffer_cast<const char_type *>(buffer_->data()),
+ boost::asio::buffer_size(buffer_->data()));
+
+ return body;
+ }
+
+
/// Add a header after appending the CRLF sequence.
template<typename T> BOOST_CGI_INLINE
basic_response<T>&
@@ -324,6 +378,23 @@
}
template<typename T> BOOST_CGI_INLINE
+ typename basic_response<T>::string_type
+ basic_response<T>::header_value(string_type const& name)
+ {
+ for(std::vector<std::string>::iterator iter = headers_.begin(), end = headers_.end();
+ iter != end; ++iter)
+ {
+ if (iter->substr(0,name.length()) == name)
+ {
+ // Extract the value (assumes there's at most one space after the separator.
+ int start(name.length() + (iter->at(name.length()+1) == ' ' ? 2 : 1));
+ return iter->substr(start, iter->length()-start-2); // strip the trailing \r\n
+ }
+ }
+ return headers_.back();
+ }
+
+ template<typename T> BOOST_CGI_INLINE
void basic_response<T>::clear_headers()
{
BOOST_ASSERT(!headers_terminated_);
@@ -343,55 +414,69 @@
return headers_terminated_;
}
- // Is this really necessary?
+ // Is this really necessary?
template<typename T> BOOST_CGI_INLINE
void basic_response<T>::end_headers()
{
headers_terminated_ = true;
}
- /// Get the ostream containing the response body.
+ /// Get the ostream containing the response body.
template<typename T> BOOST_CGI_INLINE
typename basic_response<T>::ostream_type&
basic_response<T>::ostream() { return ostream_; }
+ /// Get the ostream containing the response body.
+ template<typename T> BOOST_CGI_INLINE
+ std::vector<typename basic_response<T>::string_type>&
+ basic_response<T>::headers() { return headers_; }
+
// Send the response headers and mark that they've been sent.
template<typename T>
template<typename ConstBufferSequence> BOOST_CGI_INLINE
void basic_response<T>::prepare_headers(ConstBufferSequence& headers)
{
BOOST_CGI_ADD_DEFAULT_HEADER;
-
+
// Terminate the headers.
if (!headers_terminated_)
headers_.push_back("\r\n");
- //{ Construct a ConstBufferSequence out of the headers we have.
- //std::vector<boost::asio::const_buffer> headers;
- typedef typename std::vector<string_type>::iterator iter;
- for (iter i(headers_.begin()), e(headers_.end()); i != e; ++i)
+ typedef typename std::vector<string_type>::iterator iter_t;
+ for (
+ iter_t iter(headers_.begin()), end(headers_.end());
+ iter != end;
+ ++iter
+ )
{
- headers.push_back(common::buffer(*i));
+ boost::cgi::common::name type(iter->substr(0, 12).c_str());
+ if (type == "Content-type")
+ iter->insert(iter->length()-2, "; charset: " + charset_);
+
+ //{ Construct a ConstBufferSequence out of the headers we have.
+ headers.push_back(common::buffer(*iter));
}
//}
headers_terminated_ = true;
- //return ec;
}
- } // namespace common
-} // namespace cgi
-
- /// Generic ostream template
- template<typename T, typename U> BOOST_CGI_INLINE
- cgi::common::basic_response<T>&
- operator<< (cgi::common::basic_response<T>& resp, const U& u)
+ template<typename T> BOOST_CGI_INLINE
+ BOOST_CGI_NAMESPACE::common::basic_response<T>&
+ operator<< (BOOST_CGI_NAMESPACE::common::basic_response<T>& resp
+ , BOOST_CGI_NAMESPACE::common::basic_cookie<T> const& ck)
{
- resp.ostream()<< u;
+ BOOST_ASSERT(!resp.headers_terminated());
+ resp.set_header("Set-cookie", ck.to_string());
return resp;
}
- /// You can stream a cgi::header into a response.
+ } // namespace common
+
+BOOST_CGI_NAMESPACE_END
+
+ /// Generic ostream template
+ /// You can stream a BOOST_CGI_NAMESPACE::header into a response.
/**
* This is just a more convenient way of doing:
*
@@ -406,61 +491,17 @@
* effects; for instance, it won't write any data to the client.
* ]
*/
- template<typename T> BOOST_CGI_INLINE
- cgi::common::basic_response<T>&
- operator<< (cgi::common::basic_response<T>& resp
- , cgi::common::basic_header<T> const& hdr)
- {
- if (hdr.content.empty()) {
- resp.end_headers();
- return resp;
- }else{
- // We shouldn't allow headers to be sent after they're explicitly ended.
- BOOST_ASSERT(!resp.headers_terminated());
- resp.set_header(hdr.content);
- return resp;
- }
- }
-
- /// You can stream a cgi::cookie into a response.
+ /// You can stream a BOOST_CGI_NAMESPACE::cookie into a response.
/**
* This is just a shorthand way of setting a header that will set a
* client-side cookie.
*
* You cannot stream a cookie to a response after the headers have been
* terminated. In this case, an alternative could be to use the HTML tag:
- * <meta http-equiv="Set-cookie" ...> (see http://tinyurl.com/3bxftv or
- * http://tinyurl.com/33znkj), but this is outside the scope of this
- * library.
+ * <meta http-equiv="Set-cookie" ...> (see \url http://tinyurl.com/3bxftv
+ * or \url http://tinyurl.com/33znkj), but this is outside the scope of
+ * this library.
*/
- template<typename T> BOOST_CGI_INLINE
- cgi::common::basic_response<T>&
- operator<< (cgi::common::basic_response<T> const& resp
- , cgi::common::basic_cookie<T> ck)
- {
- BOOST_ASSERT(!resp.headers_terminated());
- resp.set_header("Set-cookie", ck.to_string());
- return resp;
- }
-
- template<typename T> BOOST_CGI_INLINE
- cgi::common::basic_response<T>&
- operator<< (cgi::common::basic_response<T>& resp
- , cgi::common::basic_cookie<T> const& ck)
- {
- BOOST_ASSERT(!resp.headers_terminated());
- resp.set_header("Set-cookie", ck.to_string());
- return resp;
- }
-
- template<typename T> BOOST_CGI_INLINE
- cgi::common::basic_response<T>&
- operator<< (cgi::common::basic_response<T>& resp
- , cgi::common::http::status_code status)
- {
- BOOST_ASSERT(!resp.headers_terminated());
- return resp.set_status(status);
- }
#undef BOOST_CGI_ADD_DEFAULT_HEADER
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/import/basic_io_object.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/import/basic_io_object.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/import/basic_io_object.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,13 +11,13 @@
#include <boost/asio/basic_io_object.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
using boost::asio::basic_io_object;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_IMPORT_BASIC_IO_OBJECT_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/import/buffer.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/import/buffer.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/import/buffer.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,7 +11,7 @@
#include <boost/asio/buffer.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/// Import the Boost.Asio overloads.
@@ -21,6 +21,6 @@
using common::buffer;
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/import/io_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/import/io_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/import/io_service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -15,13 +15,13 @@
#include <boost/asio/io_service.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
using boost::asio::io_service;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_COMMON_IO_SERVICE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/import/read.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/import/read.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/import/read.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,14 +11,14 @@
#include <boost/asio/read.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
using boost::asio::read;
using boost::asio::async_read;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_READ_HPP_INCLUDED
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/import/streambuf.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/import/streambuf.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/import/streambuf.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,12 +11,12 @@
#include <boost/asio/streambuf.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
using boost::asio::streambuf;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_STREAMBUF_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/import/write.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/import/write.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/import/write.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -11,13 +11,13 @@
#include <boost/asio/write.hpp>
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
using boost::asio::write;
using boost::asio::async_write;
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // CGI_WRITE_HPP_INCLUDED
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -29,11 +29,11 @@
*/
/// Dump acgi stuff into the boost namespace
-namespace boost {
- namespace scgi {
+BOOST_CGI_NAMESPACE_BEGIN
+ namespace acgi {
using namespace ::cgi::scgi;
using namespace ::cgi::common;
} // namespace acgi
-} // namespace boost
+BOOST_CGI_NAMESPACE_END
#endif // CGI_SCGI_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,13 +12,13 @@
#include "boost/cgi/basic_request_acceptor.hpp"
#include "boost/cgi/scgi/request_acceptor_service.hpp"
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
namespace scgi {
/// Typedef for common usage (SCGI)
typedef basic_request_acceptor<scgi_request_acceptor_service<> > acceptor;
} // namespace scgi
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
#endif // CGI_SCGI_ACCEPTOR_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor_service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor_service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/acceptor_service_impl.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -28,7 +28,7 @@
//#include "service_selector.hpp"
#include "boost/cgi/scgi/request.hpp"
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
namespace scgi {
/// The service_impl class for SCGI basic_request_acceptor<>s
@@ -45,7 +45,7 @@
* which takes a ProtocolService (**LINK**). If the protocol isn't async then
* the class can be used without a ProtocolService.
*/
- template<typename Protocol_ = ::cgi::scgi_>
+ template<typename Protocol_ = ::BOOST_CGI_NAMESPACE::scgi_>
class acceptor_service_impl
: public detail::service_base<acceptor_service_impl<Protocol_> >
{
@@ -93,7 +93,7 @@
acceptor_service_type::native_type native_type;
- explicit acceptor_service_impl(::cgi::io_service& ios)
+ explicit acceptor_service_impl(::BOOST_CGI_NAMESPACE::io_service& ios)
: detail::service_base<acceptor_service_impl<Protocol_> >(ios)
, acceptor_service_(boost::asio::use_service<acceptor_service_type>(ios))
//, endpoint(boost::asio::ip::tcp::v4())
@@ -182,7 +182,7 @@
assignment. There are a couple of ways around this; the one that
seems sensible is to keep the basic_request<>s noncopyable, but
allow the actual data be copied. At the moment the actual data is
- held in a vector<string> headers container and a cgi::streambuf.
+ held in a vector<string> headers container and a BOOST_CGI_NAMESPACE::streambuf.
These two bits should really be factored out into a message type.
IOW, the message type will be copyable (but should probably have
unique-ownership semantics).
@@ -212,7 +212,7 @@
assignment. There are a couple of ways around this; the one that
seems sensible is to keep the basic_request<>s noncopyable, but
allow the actual data be copied. At the moment the actual data is
- held in a vector<string> headers container and a cgi::streambuf.
+ held in a vector<string> headers container and a BOOST_CGI_NAMESPACE::streambuf.
These two bits should really be factored out into a message type.
IOW, the message type will be copyable (but should probably have
unique-ownership semantics).
@@ -281,7 +281,7 @@
};
} // namespace scgi
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -14,7 +14,7 @@
//#include "boost/cgi/request_service_fwd.hpp"
#include "boost/cgi/scgi/request_service.hpp"
#include "boost/cgi/scgi/service.hpp"
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
//class scgi::scgi_request_service;
@@ -25,7 +25,7 @@
// typedef for typical usage (SCGI)
typedef basic_request<scgi_request_service, service> request;
} // namespace scgi
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
//#include "boost/cgi/request_service.hpp"
#include "boost/cgi/basic_request.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_acceptor_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_acceptor_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_acceptor_service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -21,7 +21,7 @@
//#include "service_selector.hpp"
#include "boost/cgi/scgi/acceptor_service_impl.hpp"
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
/// The service class for SCGI basic_request_acceptor<>s
/**
@@ -48,7 +48,7 @@
/// The unique service identifier
//static boost::asio::io_service::id id;
- scgi_request_acceptor_service(::cgi::io_service& ios)
+ scgi_request_acceptor_service(::BOOST_CGI_NAMESPACE::io_service& ios)
: detail::service_base<scgi_request_acceptor_service<protocol_type> >(ios)
, service_impl_(ios)
{
@@ -155,7 +155,7 @@
service_impl_type service_impl_;
};
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
#include "boost/cgi/detail/pop_options.hpp"
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_impl.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -21,12 +21,12 @@
*
* THIS FILE IS OBSOLETE.
*
- * SEE request_service.hpp:cgi::scgi::scgi_request_service::implementation_type
+ * SEE request_service.hpp:BOOST_CGI_NAMESPACE::scgi::scgi_request_service::implementation_type
* INSTEAD.
*
**************/
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
namespace scgi {
@@ -34,10 +34,12 @@
class scgi_request_impl
{
public:
- typedef cgi::map map_type;
- typedef tcp_connection connection_type;
- typedef connection_type::pointer connection_ptr;
- typedef ::cgi::basic_client<connection_type> client_type;
+ typedef BOOST_CGI_NAMESPACE::map map_type;
+ typedef tcp_connection connection_type;
+ typedef connection_type::pointer connection_ptr;
+ typedef ::BOOST_CGI_NAMESPACE::basic_client<
+ connection_type
+ > client_type;
scgi_request_impl()
: stdin_parsed_(false)
@@ -75,6 +77,6 @@
};
} // namespace scgi
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
#endif // CGI_SCGI_REQUEST_IMPL_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/request_service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -23,7 +23,7 @@
#include "boost/cgi/detail/service_base.hpp"
#include "boost/cgi/detail/extract_params.hpp"
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
namespace scgi {
/// The IoObjectService class for a SCGI basic_request<>s
@@ -34,9 +34,9 @@
/// The actual implementation date for an SCGI request.
struct implementation_type
{
- typedef ::cgi::map map_type;
+ typedef ::BOOST_CGI_NAMESPACE::map map_type;
typedef tcp_connection connection_type;
- typedef ::cgi::scgi_ protocol_type;
+ typedef ::BOOST_CGI_NAMESPACE::scgi_ protocol_type;
typedef basic_client<
connection_type, protocol_type
> client_type;
@@ -69,7 +69,7 @@
typedef type::implementation_type::protocol_type protocol_type;
typedef type::implementation_type::map_type map_type;
- scgi_request_service(::cgi::io_service& ios)
+ scgi_request_service(::BOOST_CGI_NAMESPACE::io_service& ios)
: detail::service_base<scgi_request_service>(ios)
{
}
@@ -121,7 +121,7 @@
std::vector<char> buf;
// read the header content
- //::cgi::read(impl.client_, buffer(buf, header_len), ec);
+ //::BOOST_CGI_NAMESPACE::read(impl.client_, buffer(buf, header_len), ec);
/*
const std::string& request_method = env(impl, "REQUEST_METHOD", ec);
if (request_method == "GET")
@@ -311,10 +311,10 @@
}
private:
- //cgi::io_service& io_service_;
+ //BOOST_CGI_NAMESPACE::io_service& io_service_;
};
} // namespace scgi
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
#endif // CGI_SCGI_REQUEST_SERVICE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -12,16 +12,16 @@
#include "boost/cgi/tags.hpp"
#include "boost/cgi/basic_protocol_service.hpp"
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
//typedef basic_protocol_service<tags::scgi> scgi_service;
namespace scgi {
// typedef for standard scgi::service (a model of ProtocolService)
- typedef basic_protocol_service< ::cgi::scgi_> service;
+ typedef basic_protocol_service< ::BOOST_CGI_NAMESPACE::scgi_> service;
}
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
#endif // CGI_SCGI_SERVICE_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/scgi/service_impl.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -20,17 +20,17 @@
#include "../detail/service_base.hpp"
#include "../detail/extract_params.hpp"
-namespace cgi {
+namespace BOOST_CGI_NAMESPACE {
class scgi_request_service_impl
: public detail::service_base<scgi_service_impl>
{
public:
- typedef tags::scgi protocol_type;
- typedef scgi_request_impl implementation_type;
- typedef cgi::map map_type;
+ typedef tags::scgi protocol_type;
+ typedef scgi_request_impl implementation_type;
+ typedef BOOST_CGI_NAMESPACE::map map_type;
- scgi_request_service_impl(cgi::io_service& ios)
+ scgi_request_service_impl(BOOST_CGI_NAMESPACE::io_service& ios)
: detail::service_base<scgi_request_service_impl>(ios)
, io_service_(ios)
{
@@ -234,9 +234,9 @@
}
private:
- cgi::io_service& io_service_;
+ BOOST_CGI_NAMESPACE::io_service& io_service_;
};
-} // namespace cgi
+} // namespace BOOST_CGI_NAMESPACE
#endif // CGI_SCGI_SERVICE_IMPL_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/redirect.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/redirect.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/boost/cgi/utility/redirect.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,38 +2,54 @@
#ifndef BOOST_CGI_REDIRECT_HPP_INCLUDED_
#define BOOST_CGI_REDIRECT_HPP_INCLUDED_
+#include "boost/cgi/detail/push_options.hpp"
+
#include <string>
///////////////////////////////////////////////////////////
#include <boost/system/error_code.hpp>
///////////////////////////////////////////////////////////
-#include "boost/cgi/write.hpp"
-#include "boost/cgi/header.hpp"
+#include "boost/cgi/import/write.hpp"
+#include "boost/cgi/common/header.hpp"
#include "boost/cgi/detail/throw_error.hpp"
-namespace cgi {
+BOOST_CGI_NAMESPACE_BEGIN
namespace common {
/// Redirect a request to another place.
+ /**
+ * Note that without also outputting a content-type header, this will be a
+ * 'soft' redirect and the location won't be updated. If you want to do a
+ * 'hard' redirect, pass a 'Content-type: text/plain' header along with
+ * two CRLFs to complete the headers.
+ */
template <typename RequestT>
- boost::system::error_code
+ basic_header<typename RequestT::char_type>
redirect(RequestT& req, typename RequestT::string_type const& dest
- , boost::system::error_code& ec)
+ , bool secure, boost::system::error_code& ec)
{
- basic_header<typename RequestT::char_type> hdr("Location", dest);
- write(req.client(), buffer(hdr.content), ec);
- return ec;
+ std::string url(secure ? "https" : "http");
+ url += "://" + req.server_name();
+ if (dest[0] == '/')
+ url += dest;
+ else
+ url += "/" + dest;
+ basic_header<typename RequestT::char_type> hdr("Location", url);
+ return hdr;
}
template <typename RequestT>
- void redirect(RequestT& req, std::string const& dest)
+ basic_header<typename RequestT::char_type>
+ redirect(RequestT& req, typename RequestT::string_type const& dest, bool secure = false)
{
boost::system::error_code ec;
- redirect(req, dest, ec);
+ basic_header<typename RequestT::char_type>
+ hdr(redirect(req, dest, secure, ec));
detail::throw_error(ec);
+ return hdr;
}
} // namespace common
-} // namespace cgi
+BOOST_CGI_NAMESPACE_END
#endif // BOOST_CGI_REDIRECT_HPP_INCLUDED_
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/build/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/build/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/build/Jamfile.v2 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -1,6 +1,8 @@
import modules ;
+#use-project /boost/ : $(boost-root) ;
+
local DEFINES ;
if [ MATCH "^(--build-cgi)" : [ modules.peek : ARGV ] ]
@@ -54,35 +56,37 @@
: requirements
<include>$(top)
<include>$(boost-root)
- <library>/boost/thread/
- <library>/boost/system/
- <library>/boost/regex/
- <library>/boost/date_time/
+ <library>/boost//thread/
+ <library>/boost//system/
+ <library>/boost//regex/
+ <library>/boost//date_time/
<define>_CRT_SECURE_NO_WARNINGS
<define>_SCL_SECURE_NO_WARNINGS
$(DEFINES)
: usage-requirements
<include>$(top)
<include>$(boost-root)
- <library>/boost/thread/
- <library>/boost/system/
- <library>/boost/regex/
- <library>/boost/date_time/
+ <library>/boost//thread/
+ <library>/boost//system/
+ <library>/boost//regex/
+ <library>/boost//date_time/
<define>_CRT_SECURE_NO_WARNINGS
<define>_SCL_SECURE_NO_WARNINGS
<os>unix:<linkflags>-pthread
+ <linkflags>-pthread
#<tag>@$(__name__).tag
$(DEFINES)
;
if [ MATCH "^(--build-cgi)" : [ modules.peek : ARGV ] ]
-{ # compile library
+{ # compile the library
ECHO "Building CGI library" ;
# make BB recognise .ipp files as .cpp (source) files.
import type ;
type.register IPP : ipp : CPP ;
+ # library_sources.cpp includes all compilable source files.
SOURCES = $(top)/libs/cgi/src/library_sources.cpp ;
lib boost_cgi
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/Jamfile.v2 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -5,10 +5,29 @@
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 ;
import quickbook ;
+#import auto-index ;
# compile the doxygen sources here
doxygen autodoc
@@ -17,34 +36,66 @@
# [ glob-tree ../../../boost/libs/cgi/src/*.cpp : .svn ]
[ glob $(top)/boost/cgi/*.hpp ]
+ [ glob $(top)/boost/cgi/common/*.hpp ]
+ [ glob $(top)/boost/cgi/util/*.hpp ]
+ [ glob $(top)/boost/cgi/connections/*.hpp ]
+ [ glob $(top)/boost/cgi/cgi/*.hpp ]
+ [ glob $(top)/boost/cgi/fcgi/*.hpp ]
$(top)/boost/cgi/fcgi/client.hpp
$(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
- #[ glob $(top)/boost/cgi/acgi/*.hpp ]
- #[ glob $(top)/boost/cgi/cgi/*.hpp ]
- [ glob $(top)/boost/cgi/common/*.hpp ]
-
- [ glob ../../../boost/cgi/connections/*.hpp ]
:
- <doxygen.processor>doxproc
- <doxygen.doxproc.index>yes
- <doxygen.doxproc.title>"Developer Reference"
- <doxygen.doxproc.id>"developer_reference"
-
+ <doxygen:param>TAB_SIZE=2
+ # <doxygen:param>EXTRACT_ALL=YES
<doxygen:param>HIDE_UNDOC_MEMBERS=NO
- <doxygen:param>EXTRACT_PRIVATE=NO
- <doxygen:param>EXTRACT_ALL=YES
+ # Show all inherited members of a class in the documentation of that class
+ # as if those members were ordinary class members.
+ <doxygen:param>INLINE_INHERITED_MEMB=YES
+ <doxygen:param>SORT_MEMBER_DOCS=YES
+ #<doxygen:param>EXTRACT_PRIVATE=YES
+ <doxygen:param>EXTRACT_STATIC=YES
+ # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+ # will be included in the documentation
+ <doxygen:param>EXTRACT_PRIVATE=NO
+ <doxygen:param>EXTRACT_LOCAL_CLASSES=YES
+ <doxygen:param>EXTRACT_LOCAL_METHODS=YES
+ # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+ # locally in source files will be included in the documentation.
+ <doxygen:param>EXTRACT_LOCAL_CLASSES=YES
+ <doxygen:param>ENABLE_PREPROCESSING=YES
+ <doxygen:param>MACRO_EXPANSION=YES
+ <doxygen:param>EXPAND_ONLY_PREDEF=YES
<doxygen:param>SEARCH_INCLUDES=YES
- <doxygen:param>GENERATE_TREEVIEW=ALL
- <doxygen:param>TYPEDEF_HIDES_STRUCT=YES
-# <doxygen:param>INCLUDE_PATH=$(BOOST_ROOT)
+ # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] is
+ # inserted in the documentation for inline members.
+ <doxygen:param>INLINE_INFO=YES
+ # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+ # descriptions of file, namespace and class members alphabetically by member
+ # name.
+ <doxygen:param>SORT_BRIEF_DOCS=YES
+ # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen will
+ # sort the (detailed) documentation of file and class members alphabetically
+ # by member name.
+ <doxygen:param>SORT_MEMBER_DOCS=YES
+ # List of the files that are included by a file in the documentation of that
+ # file.
+ <doxygen:param>SHOW_INCLUDE_FILES=NO
+ # Prepend the brief description of a member or function before the detailed
+ # description
+ <doxygen:param>REPEAT_BRIEF=YES
+ # Include brief member descriptions after the members that are listed in the
+ # file and class
+ <doxygen:param>BRIEF_MEMBER_DESC=YES
+ # Treat a multi-line C++ special comment block (i.e. a block of //! or
+ # /// comments) as a brief description.
+ <doxygen:param>MULTILINE_CPP_IS_BRIEF=YES
+ # May be best to always use \brief and \details to avoid ambiguity?
+ <doxygen:param>INCLUDE_PATH=$(boost-root)
+ <doxygen:param>WARN_LOGFILE=$(top)/libs/cgi/doc/doxywarnings.log
;
xml cgi_xml : src/cgi.qbk ;
@@ -52,31 +103,81 @@
boostbook standalone
:
cgi_xml
- autodoc
+ #autodoc
#cgi_dox
:
- #<xsl:param>project.root=../../../..
- #<xsl:param>boost.libraries=/usr/local/src/boost/trunk/libs/libraries.htm
- #<xsl:param>boost.images=http://beta.boost.org/images
- # the depth (of sub-pages) the TOC shows
- #<xsl:param>toc.max.depth=1
- # Path to the stylesheet
- #<xsl:param>html.stylesheet=../../../../../../boost/trunk/doc/html/boostbook.css
-
- #
- #<xsl:param>toc.section.depth=2
-
+ # This one turns on indexing:
+ #<auto-index>on
+ # Choose indexing method for pdf's:
+ #<format>pdf:<auto-index-internal>off
+ # Choose indexing method for html:
+ #<format>html:<auto-index-internal>on
+ # Set the name of the script file to use:
+ #<auto-index-script>index.idx
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # How far down we chunk nested sections, basically all of them:
+ <xsl:param>chunk.section.depth=10
+ # Don't put the first section on the same page as the TOC:
+ <xsl:param>chunk.first.sections=1
+ # How far down sections get TOC's
+ <xsl:param>toc.section.depth=10
+ # Max depth in each TOC:
+ <xsl:param>toc.max.depth=4
# How far down we go with TOC's
- #<xsl:param>generate.section.toc.level=10
- # how many sections are on the first page
- #<xsl:param>chunk.first.sections=1
+ <xsl:param>generate.section.toc.level=1
+ #<xsl:param>generate.toc="chapter nop section nop"
+
+ #<xsl:param>root.filename="svg_plot"
+ #<xsl:param>root.filename=cgi
+ <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
+ # <xsl:param>quickbook.source.style.show="'true'"
+
+ # PDF Options:
+ # TOC Generation
+ <xsl:param>fop1.extensions=0
+ <format>pdf:<xsl:param>xep.extensions=1
+ <format>pdf:<xsl:param>fop.extensions=0
+
+ # No indent on body text:
+ <format>pdf:<xsl:param>body.start.indent=0pt
+ # Margin size:
+ <format>pdf:<xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <format>pdf:<xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <format>pdf:<xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>use.role.for.mediaobject=1
+ <format>pdf:<xsl:param>preferred.mediaobject.role=print
+ <format>pdf:<xsl:param>img.src.path=$(images_location)/
+ <format>pdf:<xsl:param>admon.graphics.path=$(images_location)/images/
+ <format>pdf:<xsl:param>draft.mode="no"
- # To chunk (together) or not to chunk (divide)
- #<xsl:param>chunk.section.depth=2 # chunk
+ <dependency>autodoc
;
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/trunk/libs/cgi/doc/src/cgi.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/cgi.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/cgi.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -8,10 +8,9 @@
[library CGI
[quickbook 1.4]
[version 0.01]
- [id boost.cgi]
[dirname the_document_dir]
[copyright 2007 2008 Darren Garvey]
- [purpose Thoughts about CGI implementation]
+ [purpose Documentation for CGI / FastCGI Library]
[authors [Garvey, Darren]]
[license
Distributed under the Boost Software License, Version 1.0.
@@ -20,8 +19,12 @@
]
]
-[def __this__ ["FSCGI"]] [/ name of the library]
+[template mdash[] '''— ''']
+[template indexterm1[term1] '''<indexterm><primary>'''[term1]'''</primary></indexterm>''']
+[template indexterm2[term1 term2] '''<indexterm><primary>'''[term1]'''</primary><secondary>'''[term2]'''</secondary></indexterm>''']
+
+[def __this__ ["FSCGI"]] [/ name of the library]
[def __cgi__ [@http://en.wikipedia.org/wiki/Common_Gateway_Interface CGI]]
[def __scgi__ [@http://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface SCGI]]
[def __fcgi__ [@http://en.wikipedia.org/wiki/FastCGI FastCGI]]
@@ -42,8 +45,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` ]
@@ -83,25 +86,13 @@
These documents are either hosted at [@http://sourceforge.net/projects/cgi/ sourceforge], or at [@http://svn.boost.org/svn/boost/browser/sandbox/SOC/2007/cgi svn.boost.org]. For free!
]
-[include preface.qbk]
+[/include preface.qbk]
-[include:intro introduction.qbk]
+[/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 quickstart.qbk]
-[include user_guide.qbk]
+[/include user_guide.qbk]
[/include:tutorial user_guide/tutorial.qbk]
@@ -113,14 +104,20 @@
[/xinclude ../cgi_dox.xml]
-[include:examples examples.qbk]
+[/include:examples examples.qbk]
+
+[/include:reference reference.qbk]
+
+[/include:future future_development.qbk]
+
+[/include:server_support user_guide/server_support.qbk]
-[include:reference reference.qbk]
+[/include troubleshooting.qbk]
-[include:future future_development.qbk]
+[/include acknowledgements.qbk]
-[include:server_support user_guide/server_support.qbk]
+[/xinclude index.xml]
-[include troubleshooting.qbk]
+[/xinclude quickref.xml]
-[include acknowledgements.qbk]
+[include reference.qbk]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/future_development.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/future_development.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/future_development.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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/trunk/libs/cgi/doc/src/preface.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/preface.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/preface.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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/trunk/libs/cgi/doc/src/reference.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/reference.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/reference.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -1,65 +1,13383 @@
[/
- / Copyright (c) 2007 Darren Garvey
+ / Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+ /
+ / Copyright (c) 2009 Darren Garvey (darren dot garvey at gmail dot com)
+ / -> Modification to work with the CGI library.
/
/ 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)
/]
-[section:ref Reference]
+[section:reference Reference]
+
+[xinclude quickref.xml]
+
+
+[section:cgi__common__stencil cgi__common::stencil]
+
+
+
+ class stencil
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.base_type [*base_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.dictionary [*dictionary]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.impl_type [*impl_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.parse_state [*parse_state]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.reload_option [*reload_option]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.section [*section]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.stencil_type [*stencil_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.strip [*strip]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.add [*add]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.annotate_output [*annotate_output]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.expand [*expand]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.include [*include]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.native [*native]]]
+ [Get the implementation type of the template. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.reset [*reset]]]
+ [Clear the response buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.set [*set]]]
+ [Set the varible `name` to `value` in the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.show [*show]]]
+ [Show a section. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.state [*state]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.stencil [*stencil]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.expanded [*expanded]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.impl [*impl]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.per_expand_data [*per_expand_data]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.tmpl [*tmpl]]]
+ []
+ ]
+
+]
+
+
+[section:add cgi__common::stencil::add]
+
+[indexterm2 add..cgi__common::stencil]
+
+ dictionary add(
+ section const & sec);
+
+
+
+[endsect]
+
+
+
+[section:annotate_output cgi__common::stencil::annotate_output]
+
+[indexterm2 annotate_output..cgi__common::stencil]
+
+ self_type & annotate_output(
+ bool annotate = true);
+
+
+
+[endsect]
+
+
+
+[section:base_type cgi__common::stencil::base_type]
+
+[indexterm2 base_type..cgi__common::stencil]
+
+ typedef boost::cgi::common::response base_type;
+
+
+
+
+[endsect]
+
+
+
+[section:dictionary cgi__common::stencil::dictionary]
+
+[indexterm2 dictionary..cgi__common::stencil]
+
+ typedef stencils::dictionary dictionary;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.impl_type [*impl_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__dictionary.add [*add]]]
+ [Add a section into the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.dictionary [*dictionary]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.include [*include]]]
+ [Include a file into the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.set [*set]]]
+ [Set the varible `name` to `value` in the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.show [*show]]]
+ [Show a section. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__dictionary.impl [*impl]]]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:expand cgi__common::stencil::expand]
+
+[indexterm2 expand..cgi__common::stencil]
+
+ bool expand(
+ string_type const & template_name,
+ enum reload_option reload_if_changed = cached,
+ enum strip strip_option = strip_blank_lines);
+
+
+
+[endsect]
+
+
+
+[section:expanded cgi__common::stencil::expanded]
+
+[indexterm2 expanded..cgi__common::stencil]
+
+ bool expanded;
+
+
+
+[endsect]
+
+
+
+[section:impl cgi__common::stencil::impl]
+
+[indexterm2 impl..cgi__common::stencil]
+
+ boost::scoped_ptr< impl_type > impl;
+
+
+
+[endsect]
+
+
+
+[section:impl_type cgi__common::stencil::impl_type]
+
+[indexterm2 impl_type..cgi__common::stencil]
+
+ typedef ctemplate::TemplateDictionary impl_type;
+
+
+
+
+[endsect]
+
+
+[section:include cgi__common::stencil::include]
+
+[indexterm2 include..cgi__common::stencil]
+
+ dictionary ``[link cgi.reference.cgi__common__stencil.include.overload1 include]``(
+ string_type const & section_name,
+ string_type const & filename);
+
+ dictionary ``[link cgi.reference.cgi__common__stencil.include.overload2 include]``(
+ section const & sec);
+
+
+[section:overload1 cgi__common::stencil::include (1 of 2 overloads)]
+
+
+
+ dictionary include(
+ string_type const & section_name,
+ string_type const & filename);
+
+
+
+[endsect]
+
+
+
+[section:overload2 cgi__common::stencil::include (2 of 2 overloads)]
+
+
+
+ dictionary include(
+ section const & sec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:native cgi__common::stencil::native]
+
+[indexterm2 native..cgi__common::stencil] Get the implementation type of the template.
+
+ impl_type & native();
+
+
+
+[endsect]
+
+
+
+[section:parse_state cgi__common::stencil::parse_state]
+
+[indexterm2 parse_state..cgi__common::stencil]
+
+ enum parse_state
+
+[heading Values]
+[variablelist
+
+ [
+ [unused]
+ []
+ ]
+
+ [
+ [empty]
+ []
+ ]
+
+ [
+ [error]
+ []
+ ]
+
+ [
+ [ready]
+ []
+ ]
+
+ [
+ [should_reload]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:per_expand_data cgi__common::stencil::per_expand_data]
+
+[indexterm2 per_expand_data..cgi__common::stencil]
+
+ ctemplate::PerExpandData per_expand_data;
+
+
+
+[endsect]
+
+
+
+[section:reload_option cgi__common::stencil::reload_option]
+
+[indexterm2 reload_option..cgi__common::stencil]
+
+ enum reload_option
+
+[heading Values]
+[variablelist
+
+ [
+ [cached]
+ []
+ ]
+
+ [
+ [reload]
+ []
+ ]
+
+ [
+ [reload_all]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:reset cgi__common::stencil::reset]
+
+[indexterm2 reset..cgi__common::stencil] Clear the response buffer.
+
+ void reset(
+ impl_type * use_dict = NULL);
+
+
+
+[endsect]
+
+
+
+[section:section cgi__common::stencil::section]
+
+[indexterm2 section..cgi__common::stencil]
+
+ typedef stencils::section section;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.stencils__section.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__section.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__section.section [*section]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__section.filename [*filename]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.stencils__section.name [*name]]]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:self_type cgi__common::stencil::self_type]
+
+[indexterm2 self_type..cgi__common::stencil]
+
+ typedef stencil self_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.base_type [*base_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.dictionary [*dictionary]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.impl_type [*impl_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.parse_state [*parse_state]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.reload_option [*reload_option]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.section [*section]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.stencil_type [*stencil_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.cgi__common__stencil.strip [*strip]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.add [*add]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.annotate_output [*annotate_output]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.expand [*expand]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.include [*include]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.native [*native]]]
+ [Get the implementation type of the template. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.reset [*reset]]]
+ [Clear the response buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.set [*set]]]
+ [Set the varible `name` to `value` in the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.show [*show]]]
+ [Show a section. ]
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.state [*state]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.stencil [*stencil]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.expanded [*expanded]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.impl [*impl]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.per_expand_data [*per_expand_data]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.cgi__common__stencil.tmpl [*tmpl]]]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:set cgi__common::stencil::set]
+
+[indexterm2 set..cgi__common::stencil] Set the varible `name` to `value` in the stencil.
+
+ template<
+ typename T >
+ self_type & ``[link cgi.reference.cgi__common__stencil.set.overload1 set]``(
+ string_type const & name,
+ T value);
+
+ template<
+ typename T >
+ self_type & ``[link cgi.reference.cgi__common__stencil.set.overload2 set]``(
+ string_type const & name,
+ T value,
+ section const & sec);
+
+ template<>
+ stencil & ``[link cgi.reference.cgi__common__stencil.set.overload3 set]``(
+ string_type const & name,
+ string_type const & value);
+
+ template<>
+ stencil & ``[link cgi.reference.cgi__common__stencil.set.overload4 set]``(
+ string_type const & name,
+ string_type const & value,
+ section const & sec);
+
+
+[section:overload1 cgi__common::stencil::set (1 of 4 overloads)]
+
+Set the varible `name` to `value` in the stencil.
+
+ template<
+ typename T >
+ self_type & set(
+ string_type const & name,
+ T value);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[name][The name of the variable. Use {{name}} in the stencil. ]]
+
+[[value][The value, can be any type that is supported by boost::lexical\_cast. See the docs for lexical\_cast: http://www.boost.org/libs/lexical\_cast]]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:overload2 cgi__common::stencil::set (2 of 4 overloads)]
+
+Set a variable and show a section in one go.
+
+ template<
+ typename T >
+ self_type & set(
+ string_type const & name,
+ T value,
+ section const & sec);
+
+
+
+[endsect]
+
+
+
+[section:overload3 cgi__common::stencil::set (3 of 4 overloads)]
+
+Set the varible `name` to `value` in the stencil.
+
+ template<>
+ stencil & set(
+ string_type const & name,
+ string_type const & value);
+
+
+
+[endsect]
+
+
+
+[section:overload4 cgi__common::stencil::set (4 of 4 overloads)]
+
+Set a variable and show a section in one go.
+
+ template<>
+ stencil & set(
+ string_type const & name,
+ string_type const & value,
+ section const & sec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:show cgi__common::stencil::show]
+
+[indexterm2 show..cgi__common::stencil] Show a section.
+
+ self_type & show(
+ section const & sec);
+
+
+
+[endsect]
+
+
+
+[section:state cgi__common::stencil::state]
+
+[indexterm2 state..cgi__common::stencil]
+
+ parse_state state();
+
+
+
+[endsect]
+
+
+[section:stencil cgi__common::stencil::stencil]
+
+[indexterm2 stencil..cgi__common::stencil]
+
+ ``[link cgi.reference.cgi__common__stencil.stencil.overload1 stencil]``(
+ impl_type * parent_dict);
+
+ ``[link cgi.reference.cgi__common__stencil.stencil.overload2 stencil]``(
+ string_type const & root_dir = "");
+
+
+[section:overload1 cgi__common::stencil::stencil (1 of 2 overloads)]
+
+
+
+ stencil(
+ impl_type * parent_dict);
+
+
+
+[endsect]
+
+
+
+[section:overload2 cgi__common::stencil::stencil (2 of 2 overloads)]
+
+
+
+ stencil(
+ string_type const & root_dir = "");
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:stencil_type cgi__common::stencil::stencil_type]
+
+[indexterm2 stencil_type..cgi__common::stencil]
+
+ typedef ctemplate::Template stencil_type;
+
+
+
+
+[endsect]
+
+
+
+[section:strip cgi__common::stencil::strip]
+
+[indexterm2 strip..cgi__common::stencil]
+
+ enum strip
+
+[heading Values]
+[variablelist
+
+ [
+ [do_not_strip]
+ []
+ ]
+
+ [
+ [strip_blank_lines]
+ []
+ ]
+
+ [
+ [strip_whitespace]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:tmpl cgi__common::stencil::tmpl]
+
+[indexterm2 tmpl..cgi__common::stencil]
+
+ stencil_type * tmpl;
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:is_error_code_enum_lt____BOOST_CGI_NAMESPACE__common__error__cgi_errors__gt_ boost::system::is_error_code_enum< ::BOOST_CGI_NAMESPACE::common::error::cgi_errors >]
+
+
+
+ template<>
+ struct boost::system::is_error_code_enum< ::BOOST_CGI_NAMESPACE::common::error::cgi_errors >
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.is_error_code_enum_lt____BOOST_CGI_NAMESPACE__common__error__cgi_errors__gt_.BOOST_STATIC_CONSTANT [*BOOST_STATIC_CONSTANT]]]
+ []
+ ]
+
+]
+
+
+[section:BOOST_STATIC_CONSTANT boost::system::is_error_code_enum< ::BOOST_CGI_NAMESPACE::common::error::cgi_errors >::BOOST_STATIC_CONSTANT]
+
+[indexterm2 BOOST_STATIC_CONSTANT..boost::system::is_error_code_enum< ::BOOST_CGI_NAMESPACE::common::error::cgi_errors >]
+
+ BOOST_STATIC_CONSTANT(
+ bool ,
+ value = true);
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+
+[section: cgi__service]
+
+
+
+ typedef cgi_service service;
+
+
+
+
+[endsect]
+
+
+[section:common__basic_client common::basic_client]
+
+A client.
+
+ template<
+ typename Connection ,
+ typename Protocol >
+ class basic_client
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_client.connection_ptr [*connection_ptr]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.connection_type [*connection_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.header_buffer_type [*header_buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.io_service_type [*io_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.map_type [*map_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.mutable_buffers_type [*mutable_buffers_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.role_type [*role_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_client.async_read_some [*async_read_some]]]
+ [Asynchronously read some data from the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.async_write_some [*async_write_some]]]
+ [Asynchronously write some data to the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.basic_client [*basic_client]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.bytes_left [*bytes_left]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.close [*close]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.connection [*connection]]]
+ [Get a shared_ptr of the connection associated with the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.construct [*construct]]]
+ [Construct the client by claiming a request id. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.handle_write [*handle_write]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.is_open [*is_open]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.keep_connection [*keep_connection]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.prepare_buffer [*prepare_buffer]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.read_some [*read_some]]]
+ [Read data into the supplied buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.request_id [*request_id]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.set_connection [*set_connection]]]
+ [Associate a connection with this client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.status [*status]]]
+ [Get the status of the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.write_some [*write_some]]]
+ [Write some data to the client. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_client.bytes_left_ [*bytes_left_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.header_ [*header_]]]
+ [Buffer used to check the header of each packet. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.keep_connection_ [*keep_connection_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.outbuf_ [*outbuf_]]]
+ [Output buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.request_id_ [*request_id_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.role_ [*role_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.status_ [*status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.total_sent_bytes_ [*total_sent_bytes_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.total_sent_packets_ [*total_sent_packets_]]]
+ []
+ ]
+
+]
+
+A client is for two things: 1. To hold a full-duplex connection (or separate input and output connections). 2. To hold any protocol-specific data about the request. For now, this means the internal 'request number' associated by FastCGI with each request (ie. so incoming/outgoing packets can be wrapped with data noting what request it relates to). 3. Buffering. Not sure about how far this should go yet, but probably no further than minimal buffering. 4. Share a connection. Since a multiplexing connection is shared between multiple clients, the client should be responsible for taking possesion of the connection for a period of time (so it can write a complete packet). This idea could be taken quite far into genericity by making clients aware of how busy the connection is and size its output packets accordingly... But I'm not doing that.
+
+
+[section:async_read_some common::basic_client::async_read_some]
+
+[indexterm2 async_read_some..common::basic_client] Asynchronously read some data from the client.
+
+ template<
+ typename MutableBufferSequence ,
+ typename Handler >
+ void async_read_some(
+ const MutableBufferSequence & buf,
+ Handler handler);
+
+
+
+[endsect]
+
+
+[section:async_write_some common::basic_client::async_write_some]
+
+[indexterm2 async_write_some..common::basic_client] Asynchronously write some data to the client.
+
+ template<
+ typename ConstBufferSequence ,
+ typename Handler >
+ void ``[link cgi.reference.common__basic_client.async_write_some.overload1 async_write_some]``(
+ const ConstBufferSequence & buf,
+ Handler handler);
+
+ template<>
+ void ``[link cgi.reference.common__basic_client.async_write_some.overload2 async_write_some]``(
+ const ConstBufferSequence & buf,
+ Handler handler);
+
+
+[section:overload1 common::basic_client::async_write_some (1 of 2 overloads)]
+
+Asynchronously write some data to the client.
+
+ template<
+ typename ConstBufferSequence ,
+ typename Handler >
+ void async_write_some(
+ const ConstBufferSequence & buf,
+ Handler handler);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_client::async_write_some (2 of 2 overloads)]
+
+
+
+ template<>
+ void async_write_some(
+ const ConstBufferSequence & buf,
+ Handler handler);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:basic_client common::basic_client::basic_client]
+
+[indexterm2 basic_client..common::basic_client]
+
+ ``[link cgi.reference.common__basic_client.basic_client.overload1 basic_client]``();
+
+ ``[link cgi.reference.common__basic_client.basic_client.overload2 basic_client]``(
+ io_service & ios);
+
+ template<>
+ ``[link cgi.reference.common__basic_client.basic_client.overload3 basic_client]``();
+
+ template<>
+ ``[link cgi.reference.common__basic_client.basic_client.overload4 basic_client]``(
+ io_service_type & ios);
+
+
+[section:overload1 common::basic_client::basic_client (1 of 4 overloads)]
+
+
+
+ basic_client();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_client::basic_client (2 of 4 overloads)]
+
+
+
+ basic_client(
+ io_service & ios);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_client::basic_client (3 of 4 overloads)]
+
+
+
+ template<>
+ basic_client();
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::basic_client::basic_client (4 of 4 overloads)]
+
+
+
+ template<>
+ basic_client(
+ io_service_type & ios);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:bytes_left common::basic_client::bytes_left]
+
+[indexterm2 bytes_left..common::basic_client]
+
+ std::size_t & bytes_left();
+
+
+
+[endsect]
+
+
+
+[section:bytes_left_ common::basic_client::bytes_left_]
+
+[indexterm2 bytes_left_..common::basic_client]
+
+ std::size_t bytes_left_;
+
+
+
+[endsect]
+
+
+[section:close common::basic_client::close]
+
+[indexterm2 close..common::basic_client]
+
+ boost::system::error_code ``[link cgi.reference.common__basic_client.close.overload1 close]``(
+ boost::uint64_t app_status,
+ boost::system::error_code & ec);
+
+ void ``[link cgi.reference.common__basic_client.close.overload2 close]``(
+ boost::uint64_t app_status = 0);
+
+ template<>
+ boost::system::error_code ``[link cgi.reference.common__basic_client.close.overload3 close]``(
+ boost::uint64_t app_status,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_client::close (1 of 3 overloads)]
+
+
+
+ boost::system::error_code close(
+ boost::uint64_t app_status,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_client::close (2 of 3 overloads)]
+
+
+
+ void close(
+ boost::uint64_t app_status = 0);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_client::close (3 of 3 overloads)]
+
+
+
+ template<>
+ boost::system::error_code close(
+ boost::uint64_t app_status,
+ boost::system::error_code & ec);
+
+
+Closing a FastCGI means sending an END\_REQUEST header to the HTTP server and potentially closing the connection.
+
+Note that in general the HTTP server is responsible for the lifetime of the connection, but can hand that control over to the library (eg. if the server is set up to recycle connections after N requests).
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:connection common::basic_client::connection]
+
+[indexterm2 connection..common::basic_client] Get a shared_ptr of the connection associated with the client.
+
+ connection_ptr & connection();
+
+
+
+[endsect]
+
+
+
+[section:connection_ptr common::basic_client::connection_ptr]
+
+[indexterm2 connection_ptr..common::basic_client]
+
+ typedef connection_type::pointer connection_ptr;
+
+
+
+
+[endsect]
+
+
+
+[section:connection_type common::basic_client::connection_type]
+
+[indexterm2 connection_type..common::basic_client]
+
+ typedef Connection connection_type;
+
+
+
+
+[endsect]
+
+
+
+[section:construct common::basic_client::construct]
+
+[indexterm2 construct..common::basic_client] Construct the client by claiming a request id.
+
+ template<
+ typename RequestImpl >
+ boost::system::error_code construct(
+ RequestImpl & req,
+ boost::system::error_code & ec);
+
+
+Before loading a request, it will usually not have a request id. This function reads headers (and corresponding bodies if necessary) until a BEGIN\_REQUEST record is found. The calling request then claims and serves that request.
+
+
+[endsect]
+
+
+
+[section:handle_write common::basic_client::handle_write]
+
+[indexterm2 handle_write..common::basic_client]
+
+ template<>
+ void handle_write(
+ std::size_t bytes_transferred,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:header_ common::basic_client::header_]
+
+[indexterm2 header_..common::basic_client] Buffer used to check the header of each packet.
+
+ fcgi::spec::header header_;
+
+
+
+[endsect]
+
+
+
+[section:header_buffer_type common::basic_client::header_buffer_type]
+
+[indexterm2 header_buffer_type..common::basic_client]
+
+ typedef boost::array< unsigned char, 8 > header_buffer_type;
+
+
+
+
+[endsect]
+
+
+
+[section:io_service_type common::basic_client::io_service_type]
+
+[indexterm2 io_service_type..common::basic_client]
+
+ typedef ::BOOST_CGI_NAMESPACE::common::io_service io_service_type;
+
+
+
+
+[endsect]
+
+
+
+[section:is_open common::basic_client::is_open]
+
+[indexterm2 is_open..common::basic_client]
+
+ bool is_open();
+
+
+
+[endsect]
+
+
+
+[section:keep_connection common::basic_client::keep_connection]
+
+[indexterm2 keep_connection..common::basic_client]
+
+ bool keep_connection() const;
+
+
+
+[endsect]
+
+
+
+[section:keep_connection_ common::basic_client::keep_connection_]
+
+[indexterm2 keep_connection_..common::basic_client]
+
+ bool keep_connection_;
+
+
+
+[endsect]
+
+
+
+[section:map_type common::basic_client::map_type]
+
+[indexterm2 map_type..common::basic_client]
+
+ typedef ::BOOST_CGI_NAMESPACE::common::map map_type;
+
+
+
+
+[endsect]
+
+
+
+[section:mutable_buffers_type common::basic_client::mutable_buffers_type]
+
+[indexterm2 mutable_buffers_type..common::basic_client]
+
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+
+
+
+
+[endsect]
+
+
+
+[section:outbuf_ common::basic_client::outbuf_]
+
+[indexterm2 outbuf_..common::basic_client] Output buffer.
+
+ std::vector< boost::asio::const_buffer > outbuf_;
+
+
+
+[endsect]
+
+
+
+[section:prepare_buffer common::basic_client::prepare_buffer]
+
+[indexterm2 prepare_buffer..common::basic_client]
+
+ template<>
+ void prepare_buffer(
+ const ConstBufferSequence & buf);
+
+
+
+[endsect]
+
+
+
+[section:protocol_type common::basic_client::protocol_type]
+
+[indexterm2 protocol_type..common::basic_client]
+
+ typedef Protocol protocol_type;
+
+
+
+
+[endsect]
+
+
+
+[section:read_some common::basic_client::read_some]
+
+[indexterm2 read_some..common::basic_client] Read data into the supplied buffer.
+
+ template<
+ typename MutableBufferSequence >
+ std::size_t read_some(
+ const MutableBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+Reads some data that, correctly checking and stripping FastCGI headers.
+
+Returns the number of bytes read and sets `ec` such that `ec` evaluates to `true` iff an error occured during the read operation.
+
+Notable errors:
+* `fcgierror::data_for_another_request`
+
+* `fcgierror::connection_locked`
+
+
+These must be dealt with by user code if they choose to read through the client (reading through the request is recommended).
+
+
+[endsect]
+
+
+
+[section:request_id common::basic_client::request_id]
+
+[indexterm2 request_id..common::basic_client]
+
+ boost::uint16_t const & request_id() const;
+
+
+
+[endsect]
+
+
+
+[section:request_id_ common::basic_client::request_id_]
+
+[indexterm2 request_id_..common::basic_client]
+
+ boost::uint16_t request_id_;
+
+
+
+[endsect]
+
+
+
+[section:role_ common::basic_client::role_]
+
+[indexterm2 role_..common::basic_client]
+
+ role_type role_;
+
+
+
+[endsect]
+
+
+
+[section:role_type common::basic_client::role_type]
+
+[indexterm2 role_type..common::basic_client]
+
+ typedef detail::protocol_traits< Protocol >::role_type role_type;
+
+
+
+
+[endsect]
+
+
+[section:set_connection common::basic_client::set_connection]
+
+[indexterm2 set_connection..common::basic_client] Associate a connection with this client.
+
+ bool ``[link cgi.reference.common__basic_client.set_connection.overload1 set_connection]``(
+ connection_type * conn);
+
+ bool ``[link cgi.reference.common__basic_client.set_connection.overload2 set_connection]``(
+ const typename connection_type::pointer & conn);
+
+
+[section:overload1 common::basic_client::set_connection (1 of 2 overloads)]
+
+Associate a connection with this client.
+
+ bool set_connection(
+ connection_type * conn);
+
+
+Note: the connection must have been created using the new operator
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_client::set_connection (2 of 2 overloads)]
+
+Associate a connection with this client.
+
+ bool set_connection(
+ const typename connection_type::pointer & conn);
+
+
+Note: the connection must have been created using the new operator
+
+
+[endsect]
+
+
+[endsect]
+
+[section:status common::basic_client::status]
+
+[indexterm2 status..common::basic_client] Get the status of the client.
+
+ const client_status & ``[link cgi.reference.common__basic_client.status.overload1 status]``() const;
+
+ void ``[link cgi.reference.common__basic_client.status.overload2 status]``(
+ client_status status);
+
+
+[section:overload1 common::basic_client::status (1 of 2 overloads)]
+
+Get the status of the client.
+
+ const client_status & status() const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_client::status (2 of 2 overloads)]
+
+Set the status of the client.
+
+ void status(
+ client_status status);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:status_ common::basic_client::status_]
+
+[indexterm2 status_..common::basic_client]
+
+ client_status status_;
+
+
+
+[endsect]
+
+
+
+[section:total_sent_bytes_ common::basic_client::total_sent_bytes_]
+
+[indexterm2 total_sent_bytes_..common::basic_client]
+
+ boost::uint64_t total_sent_bytes_;
+
+
+
+[endsect]
+
+
+
+[section:total_sent_packets_ common::basic_client::total_sent_packets_]
+
+[indexterm2 total_sent_packets_..common::basic_client]
+
+ boost::uint64_t total_sent_packets_;
+
+
+
+[endsect]
+
+
+[section:write_some common::basic_client::write_some]
+
+[indexterm2 write_some..common::basic_client] Write some data to the client.
+
+ template<
+ typename ConstBufferSequence >
+ std::size_t ``[link cgi.reference.common__basic_client.write_some.overload1 write_some]``(
+ const ConstBufferSequence & buf,
+ boost::system::error_code & ec);
+
+ template<>
+ std::size_t ``[link cgi.reference.common__basic_client.write_some.overload2 write_some]``(
+ const ConstBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_client::write_some (1 of 2 overloads)]
+
+Write some data to the client.
+
+ template<
+ typename ConstBufferSequence >
+ std::size_t write_some(
+ const ConstBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_client::write_some (2 of 2 overloads)]
+
+
+
+ template<>
+ std::size_t write_some(
+ const ConstBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[endsect]
+
+[section:common__basic_cookie common::basic_cookie]
+
+A `basic_cookie<>` object that can be (out-) streamed.
+
+ template<
+ typename CharT >
+ struct basic_cookie
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_cookie.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_cookie.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_cookie.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_cookie.basic_cookie [*basic_cookie]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.c_str [*c_str]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.empty [*empty]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_const_char_type_* [*operator const char_type *]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_std__basic_string_lt__T__gt_ [*operator std::basic_string< T >]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_string_type [*operator string_type]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_string_type_const_& [*operator string_type const &]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.to_string [*to_string]]]
+ [TODO: Create a cookie from a const char*. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_cookie.domain [*domain]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.expires [*expires]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.http_only [*http_only]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.name [*name]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.path [*path]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.secure [*secure]]]
+ [`true` iff the cookie is only used for secure connections. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.value [*value]]]
+ []
+ ]
+
+]
+
+[heading Friends]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_lt__lt_ [*operator<<]]]
+ []
+ ]
+
+]
+
+Either set the parameters in the constructor, or set them directly. Note: If you want to set the parameters individually, remember that each parameter must NOT have a trailing semi-colon!
+
+TODO
+* Data should be URL-encoded, or maybe provide an overload for url_decode that takes an HttpCookie?
+
+* Add from_string() ?
+
+
+[section:basic_cookie common::basic_cookie::basic_cookie]
+
+[indexterm2 basic_cookie..common::basic_cookie]
+
+ ``[link cgi.reference.common__basic_cookie.basic_cookie.overload1 basic_cookie]``();
+
+ ``[link cgi.reference.common__basic_cookie.basic_cookie.overload2 basic_cookie]``(
+ const char * _name);
+
+ ``[link cgi.reference.common__basic_cookie.basic_cookie.overload3 basic_cookie]``(
+ const string_type & _name);
+
+ ``[link cgi.reference.common__basic_cookie.basic_cookie.overload4 basic_cookie]``(
+ const string_type & _name,
+ const string_type & _val,
+ const string_type & _expires = "",
+ const string_type & _path = "/",
+ const string_type & _domain = "",
+ bool _secure = false,
+ bool HttpOnly = false);
+
+
+[section:overload1 common::basic_cookie::basic_cookie (1 of 4 overloads)]
+
+
+
+ basic_cookie();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_cookie::basic_cookie (2 of 4 overloads)]
+
+
+
+ basic_cookie(
+ const char * _name);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_cookie::basic_cookie (3 of 4 overloads)]
+
+Create a cookie for deleting the cookie named `_name`.
+
+ basic_cookie(
+ const string_type & _name);
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::basic_cookie::basic_cookie (4 of 4 overloads)]
+
+Create a cookie.
+
+ basic_cookie(
+ const string_type & _name,
+ const string_type & _val,
+ const string_type & _expires = "",
+ const string_type & _path = "/",
+ const string_type & _domain = "",
+ bool _secure = false,
+ bool HttpOnly = false);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:c_str common::basic_cookie::c_str]
+
+[indexterm2 c_str..common::basic_cookie]
+
+ const char_type * c_str() const;
+
+
+
+[endsect]
+
+
+
+[section:char_type common::basic_cookie::char_type]
+
+[indexterm2 char_type..common::basic_cookie]
+
+ typedef CharT char_type;
+
+
+
+
+[endsect]
+
+
+
+[section:domain common::basic_cookie::domain]
+
+[indexterm2 domain..common::basic_cookie]
+
+ string_type domain;
+
+
+
+[endsect]
+
+
+
+[section:empty common::basic_cookie::empty]
+
+[indexterm2 empty..common::basic_cookie]
+
+ bool empty() const;
+
+
+
+[endsect]
+
+
+
+[section:expires common::basic_cookie::expires]
+
+[indexterm2 expires..common::basic_cookie]
+
+ string_type expires;
+
+
+
+[endsect]
+
+
+
+[section:http_only common::basic_cookie::http_only]
+
+[indexterm2 http_only..common::basic_cookie]
+
+ bool http_only;
+
+
+
+[endsect]
+
+
+
+[section:name common::basic_cookie::name]
+
+[indexterm2 name..common::basic_cookie]
+
+ string_type name;
+
+
+
+[endsect]
+
+
+
+[section:operator_const_char_type_* common::basic_cookie::operator const char_type *]
+
+[indexterm2 operator const char_type *..common::basic_cookie]
+
+ operator const char_type *() const;
+
+
+
+[endsect]
+
+
+
+[section:operator_std__basic_string_lt__T__gt_ common::basic_cookie::operator std::basic_string< T >]
+
+[indexterm2 operator std::basic_string< T >..common::basic_cookie]
+
+ template<
+ typename T >
+ operator std::basic_string< T >();
+
+
+
+[endsect]
+
+
+
+[section:operator_string_type common::basic_cookie::operator string_type]
+
+[indexterm2 operator string_type..common::basic_cookie]
+
+ operator string_type() const;
+
+
+
+[endsect]
+
+
+
+[section:operator_string_type_const_& common::basic_cookie::operator string_type const &]
+
+[indexterm2 operator string_type const &..common::basic_cookie]
+
+ operator string_type const &() const;
+
+
+
+[endsect]
+
+
+
+[section:operator_lt__lt_ common::basic_cookie::operator<<]
+
+[indexterm2 operator<<..common::basic_cookie]
+
+ template<
+ typename T >
+ friend std::ostream & operator<<(
+ std::ostream & os,
+ basic_cookie< T > const & ck);
+
+
+
+[endsect]
+
+
+
+[section:path common::basic_cookie::path]
+
+[indexterm2 path..common::basic_cookie]
+
+ string_type path;
+
+
+
+[endsect]
+
+
+
+[section:secure common::basic_cookie::secure]
+
+[indexterm2 secure..common::basic_cookie] `true` iff the cookie is only used for secure connections.
+
+ bool secure;
+
+
+
+[endsect]
+
+
+
+[section:self_type common::basic_cookie::self_type]
+
+[indexterm2 self_type..common::basic_cookie]
+
+ typedef basic_cookie< CharT > self_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_cookie.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_cookie.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_cookie.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_cookie.basic_cookie [*basic_cookie]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.c_str [*c_str]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.empty [*empty]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_const_char_type_* [*operator const char_type *]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_std__basic_string_lt__T__gt_ [*operator std::basic_string< T >]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_string_type [*operator string_type]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_string_type_const_& [*operator string_type const &]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.to_string [*to_string]]]
+ [TODO: Create a cookie from a const char*. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_cookie.domain [*domain]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.expires [*expires]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.http_only [*http_only]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.name [*name]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.path [*path]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.secure [*secure]]]
+ [`true` iff the cookie is only used for secure connections. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_cookie.value [*value]]]
+ []
+ ]
+
+]
+
+[heading Friends]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_cookie.operator_lt__lt_ [*operator<<]]]
+ []
+ ]
+
+]
+
+Either set the parameters in the constructor, or set them directly. Note: If you want to set the parameters individually, remember that each parameter must NOT have a trailing semi-colon!
+
+TODO
+* Data should be URL-encoded, or maybe provide an overload for url_decode that takes an HttpCookie?
+
+* Add from_string() ?
+
+
+
+
+[endsect]
+
+
+
+[section:string_type common::basic_cookie::string_type]
+
+[indexterm2 string_type..common::basic_cookie]
+
+ typedef std::basic_string< CharT > string_type;
+
+
+
+
+[endsect]
+
+
+
+[section:to_string common::basic_cookie::to_string]
+
+[indexterm2 to_string..common::basic_cookie] TODO: Create a cookie from a const char*.
+
+ string_type to_string() const;
+
+
+Rules at: http://wp.netscape.com/newsref/std/cookie\_spec.html Make a string out of the cookie.
+
+
+[endsect]
+
+
+
+[section:value common::basic_cookie::value]
+
+[indexterm2 value..common::basic_cookie]
+
+ string_type value;
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__basic_header common::basic_header]
+
+
+
+ template<
+ typename ``[link cgi.reference.CharT CharT]``>
+ struct basic_header
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_header.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_header.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_header.basic_header [*basic_header]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_header.operator_string_type [*operator string_type]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_header.content [*content]]]
+ []
+ ]
+
+]
+
+[section:basic_header common::basic_header::basic_header]
+
+[indexterm2 basic_header..common::basic_header]
+
+ ``[link cgi.reference.common__basic_header.basic_header.overload1 basic_header]``();
+
+ ``[link cgi.reference.common__basic_header.basic_header.overload2 basic_header]``(
+ const string_type & _content);
+
+ ``[link cgi.reference.common__basic_header.basic_header.overload3 basic_header]``(
+ const string_type & name,
+ const string_type & val);
+
+
+[section:overload1 common::basic_header::basic_header (1 of 3 overloads)]
+
+
+
+ basic_header();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_header::basic_header (2 of 3 overloads)]
+
+
+
+ basic_header(
+ const string_type & _content);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_header::basic_header (3 of 3 overloads)]
+
+
+
+ basic_header(
+ const string_type & name,
+ const string_type & val);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:char_type common::basic_header::char_type]
+
+[indexterm2 char_type..common::basic_header]
+
+ typedef CharT char_type;
+
+
+
+
+[endsect]
+
+
+
+[section:content common::basic_header::content]
+
+[indexterm2 content..common::basic_header]
+
+ string_type content;
+
+
+
+[endsect]
+
+
+
+[section:operator_string_type common::basic_header::operator string_type]
+
+[indexterm2 operator string_type..common::basic_header]
+
+ operator string_type();
+
+
+
+[endsect]
+
+
+
+[section:string_type common::basic_header::string_type]
+
+[indexterm2 string_type..common::basic_header]
+
+ typedef std::basic_string< CharT > string_type;
+
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__basic_protocol_service common::basic_protocol_service]
+
+Basic Protocol Service.
+
+ template<
+ typename ``[link cgi.reference.Protocol Protocol]``,
+ typename ``[link cgi.reference.IoServiceProvider IoServiceProvider]``>
+ class basic_protocol_service
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.ios_provider_type [*ios_provider_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.queue_type [*queue_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.request_ptr [*request_ptr]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.request_type [*request_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.set_type [*set_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.traits [*traits]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.basic_protocol_service [*basic_protocol_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.dispatch [*dispatch]]]
+ [Dispatch a handler through an available io_service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.io_service [*io_service]]]
+ [Return an available io_service from the IoServiceProvider. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.is_cgi [*is_cgi]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.post [*post]]]
+ [Post the handler through an available io_service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.reset [*reset]]]
+ [Reset all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.run [*run]]]
+ [Run all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.stop [*stop]]]
+ [Stop all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service._basic_protocol_service [*~basic_protocol_service]]]
+ []
+ ]
+
+]
+
+Holds the request queue and the connection queue. It is also a wrapper around asio::io\_service
+
+[section:basic_protocol_service common::basic_protocol_service::basic_protocol_service]
+
+[indexterm2 basic_protocol_service..common::basic_protocol_service]
+
+ ``[link cgi.reference.common__basic_protocol_service.basic_protocol_service.overload1 basic_protocol_service]``(
+ int pool_size_hint = 1);
+
+ ``[link cgi.reference.common__basic_protocol_service.basic_protocol_service.overload2 basic_protocol_service]``(
+ boost::asio::io_service & ios);
+
+
+[section:overload1 common::basic_protocol_service::basic_protocol_service (1 of 2 overloads)]
+
+
+
+ basic_protocol_service(
+ int pool_size_hint = 1);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_protocol_service::basic_protocol_service (2 of 2 overloads)]
+
+
+
+ basic_protocol_service(
+ boost::asio::io_service & ios);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:dispatch common::basic_protocol_service::dispatch]
+
+[indexterm2 dispatch..common::basic_protocol_service] Dispatch a handler through an available io_service.
+
+ template<
+ typename Handler >
+ void dispatch(
+ Handler handler);
+
+
+
+[endsect]
+
+
+
+[section:io_service common::basic_protocol_service::io_service]
+
+[indexterm2 io_service..common::basic_protocol_service] Return an available io_service from the IoServiceProvider.
+
+ ::BOOST_CGI_NAMESPACE::common::io_service & io_service();
+
+
+The order in which the underlying io\_services are returned is determined by what policy the IoServiceProvider uses.
+
+
+[endsect]
+
+
+
+[section:ios_provider_type common::basic_protocol_service::ios_provider_type]
+
+[indexterm2 ios_provider_type..common::basic_protocol_service]
+
+ typedef IoServiceProvider ios_provider_type;
+
+
+
+
+[endsect]
+
+
+
+[section:is_cgi common::basic_protocol_service::is_cgi]
+
+[indexterm2 is_cgi..common::basic_protocol_service]
+
+ bool is_cgi();
+
+
+
+[endsect]
+
+
+
+[section:post common::basic_protocol_service::post]
+
+[indexterm2 post..common::basic_protocol_service] Post the handler through an available io_service.
+
+ template<
+ typename Handler >
+ void post(
+ Handler handler);
+
+
+
+[endsect]
+
+
+
+[section:protocol_type common::basic_protocol_service::protocol_type]
+
+[indexterm2 protocol_type..common::basic_protocol_service]
+
+ typedef Protocol protocol_type;
+
+
+
+
+[endsect]
+
+
+
+[section:queue_type common::basic_protocol_service::queue_type]
+
+[indexterm2 queue_type..common::basic_protocol_service]
+
+ typedef std::queue< request_ptr > queue_type;
+
+
+
+
+[endsect]
+
+
+
+[section:request_ptr common::basic_protocol_service::request_ptr]
+
+[indexterm2 request_ptr..common::basic_protocol_service]
+
+ typedef boost::shared_ptr< request_type > request_ptr;
+
+
+
+
+[endsect]
+
+
+
+[section:request_type common::basic_protocol_service::request_type]
+
+[indexterm2 request_type..common::basic_protocol_service]
+
+ typedef traits::request_type request_type;
+
+
+
+
+[endsect]
+
+
+
+[section:reset common::basic_protocol_service::reset]
+
+[indexterm2 reset..common::basic_protocol_service] Reset all the io_services contained by this service.
+
+ void reset();
+
+
+This deletes the request queue(s), aborts all running requests and then calls reset() on each of the io\_services held by ios\_provider\_. There is no guarantee that requests will terminate immediately.
+
+
+[endsect]
+
+
+
+[section:run common::basic_protocol_service::run]
+
+[indexterm2 run..common::basic_protocol_service] Run all the io_services contained by this service.
+
+ void run();
+
+
+This is equivalent to calling run() on each of the io\_services held by ios\_provider\_
+
+
+[endsect]
+
+
+
+[section:set_type common::basic_protocol_service::set_type]
+
+[indexterm2 set_type..common::basic_protocol_service]
+
+ typedef std::set< request_ptr > set_type;
+
+
+
+
+[endsect]
+
+
+
+[section:stop common::basic_protocol_service::stop]
+
+[indexterm2 stop..common::basic_protocol_service] Stop all the io_services contained by this service.
+
+ void stop();
+
+
+This is equivalent to calling stop() on each of the io\_services held by ios\_provider\_
+
+
+[endsect]
+
+
+
+[section:traits common::basic_protocol_service::traits]
+
+[indexterm2 traits..common::basic_protocol_service]
+
+ typedef detail::protocol_traits< Protocol >::type traits;
+
+
+
+
+[endsect]
+
+
+
+[section:_basic_protocol_service common::basic_protocol_service::~basic_protocol_service]
+
+[indexterm2 ~basic_protocol_service..common::basic_protocol_service]
+
+ ~basic_protocol_service();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__basic_request common::basic_request]
+
+The basic_request class, primary entry point to the library.
+
+ template<
+ typename ``[link cgi.reference.Protocol Protocol]``>
+ class basic_request
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_request.buffer_type [*buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.client_type [*client_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.implementation_type [*implementation_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.pointer [*pointer]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.protocol_service_type [*protocol_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.service_type [*service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.string_type [*string_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.traits [*traits]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_request.abort [*abort]]]
+ [Abort a request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.auth_type [*auth_type]]]
+ [Set the output for the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.basic_request [*basic_request]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.charset [*charset]]]
+ [Get the charset from the CONTENT_TYPE header. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.clear [*clear]]]
+ [Clear the data for the request, for reusing this object. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.client [*client]]]
+ [Get the client connection associated with the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.close [*close]]]
+ [Asynchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.content_length [*content_length]]]
+ [Get the content length as a long. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.content_type [*content_type]]]
+ [The content type of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.create [*create]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.gateway_interface [*gateway_interface]]]
+ [The protocol used by the server to communicate to the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.hash [*hash]]]
+ [Get a hashed interpretation of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.http_cookie [*http_cookie]]]
+ [The cookies sent by the user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.http_from [*http_from]]]
+ [The email of the user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.id [*id]]]
+ [The id of this request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.is_open [*is_open]]]
+ [Check if the request is still open (ie. not aborted or closed). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.load [*load]]]
+ [Synchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.method [*method]]]
+ [The method of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.path_info [*path_info]]]
+ [Additional information, appendended to the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.path_translated [*path_translated]]]
+ [The translated version of the path info. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.post_buffer [*post_buffer]]]
+ [Get the buffer containing the POST data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.query_string [*query_string]]]
+ [The query string for the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.read_some [*read_some]]]
+ [Read some data into the request, parsing if necessary. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.referer [*referer]]]
+ [Get the web page the user came from. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.reject [*reject]]]
+ [Reject the request with a '500 Internal Server Error' error. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_addr [*remote_addr]]]
+ [The host address of the remote user. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_host [*remote_host]]]
+ [The host name of the remote user's machine. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_ident [*remote_ident]]]
+ [The user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_user [*remote_user]]]
+ [The userid of the person accessing the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.request_method [*request_method]]]
+ [The method of the request (long-hand of `method()`). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.request_uri [*request_uri]]]
+ [Get the URI of the request (long-hand of `uri()`). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.role [*role]]]
+ [The role that the request is playing. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_name [*script_name]]]
+ [The name of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_uri [*script_uri]]]
+ [The full URI of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_url [*script_url]]]
+ [The URL of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_name [*server_name]]]
+ [Get the name of the server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_port [*server_port]]]
+ [Get the port the calling server is listening on. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_protocol [*server_protocol]]]
+ [Get the protocol being used by the calling server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_software [*server_software]]]
+ [Get a string identifying the calling server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.set_protocol_service [*set_protocol_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.status [*status]]]
+ [Get / Set the status of a request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.uri [*uri]]]
+ [Get the URI of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request._basic_request [*~basic_request]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_request.cookies [*cookies]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.env [*env]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.form [*form]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.get [*get]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.post [*post]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.uploads [*uploads]]]
+ []
+ ]
+
+]
+
+Note: By default, synchronous protocols (ie. cgi) auto-load AND parse STDIN,whereas async protocols don't.
+
+Note: The alternative functions which take a boost::system::error\_code are the non-throwing versions. Instead of a boost::system::system\_error being thrown in case of an error, the passed error\_code will be set to the value of the error, s.t. if (error) evaluates to true.`
+
+Note: This class isn't thread safe: carrying around a mutex-per-request seems prohibitively expensive. There could be functions which take a mutex as an argument and lock it. (Async calls could get messy if you need a protected request object).
+
+
+[section:abort common::basic_request::abort]
+
+[indexterm2 abort..common::basic_request] Abort a request.
+
+ void abort();
+
+
+
+[endsect]
+
+
+
+[section:auth_type common::basic_request::auth_type]
+
+[indexterm2 auth_type..common::basic_request] Set the output for the request.
+
+ string_type & auth_type();
+
+
+Not Implemented Yet ******************
+
+Set the output sink as `stdout\_`, `stderr\_`, or `stdout\_ | stderr\_`
+
+
+[endsect]
+
+
+[section:basic_request common::basic_request::basic_request]
+
+[indexterm2 basic_request..common::basic_request]
+
+ ``[link cgi.reference.common__basic_request.basic_request.overload1 basic_request]``(
+ int opts,
+ char ** base_env = NULL);
+
+ ``[link cgi.reference.common__basic_request.basic_request.overload2 basic_request]``(
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+ ``[link cgi.reference.common__basic_request.basic_request.overload3 basic_request]``(
+ boost::system::error_code & ec,
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+ ``[link cgi.reference.common__basic_request.basic_request.overload4 basic_request]``(
+ protocol_service_type & s,
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+ ``[link cgi.reference.common__basic_request.basic_request.overload5 basic_request]``(
+ protocol_service_type & s,
+ boost::system::error_code & ec,
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+ ``[link cgi.reference.common__basic_request.basic_request.overload6 basic_request]``(
+ implementation_type & impl);
+
+ ``[link cgi.reference.common__basic_request.basic_request.overload7 basic_request]``(
+ implementation_type & impl,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request::basic_request (1 of 7 overloads)]
+
+
+
+ basic_request(
+ int opts,
+ char ** base_env = NULL);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request::basic_request (2 of 7 overloads)]
+
+
+
+ basic_request(
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_request::basic_request (3 of 7 overloads)]
+
+
+
+ basic_request(
+ boost::system::error_code & ec,
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::basic_request::basic_request (4 of 7 overloads)]
+
+
+
+ basic_request(
+ protocol_service_type & s,
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+
+
+[endsect]
+
+
+
+[section:overload5 common::basic_request::basic_request (5 of 7 overloads)]
+
+
+
+ basic_request(
+ protocol_service_type & s,
+ boost::system::error_code & ec,
+ const parse_options opts = traits::parse_opts,
+ char ** base_env = NULL);
+
+
+
+[endsect]
+
+
+
+[section:overload6 common::basic_request::basic_request (6 of 7 overloads)]
+
+Make a new mutiplexed request from an existing connection.
+
+ basic_request(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:overload7 common::basic_request::basic_request (7 of 7 overloads)]
+
+Make a new mutiplexed request from an existing connection.
+
+ basic_request(
+ implementation_type & impl,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:buffer_type common::basic_request::buffer_type]
+
+[indexterm2 buffer_type..common::basic_request]
+
+ typedef traits::buffer_type buffer_type;
+
+
+
+
+[endsect]
+
+
+
+[section:char_type common::basic_request::char_type]
+
+[indexterm2 char_type..common::basic_request]
+
+ typedef traits::char_type char_type;
+
+
+
+
+[endsect]
+
+
+
+[section:charset common::basic_request::charset]
+
+[indexterm2 charset..common::basic_request] Get the charset from the CONTENT_TYPE header.
+
+ string_type charset();
+
+
+
+[endsect]
+
+
+
+[section:clear common::basic_request::clear]
+
+[indexterm2 clear..common::basic_request] Clear the data for the request, for reusing this object.
+
+ void clear();
+
+
+
+[endsect]
+
+
+
+[section:client common::basic_request::client]
+
+[indexterm2 client..common::basic_request] Get the client connection associated with the request.
+
+ client_type & client();
+
+
+You use the client for read/write calls.
+
+
+[endsect]
+
+
+
+[section:client_type common::basic_request::client_type]
+
+[indexterm2 client_type..common::basic_request]
+
+ typedef traits::client_type client_type;
+
+
+
+
+[endsect]
+
+
+[section:close common::basic_request::close]
+
+[indexterm2 close..common::basic_request] Asynchronously read/parse the request meta-data.
+
+ int ``[link cgi.reference.common__basic_request.close.overload1 close]``(
+ common::http::status_code http_status = http::ok,
+ int program_status = 0);
+
+ int ``[link cgi.reference.common__basic_request.close.overload2 close]``(
+ common::http::status_code http_status,
+ int program_status,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request::close (1 of 2 overloads)]
+
+Asynchronously read/parse the request meta-data.
+
+ int close(
+ common::http::status_code http_status = http::ok,
+ int program_status = 0);
+
+
+Note: 'loading' including reading/parsing STDIN if parse\_stdin == true Notify the server the request has been handled. In certain situations (such as a Proactor client using the async read functions) it will be necessary to call end, rather than just returning from the sub\_main function.
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[http_status][The HTTP status of the request.]]
+
+[[program_status][This value is returned to the server indicating the state of the request after it was finished handling. It is implementation defined how the server deals with this, and it may have no effect on the http status code returned to the client (eg. 200 OK).]]
+
+]
+
+[heading Return Value]
+
+The value of program\_status
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request::close (2 of 2 overloads)]
+
+
+
+ int close(
+ common::http::status_code http_status,
+ int program_status,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:content_length common::basic_request::content_length]
+
+[indexterm2 content_length..common::basic_request] Get the content length as a long.
+
+ long content_length();
+
+
+The content length defaults to zero if it isn't explicitly set by your HTTP server.
+
+
+[endsect]
+
+
+
+[section:content_type common::basic_request::content_type]
+
+[indexterm2 content_type..common::basic_request] The content type of the request.
+
+ string_type & content_type();
+
+
+Common value: text/html.
+
+
+[endsect]
+
+
+
+[section:cookies common::basic_request::cookies]
+
+[indexterm2 cookies..common::basic_request]
+
+ common::data_map_proxy< cookie_map > cookies;
+
+
+
+[endsect]
+
+
+[section:create common::basic_request::create]
+
+[indexterm2 create..common::basic_request]
+
+ static pointer ``[link cgi.reference.common__basic_request.create.overload1 create]``(
+ protocol_service_type & ps);
+
+ static pointer ``[link cgi.reference.common__basic_request.create.overload2 create]``();
+
+
+[section:overload1 common::basic_request::create (1 of 2 overloads)]
+
+
+
+ static pointer create(
+ protocol_service_type & ps);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request::create (2 of 2 overloads)]
+
+
+
+ static pointer create();
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:env common::basic_request::env]
+
+[indexterm2 env..common::basic_request]
+
+ common::data_map_proxy< env_map > env;
+
+
+
+[endsect]
+
+
+
+[section:form common::basic_request::form]
+
+[indexterm2 form..common::basic_request]
+
+ common::data_map_proxy< form_map > form;
+
+
+
+[endsect]
+
+
+
+[section:gateway_interface common::basic_request::gateway_interface]
+
+[indexterm2 gateway_interface..common::basic_request] The protocol used by the server to communicate to the script.
+
+ string_type & gateway_interface();
+
+
+Common value: CGI/1.1.
+
+
+[endsect]
+
+
+
+[section:get common::basic_request::get]
+
+[indexterm2 get..common::basic_request]
+
+ common::data_map_proxy< get_map > get;
+
+
+
+[endsect]
+
+
+
+[section:hash common::basic_request::hash]
+
+[indexterm2 hash..common::basic_request] Get a hashed interpretation of the request.
+
+ std::size_t hash();
+
+
+You cannot consider this completely unique to each request, but it should be quite useful anyway. You can use this for logging or tracking, for example.
+
+
+[endsect]
+
+
+
+[section:http_cookie common::basic_request::http_cookie]
+
+[indexterm2 http_cookie..common::basic_request] The cookies sent by the user making the request.
+
+ string_type & http_cookie();
+
+
+
+[endsect]
+
+
+
+[section:http_from common::basic_request::http_from]
+
+[indexterm2 http_from..common::basic_request] The email of the user making the request.
+
+ string_type & http_from();
+
+
+
+[endsect]
+
+
+
+[section:id common::basic_request::id]
+
+[indexterm2 id..common::basic_request] The id of this request.
+
+ int id();
+
+
+This is 1 for CGI/aCGI requests, but may be != 1 for FastCGI requests.
+
+Note that for FastCGI requests, the id's are assigned on a *per-connection* policy, so in one application you may have several requests with the same id.
+
+
+[endsect]
+
+
+
+[section:implementation_type common::basic_request::implementation_type]
+
+[indexterm2 implementation_type..common::basic_request]
+
+ typedef service_type::implementation_type implementation_type;
+
+
+
+
+[endsect]
+
+
+
+[section:is_open common::basic_request::is_open]
+
+[indexterm2 is_open..common::basic_request] Check if the request is still open (ie. not aborted or closed).
+
+ bool is_open();
+
+
+
+[endsect]
+
+
+[section:load common::basic_request::load]
+
+[indexterm2 load..common::basic_request] Synchronously read/parse the request meta-data.
+
+ void ``[link cgi.reference.common__basic_request.load.overload1 load]``(
+ parse_options parse_opts = parse_env,
+ char ** base_env = NULL);
+
+ boost::system::error_code ``[link cgi.reference.common__basic_request.load.overload2 load]``(
+ parse_options parse_opts,
+ boost::system::error_code & ec,
+ char ** base_environment = NULL,
+ bool is_command_line = true);
+
+ void ``[link cgi.reference.common__basic_request.load.overload3 load]``(
+ char ** base_environment,
+ bool is_command_line = true);
+
+
+[section:overload1 common::basic_request::load (1 of 3 overloads)]
+
+Synchronously read/parse the request meta-data.
+
+ void load(
+ parse_options parse_opts = parse_env,
+ char ** base_env = NULL);
+
+
+Note: 'loading' including reading/parsing STDIN if parse\_stdin == true
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request::load (2 of 3 overloads)]
+
+
+
+ boost::system::error_code load(
+ parse_options parse_opts,
+ boost::system::error_code & ec,
+ char ** base_environment = NULL,
+ bool is_command_line = true);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_request::load (3 of 3 overloads)]
+
+
+
+ void load(
+ char ** base_environment,
+ bool is_command_line = true);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:method common::basic_request::method]
+
+[indexterm2 method..common::basic_request] The method of the request.
+
+ string_type & method();
+
+
+Common values: `GET`, `POST`, `HEAD`.
+
+
+[endsect]
+
+
+
+[section:path_info common::basic_request::path_info]
+
+[indexterm2 path_info..common::basic_request] Additional information, appendended to the script.
+
+ common::path_info path_info();
+
+
+
+[endsect]
+
+
+
+[section:path_translated common::basic_request::path_translated]
+
+[indexterm2 path_translated..common::basic_request] The translated version of the path info.
+
+ string_type & path_translated();
+
+
+Your HTTP server may provide this, depending on configuration. The path info can represent a resource on the local file system.
+
+
+[endsect]
+
+
+
+[section:pointer common::basic_request::pointer]
+
+[indexterm2 pointer..common::basic_request]
+
+ typedef traits::pointer pointer;
+
+
+
+
+[endsect]
+
+
+
+[section:post common::basic_request::post]
+
+[indexterm2 post..common::basic_request]
+
+ common::data_map_proxy< post_map > post;
+
+
+
+[endsect]
+
+
+
+[section:post_buffer common::basic_request::post_buffer]
+
+[indexterm2 post_buffer..common::basic_request] Get the buffer containing the POST data.
+
+ buffer_type & post_buffer();
+
+
+**FIXME** This actually returns the whole buffer on FastCGI at the moment, which contains the params too.
+
+
+[endsect]
+
+
+
+[section:protocol_service_type common::basic_request::protocol_service_type]
+
+[indexterm2 protocol_service_type..common::basic_request]
+
+ typedef traits::protocol_service_type protocol_service_type;
+
+
+
+
+[endsect]
+
+
+
+[section:protocol_type common::basic_request::protocol_type]
+
+[indexterm2 protocol_type..common::basic_request]
+
+ typedef Protocol protocol_type;
+
+
+
+
+[endsect]
+
+
+
+[section:query_string common::basic_request::query_string]
+
+[indexterm2 query_string..common::basic_request] The query string for the request.
+
+ string_type & query_string();
+
+
+This is the part of the request URI after a '?'. A GET request passes request parameters, URL encoded in the query string.
+
+
+[endsect]
+
+
+[section:read_some common::basic_request::read_some]
+
+[indexterm2 read_some..common::basic_request] Read some data into the request, parsing if necessary.
+
+ void ``[link cgi.reference.common__basic_request.read_some.overload1 read_some]``();
+
+ std::size_t ``[link cgi.reference.common__basic_request.read_some.overload2 read_some]``(
+ boost::system::error_code & ec);
+
+ template<
+ typename MutableBufferSequence >
+ void ``[link cgi.reference.common__basic_request.read_some.overload3 read_some]``(
+ const MutableBufferSequence & buf);
+
+ template<
+ typename MutableBufferSequence >
+ std::size_t ``[link cgi.reference.common__basic_request.read_some.overload4 read_some]``(
+ const MutableBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request::read_some (1 of 4 overloads)]
+
+Read some data into the request, parsing if necessary.
+
+ void read_some();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request::read_some (2 of 4 overloads)]
+
+Read some data into the request, parsing if necessary.
+
+ std::size_t read_some(
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_request::read_some (3 of 4 overloads)]
+
+Read some data into the supplied buffer, parsing if necessary.
+
+ template<
+ typename MutableBufferSequence >
+ void read_some(
+ const MutableBufferSequence & buf);
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::basic_request::read_some (4 of 4 overloads)]
+
+Read some data into the supplied buffer, parsing if necessary.
+
+ template<
+ typename MutableBufferSequence >
+ std::size_t read_some(
+ const MutableBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:referer common::basic_request::referer]
+
+[indexterm2 referer..common::basic_request] Get the web page the user came from.
+
+ string_type & referer();
+
+
+HTTP equivalent: `HTTP\_REFERER`
+
+The referer is commonly used for tracking user's movements and origins. For instance, some sites use this to highlight some keywords on the page when users come from a search engine.
+
+Note that you cannot ever guarantee on this value being either set or accurate.
+
+
+[endsect]
+
+
+
+[section:reject common::basic_request::reject]
+
+[indexterm2 reject..common::basic_request] Reject the request with a '500 Internal Server Error' error.
+
+ int reject();
+
+
+
+[endsect]
+
+
+
+[section:remote_addr common::basic_request::remote_addr]
+
+[indexterm2 remote_addr..common::basic_request] The host address of the remote user.
+
+ string_type & remote_addr();
+
+
+
+[endsect]
+
+
+
+[section:remote_host common::basic_request::remote_host]
+
+[indexterm2 remote_host..common::basic_request] The host name of the remote user's machine.
+
+ string_type & remote_host();
+
+
+
+[endsect]
+
+
+
+[section:remote_ident common::basic_request::remote_ident]
+
+[indexterm2 remote_ident..common::basic_request] The user making the request.
+
+ string_type & remote_ident();
+
+
+
+[endsect]
+
+
+
+[section:remote_user common::basic_request::remote_user]
+
+[indexterm2 remote_user..common::basic_request] The userid of the person accessing the script.
+
+ string_type & remote_user();
+
+
+
+[endsect]
+
+
+
+[section:request_method common::basic_request::request_method]
+
+[indexterm2 request_method..common::basic_request] The method of the request (long-hand of `method()`).
+
+ string_type & request_method();
+
+
+Common values: `GET`, `POST`, `HEAD`.
+
+
+[endsect]
+
+
+
+[section:request_uri common::basic_request::request_uri]
+
+[indexterm2 request_uri..common::basic_request] Get the URI of the request (long-hand of `uri()`).
+
+ string_type & request_uri();
+
+
+
+[endsect]
+
+
+
+[section:role common::basic_request::role]
+
+[indexterm2 role..common::basic_request] The role that the request is playing.
+
+ role_type & role() const;
+
+
+The default role type is responder.
+
+In some cases - for instance with FastCGI - the role type can be different eg. `authorizer`, or `filter`.
+
+
+[endsect]
+
+
+
+[section:script_name common::basic_request::script_name]
+
+[indexterm2 script_name..common::basic_request] The name of the script.
+
+ string_type & script_name();
+
+
+
+[endsect]
+
+
+
+[section:script_uri common::basic_request::script_uri]
+
+[indexterm2 script_uri..common::basic_request] The full URI of the script.
+
+ string_type & script_uri();
+
+
+
+[endsect]
+
+
+
+[section:script_url common::basic_request::script_url]
+
+[indexterm2 script_url..common::basic_request] The URL of the script.
+
+ string_type & script_url();
+
+
+
+[endsect]
+
+
+
+[section:self_type common::basic_request::self_type]
+
+[indexterm2 self_type..common::basic_request]
+
+ typedef basic_request< Protocol > self_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_request.buffer_type [*buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.client_type [*client_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.implementation_type [*implementation_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.pointer [*pointer]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.protocol_service_type [*protocol_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.service_type [*service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.string_type [*string_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.traits [*traits]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_request.abort [*abort]]]
+ [Abort a request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.auth_type [*auth_type]]]
+ [Set the output for the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.basic_request [*basic_request]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.charset [*charset]]]
+ [Get the charset from the CONTENT_TYPE header. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.clear [*clear]]]
+ [Clear the data for the request, for reusing this object. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.client [*client]]]
+ [Get the client connection associated with the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.close [*close]]]
+ [Asynchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.content_length [*content_length]]]
+ [Get the content length as a long. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.content_type [*content_type]]]
+ [The content type of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.create [*create]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.gateway_interface [*gateway_interface]]]
+ [The protocol used by the server to communicate to the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.hash [*hash]]]
+ [Get a hashed interpretation of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.http_cookie [*http_cookie]]]
+ [The cookies sent by the user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.http_from [*http_from]]]
+ [The email of the user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.id [*id]]]
+ [The id of this request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.is_open [*is_open]]]
+ [Check if the request is still open (ie. not aborted or closed). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.load [*load]]]
+ [Synchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.method [*method]]]
+ [The method of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.path_info [*path_info]]]
+ [Additional information, appendended to the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.path_translated [*path_translated]]]
+ [The translated version of the path info. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.post_buffer [*post_buffer]]]
+ [Get the buffer containing the POST data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.query_string [*query_string]]]
+ [The query string for the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.read_some [*read_some]]]
+ [Read some data into the request, parsing if necessary. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.referer [*referer]]]
+ [Get the web page the user came from. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.reject [*reject]]]
+ [Reject the request with a '500 Internal Server Error' error. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_addr [*remote_addr]]]
+ [The host address of the remote user. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_host [*remote_host]]]
+ [The host name of the remote user's machine. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_ident [*remote_ident]]]
+ [The user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_user [*remote_user]]]
+ [The userid of the person accessing the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.request_method [*request_method]]]
+ [The method of the request (long-hand of `method()`). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.request_uri [*request_uri]]]
+ [Get the URI of the request (long-hand of `uri()`). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.role [*role]]]
+ [The role that the request is playing. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_name [*script_name]]]
+ [The name of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_uri [*script_uri]]]
+ [The full URI of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_url [*script_url]]]
+ [The URL of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_name [*server_name]]]
+ [Get the name of the server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_port [*server_port]]]
+ [Get the port the calling server is listening on. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_protocol [*server_protocol]]]
+ [Get the protocol being used by the calling server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_software [*server_software]]]
+ [Get a string identifying the calling server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.set_protocol_service [*set_protocol_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.status [*status]]]
+ [Get / Set the status of a request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.uri [*uri]]]
+ [Get the URI of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request._basic_request [*~basic_request]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_request.cookies [*cookies]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.env [*env]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.form [*form]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.get [*get]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.post [*post]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.uploads [*uploads]]]
+ []
+ ]
+
+]
+
+Note: By default, synchronous protocols (ie. cgi) auto-load AND parse STDIN,whereas async protocols don't.
+
+Note: The alternative functions which take a boost::system::error\_code are the non-throwing versions. Instead of a boost::system::system\_error being thrown in case of an error, the passed error\_code will be set to the value of the error, s.t. if (error) evaluates to true.`
+
+Note: This class isn't thread safe: carrying around a mutex-per-request seems prohibitively expensive. There could be functions which take a mutex as an argument and lock it. (Async calls could get messy if you need a protected request object).
+
+
+
+[endsect]
+
+
+
+[section:server_name common::basic_request::server_name]
+
+[indexterm2 server_name..common::basic_request] Get the name of the server.
+
+ string_type & server_name();
+
+
+Usually set in your HTTP configuration. This could be the name of a virtual host.
+
+
+[endsect]
+
+
+
+[section:server_port common::basic_request::server_port]
+
+[indexterm2 server_port..common::basic_request] Get the port the calling server is listening on.
+
+ string_type & server_port();
+
+
+Common value: 80.
+
+
+[endsect]
+
+
+
+[section:server_protocol common::basic_request::server_protocol]
+
+[indexterm2 server_protocol..common::basic_request] Get the protocol being used by the calling server.
+
+ string_type & server_protocol();
+
+
+Common value: HTTP/1.1.
+
+
+[endsect]
+
+
+
+[section:server_software common::basic_request::server_software]
+
+[indexterm2 server_software..common::basic_request] Get a string identifying the calling server.
+
+ string_type & server_software();
+
+
+CGI scripts are generally called by a web-facing HTTP server. When set, this string can be useful for knowing what is calling the script, especially in a multi-server or load balanced environment.
+
+
+[endsect]
+
+
+
+[section:service_type common::basic_request::service_type]
+
+[indexterm2 service_type..common::basic_request]
+
+ typedef traits::service_type service_type;
+
+
+
+
+[endsect]
+
+
+
+[section:set_protocol_service common::basic_request::set_protocol_service]
+
+[indexterm2 set_protocol_service..common::basic_request]
+
+ void set_protocol_service(
+ protocol_service_type & ps);
+
+
+
+[endsect]
+
+
+[section:status common::basic_request::status]
+
+[indexterm2 status..common::basic_request] Get / Set the status of a request.
+
+ common::request_status ``[link cgi.reference.common__basic_request.status.overload1 status]``() const;
+
+ void ``[link cgi.reference.common__basic_request.status.overload2 status]``(
+ common::request_status const & status);
+
+ common::http::status_code ``[link cgi.reference.common__basic_request.status.overload3 status]``(
+ common::http::status_code const & status) const;
+
+ void ``[link cgi.reference.common__basic_request.status.overload4 status]``(
+ common::http::status_code const & status);
+
+
+[section:overload1 common::basic_request::status (1 of 4 overloads)]
+
+Get / Set the status of a request.
+
+ common::request_status status() const;
+
+
+The usual way to set the request status is to set it when calling `close`.
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request::status (2 of 4 overloads)]
+
+
+
+ void status(
+ common::request_status const & status);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_request::status (3 of 4 overloads)]
+
+
+
+ common::http::status_code status(
+ common::http::status_code const & status) const;
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::basic_request::status (4 of 4 overloads)]
+
+
+
+ void status(
+ common::http::status_code const & status);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:string_type common::basic_request::string_type]
+
+[indexterm2 string_type..common::basic_request]
+
+ typedef traits::string_type string_type;
+
+
+
+
+[endsect]
+
+
+
+[section:traits common::basic_request::traits]
+
+[indexterm2 traits..common::basic_request]
+
+ typedef detail::protocol_traits< protocol_type > traits;
+
+
+
+
+[endsect]
+
+
+
+[section:uploads common::basic_request::uploads]
+
+[indexterm2 uploads..common::basic_request]
+
+ common::data_map_proxy< upload_map > uploads;
+
+
+
+[endsect]
+
+
+
+[section:uri common::basic_request::uri]
+
+[indexterm2 uri..common::basic_request] Get the URI of the request.
+
+ string_type & uri();
+
+
+
+[endsect]
+
+
+
+[section:_basic_request common::basic_request::~basic_request]
+
+[indexterm2 ~basic_request..common::basic_request]
+
+ ~basic_request();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__basic_request_acceptor common::basic_request_acceptor]
+
+The interface class for any *BOOST_CGI_NAMESPACEacceptor.
+
+ template<
+ typename RequestAcceptorService >
+ class basic_request_acceptor
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.accept_handler_type [*accept_handler_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.endpoint_type [*endpoint_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.native_type [*native_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.next_layer_type [*next_layer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.port_number_type [*port_number_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.protocol_service_type [*protocol_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request_acceptor.service_type [*service_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.accept [*accept]]]
+ [Accept one request and handle it with `handler`. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.assign [*assign]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.async_accept [*async_accept]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.basic_request_acceptor [*basic_request_acceptor]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.bind [*bind]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.cancel [*cancel]]]
+ [Cancel all asynchronous operations associated with the acceptor. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.close [*close]]]
+ [Close the acceptor. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.is_cgi [*is_cgi]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.is_open [*is_open]]]
+ [Check if the acceptor is open. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.listen [*listen]]]
+ [Set the acceptor to listen. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.local_endpoint [*local_endpoint]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.native [*native]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.open [*open]]]
+ [Open the acceptor. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor.protocol_service [*protocol_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request_acceptor._basic_request_acceptor [*~basic_request_acceptor]]]
+ []
+ ]
+
+]
+
+[section:accept common::basic_request_acceptor::accept]
+
+[indexterm2 accept..common::basic_request_acceptor] Accept one request and handle it with `handler`.
+
+ int ``[link cgi.reference.common__basic_request_acceptor.accept.overload1 accept]``(
+ accept_handler_type handler);
+
+ int ``[link cgi.reference.common__basic_request_acceptor.accept.overload2 accept]``(
+ accept_handler_type handler,
+ boost::system::error_code & ec);
+
+ template<
+ typename CommonGatewayRequest >
+ void ``[link cgi.reference.common__basic_request_acceptor.accept.overload3 accept]``(
+ CommonGatewayRequest & request);
+
+ template<
+ typename CommonGatewayRequest >
+ boost::system::error_code ``[link cgi.reference.common__basic_request_acceptor.accept.overload4 accept]``(
+ CommonGatewayRequest & request,
+ boost::system::error_code & ec);
+
+ template<
+ typename CommonGatewayRequest >
+ boost::system::error_code ``[link cgi.reference.common__basic_request_acceptor.accept.overload5 accept]``(
+ CommonGatewayRequest & request,
+ endpoint_type & ep,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request_acceptor::accept (1 of 5 overloads)]
+
+Accept one request and handle it with `handler`.
+
+ int accept(
+ accept_handler_type handler);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::accept (2 of 5 overloads)]
+
+
+
+ int accept(
+ accept_handler_type handler,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_request_acceptor::accept (3 of 5 overloads)]
+
+
+
+ template<
+ typename CommonGatewayRequest >
+ void accept(
+ CommonGatewayRequest & request);
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::basic_request_acceptor::accept (4 of 5 overloads)]
+
+Accept one request.
+
+ template<
+ typename CommonGatewayRequest >
+ boost::system::error_code accept(
+ CommonGatewayRequest & request,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:overload5 common::basic_request_acceptor::accept (5 of 5 overloads)]
+
+
+
+ template<
+ typename CommonGatewayRequest >
+ boost::system::error_code accept(
+ CommonGatewayRequest & request,
+ endpoint_type & ep,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:accept_handler_type common::basic_request_acceptor::accept_handler_type]
+
+[indexterm2 accept_handler_type..common::basic_request_acceptor]
+
+ typedef service_type::accept_handler_type accept_handler_type;
+
+
+
+
+[endsect]
+
+
+[section:assign common::basic_request_acceptor::assign]
+
+[indexterm2 assign..common::basic_request_acceptor]
+
+ template<
+ typename Protocol >
+ void ``[link cgi.reference.common__basic_request_acceptor.assign.overload1 assign]``(
+ Protocol protocol,
+ const native_type & native_acceptor);
+
+ template<
+ typename Protocol >
+ boost::system::error_code ``[link cgi.reference.common__basic_request_acceptor.assign.overload2 assign]``(
+ Protocol protocol,
+ const native_type & native_acceptor,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request_acceptor::assign (1 of 2 overloads)]
+
+
+
+ template<
+ typename Protocol >
+ void assign(
+ Protocol protocol,
+ const native_type & native_acceptor);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::assign (2 of 2 overloads)]
+
+
+
+ template<
+ typename Protocol >
+ boost::system::error_code assign(
+ Protocol protocol,
+ const native_type & native_acceptor,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:async_accept common::basic_request_acceptor::async_accept]
+
+[indexterm2 async_accept..common::basic_request_acceptor]
+
+ void ``[link cgi.reference.common__basic_request_acceptor.async_accept.overload1 async_accept]``(
+ accept_handler_type handler);
+
+ template<
+ typename CommonGatewayRequest ,
+ typename Handler >
+ void ``[link cgi.reference.common__basic_request_acceptor.async_accept.overload2 async_accept]``(
+ CommonGatewayRequest & request,
+ Handler handler);
+
+
+[section:overload1 common::basic_request_acceptor::async_accept (1 of 2 overloads)]
+
+
+
+ void async_accept(
+ accept_handler_type handler);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::async_accept (2 of 2 overloads)]
+
+Asynchronously accept one request.
+
+ template<
+ typename CommonGatewayRequest ,
+ typename Handler >
+ void async_accept(
+ CommonGatewayRequest & request,
+ Handler handler);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:basic_request_acceptor common::basic_request_acceptor::basic_request_acceptor]
+
+[indexterm2 basic_request_acceptor..common::basic_request_acceptor]
+
+ template<
+ typename IoServiceProvider >
+ ``[link cgi.reference.common__basic_request_acceptor.basic_request_acceptor.overload1 basic_request_acceptor]``(
+ common::basic_protocol_service< protocol_type, IoServiceProvider > & ps,
+ port_number_type port_num = 0);
+
+ template<
+ typename IoServiceProvider ,
+ typename InternetProtocol >
+ ``[link cgi.reference.common__basic_request_acceptor.basic_request_acceptor.overload2 basic_request_acceptor]``(
+ common::basic_protocol_service< protocol_type, IoServiceProvider > & ps,
+ const boost::asio::ip::basic_endpoint< InternetProtocol > & endpoint,
+ bool reuse_addr = true);
+
+ template<
+ typename IoServiceProvider ,
+ typename InternetProtocol >
+ ``[link cgi.reference.common__basic_request_acceptor.basic_request_acceptor.overload3 basic_request_acceptor]``(
+ common::basic_protocol_service< protocol_type, IoServiceProvider > & ps,
+ const InternetProtocol & ip,
+ const native_type & native_acceptor);
+
+
+[section:overload1 common::basic_request_acceptor::basic_request_acceptor (1 of 3 overloads)]
+
+
+
+ template<
+ typename IoServiceProvider >
+ basic_request_acceptor(
+ common::basic_protocol_service< protocol_type, IoServiceProvider > & ps,
+ port_number_type port_num = 0);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::basic_request_acceptor (2 of 3 overloads)]
+
+
+
+ template<
+ typename IoServiceProvider ,
+ typename InternetProtocol >
+ basic_request_acceptor(
+ common::basic_protocol_service< protocol_type, IoServiceProvider > & ps,
+ const boost::asio::ip::basic_endpoint< InternetProtocol > & endpoint,
+ bool reuse_addr = true);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_request_acceptor::basic_request_acceptor (3 of 3 overloads)]
+
+
+
+ template<
+ typename IoServiceProvider ,
+ typename InternetProtocol >
+ basic_request_acceptor(
+ common::basic_protocol_service< protocol_type, IoServiceProvider > & ps,
+ const InternetProtocol & ip,
+ const native_type & native_acceptor);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:bind common::basic_request_acceptor::bind]
+
+[indexterm2 bind..common::basic_request_acceptor]
+
+ template<
+ typename Endpoint >
+ void ``[link cgi.reference.common__basic_request_acceptor.bind.overload1 bind]``(
+ Endpoint & ep);
+
+ template<
+ typename Endpoint >
+ boost::system::error_code ``[link cgi.reference.common__basic_request_acceptor.bind.overload2 bind]``(
+ Endpoint & ep,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request_acceptor::bind (1 of 2 overloads)]
+
+
+
+ template<
+ typename Endpoint >
+ void bind(
+ Endpoint & ep);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::bind (2 of 2 overloads)]
+
+
+
+ template<
+ typename Endpoint >
+ boost::system::error_code bind(
+ Endpoint & ep,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:cancel common::basic_request_acceptor::cancel]
+
+[indexterm2 cancel..common::basic_request_acceptor] Cancel all asynchronous operations associated with the acceptor.
+
+ boost::system::error_code cancel();
+
+
+
+[endsect]
+
+
+[section:close common::basic_request_acceptor::close]
+
+[indexterm2 close..common::basic_request_acceptor] Close the acceptor.
+
+ void ``[link cgi.reference.common__basic_request_acceptor.close.overload1 close]``();
+
+ boost::system::error_code ``[link cgi.reference.common__basic_request_acceptor.close.overload2 close]``(
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request_acceptor::close (1 of 2 overloads)]
+
+Close the acceptor.
+
+ void close();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::close (2 of 2 overloads)]
+
+Close the acceptor.
+
+ boost::system::error_code close(
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:endpoint_type common::basic_request_acceptor::endpoint_type]
+
+[indexterm2 endpoint_type..common::basic_request_acceptor]
+
+ typedef service_type::endpoint_type endpoint_type;
+
+
+
+
+[endsect]
+
+
+
+[section:is_cgi common::basic_request_acceptor::is_cgi]
+
+[indexterm2 is_cgi..common::basic_request_acceptor]
+
+ bool is_cgi();
+
+
+
+[endsect]
+
+
+
+[section:is_open common::basic_request_acceptor::is_open]
+
+[indexterm2 is_open..common::basic_request_acceptor] Check if the acceptor is open.
+
+ bool is_open();
+
+
+
+[endsect]
+
+
+[section:listen common::basic_request_acceptor::listen]
+
+[indexterm2 listen..common::basic_request_acceptor] Set the acceptor to listen.
+
+ void ``[link cgi.reference.common__basic_request_acceptor.listen.overload1 listen]``(
+ int backlog = boost::asio::socket_base::max_connections);
+
+ boost::system::error_code ``[link cgi.reference.common__basic_request_acceptor.listen.overload2 listen]``(
+ int backlog,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request_acceptor::listen (1 of 2 overloads)]
+
+Set the acceptor to listen.
+
+ void listen(
+ int backlog = boost::asio::socket_base::max_connections);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::listen (2 of 2 overloads)]
+
+Set the acceptor to listen.
+
+ boost::system::error_code listen(
+ int backlog,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:local_endpoint common::basic_request_acceptor::local_endpoint]
+
+[indexterm2 local_endpoint..common::basic_request_acceptor]
+
+ endpoint_type ``[link cgi.reference.common__basic_request_acceptor.local_endpoint.overload1 local_endpoint]``();
+
+ endpoint_type ``[link cgi.reference.common__basic_request_acceptor.local_endpoint.overload2 local_endpoint]``(
+ boost::system::error_code & ec) const;
+
+
+[section:overload1 common::basic_request_acceptor::local_endpoint (1 of 2 overloads)]
+
+
+
+ endpoint_type local_endpoint();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::local_endpoint (2 of 2 overloads)]
+
+
+
+ endpoint_type local_endpoint(
+ boost::system::error_code & ec) const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:native common::basic_request_acceptor::native]
+
+[indexterm2 native..common::basic_request_acceptor]
+
+ native_type native();
+
+
+
+[endsect]
+
+
+
+[section:native_type common::basic_request_acceptor::native_type]
+
+[indexterm2 native_type..common::basic_request_acceptor]
+
+ typedef service_type::native_type native_type;
+
+
+
+
+[endsect]
+
+
+
+[section:next_layer_type common::basic_request_acceptor::next_layer_type]
+
+[indexterm2 next_layer_type..common::basic_request_acceptor]
+
+ typedef service_type::acceptor_service_type next_layer_type;
+
+
+
+
+[endsect]
+
+
+[section:open common::basic_request_acceptor::open]
+
+[indexterm2 open..common::basic_request_acceptor] Open the acceptor.
+
+ template<
+ typename Protocol >
+ void ``[link cgi.reference.common__basic_request_acceptor.open.overload1 open]``(
+ const Protocol & protocol);
+
+ template<
+ typename Protocol >
+ boost::system::error_code ``[link cgi.reference.common__basic_request_acceptor.open.overload2 open]``(
+ const Protocol & protocol,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_request_acceptor::open (1 of 2 overloads)]
+
+Open the acceptor.
+
+ template<
+ typename Protocol >
+ void open(
+ const Protocol & protocol);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_request_acceptor::open (2 of 2 overloads)]
+
+Open the acceptor.
+
+ template<
+ typename Protocol >
+ boost::system::error_code open(
+ const Protocol & protocol,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:port_number_type common::basic_request_acceptor::port_number_type]
+
+[indexterm2 port_number_type..common::basic_request_acceptor]
+
+ typedef service_type::implementation_type::port_number_type port_number_type;
+
+
+
+
+[endsect]
+
+
+
+[section:protocol_service common::basic_request_acceptor::protocol_service]
+
+[indexterm2 protocol_service..common::basic_request_acceptor]
+
+ protocol_service_type & protocol_service() const;
+
+
+
+[endsect]
+
+
+
+[section:protocol_service_type common::basic_request_acceptor::protocol_service_type]
+
+[indexterm2 protocol_service_type..common::basic_request_acceptor]
+
+ typedef service_type::protocol_service_type protocol_service_type;
+
+
+
+
+[endsect]
+
+
+
+[section:protocol_type common::basic_request_acceptor::protocol_type]
+
+[indexterm2 protocol_type..common::basic_request_acceptor]
+
+ typedef service_type::protocol_type protocol_type;
+
+
+
+
+[endsect]
+
+
+
+[section:service_type common::basic_request_acceptor::service_type]
+
+[indexterm2 service_type..common::basic_request_acceptor]
+
+ typedef RequestAcceptorService service_type;
+
+
+
+
+[endsect]
+
+
+
+[section:_basic_request_acceptor common::basic_request_acceptor::~basic_request_acceptor]
+
+[indexterm2 ~basic_request_acceptor..common::basic_request_acceptor]
+
+ ~basic_request_acceptor();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__basic_response common::basic_response]
+
+The response class: a helper for responding to requests.
+
+ template<
+ typename ``[link cgi.reference.CharT CharT]``>
+ class basic_response
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_response.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_response.ostream_type [*ostream_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_response.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_response.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_response.async_send [*async_send]]]
+ [Asynchronously send the data through the supplied request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.basic_response [*basic_response]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.charset [*charset]]]
+ [Get the charset. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.clear [*clear]]]
+ [Clear the response buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.clear_headers [*clear_headers]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.content_length [*content_length]]]
+ [Get the length of the body of the response (ie. not including the headers). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.do_async_send [*do_async_send]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.end_headers [*end_headers]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.flush [*flush]]]
+ [Synchronously flush the data to the supplied SyncWriteStream. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.header_value [*header_value]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers [*headers]]]
+ [Get the headers. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers_terminated [*headers_terminated]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.operator_lt__lt_ [*operator<<]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.ostream [*ostream]]]
+ [Get the ostream containing the response body. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.rdbuf [*rdbuf]]]
+ [Get the buffer associated with the stream. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.resend [*resend]]]
+ [Resend headers + content regardless of value of `headers_terminated_`. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.reset [*reset]]]
+ [Return the response to the 'just constructed' state. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.reset_headers [*reset_headers]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.send [*send]]]
+ [Synchronously send the data via the supplied request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.set [*set]]]
+ [Add a header after appending the CRLF sequence. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.set_header [*set_header]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.status [*status]]]
+ [Set the status code associated with the response. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.str [*str]]]
+ [Get the contents of the response as a string. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.unterminate_headers [*unterminate_headers]]]
+ [Allow more headers to be added (WARNING: avoid using this). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.write [*write]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response._basic_response [*~basic_response]]]
+ []
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_response.buffer_ [*buffer_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.charset_ [*charset_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers_ [*headers_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers_terminated_ [*headers_terminated_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.http_status_ [*http_status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.ostream_ [*ostream_]]]
+ []
+ ]
+
+]
+
+
+[section:async_send common::basic_response::async_send]
+
+[indexterm2 async_send..common::basic_response] Asynchronously send the data through the supplied request.
+
+ template<
+ typename AsyncWriteStream ,
+ typename Handler >
+ void async_send(
+ AsyncWriteStream & aws,
+ Handler handler);
+
+
+Note: This is quite crude at the moment and not as asynchronous as it could/should be. The data in the stream isn't cleared after this call.
+
+
+[endsect]
+
+
+[section:basic_response common::basic_response::basic_response]
+
+[indexterm2 basic_response..common::basic_response]
+
+ ``[link cgi.reference.common__basic_response.basic_response.overload1 basic_response]``(
+ common::http::status_code sc = common::http::ok);
+
+ ``[link cgi.reference.common__basic_response.basic_response.overload2 basic_response]``(
+ ::BOOST_CGI_NAMESPACE::common::streambuf * buf,
+ common::http::status_code sc = common::http::ok);
+
+
+[section:overload1 common::basic_response::basic_response (1 of 2 overloads)]
+
+
+
+ basic_response(
+ common::http::status_code sc = common::http::ok);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::basic_response (2 of 2 overloads)]
+
+Construct with a particular buffer.
+
+ basic_response(
+ ::BOOST_CGI_NAMESPACE::common::streambuf * buf,
+ common::http::status_code sc = common::http::ok);
+
+
+Takes the buffer and uses it internally, does nothing with it on destruction.
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:buffer_ common::basic_response::buffer_]
+
+[indexterm2 buffer_..common::basic_response]
+
+ boost::shared_ptr< common::streambuf > buffer_;
+
+
+
+[endsect]
+
+
+
+[section:char_type common::basic_response::char_type]
+
+[indexterm2 char_type..common::basic_response]
+
+ typedef CharT char_type;
+
+
+
+
+[endsect]
+
+
+[section:charset common::basic_response::charset]
+
+[indexterm2 charset..common::basic_response] Get the charset.
+
+ string_type & ``[link cgi.reference.common__basic_response.charset.overload1 charset]``() const;
+
+ void ``[link cgi.reference.common__basic_response.charset.overload2 charset]``(
+ string_type const & cs);
+
+
+[section:overload1 common::basic_response::charset (1 of 2 overloads)]
+
+Get the charset.
+
+ string_type & charset() const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::charset (2 of 2 overloads)]
+
+Set the charset.
+
+ void charset(
+ string_type const & cs);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:charset_ common::basic_response::charset_]
+
+[indexterm2 charset_..common::basic_response]
+
+ string_type charset_;
+
+
+
+[endsect]
+
+
+
+[section:clear common::basic_response::clear]
+
+[indexterm2 clear..common::basic_response] Clear the response buffer.
+
+ void clear(
+ bool clear_headers = true);
+
+
+
+[endsect]
+
+
+
+[section:clear_headers common::basic_response::clear_headers]
+
+[indexterm2 clear_headers..common::basic_response]
+
+ void clear_headers();
+
+
+
+[endsect]
+
+
+
+[section:content_length common::basic_response::content_length]
+
+[indexterm2 content_length..common::basic_response] Get the length of the body of the response (ie. not including the headers).
+
+ std::size_t content_length();
+
+
+
+[endsect]
+
+
+
+[section:do_async_send common::basic_response::do_async_send]
+
+[indexterm2 do_async_send..common::basic_response]
+
+ template<
+ typename AsyncWriteStream ,
+ typename Handler >
+ void do_async_send(
+ AsyncWriteStream & aws,
+ Handler handler);
+
+
+
+[endsect]
+
+
+
+[section:end_headers common::basic_response::end_headers]
+
+[indexterm2 end_headers..common::basic_response]
+
+ void end_headers();
+
+
+
+[endsect]
+
+
+[section:flush common::basic_response::flush]
+
+[indexterm2 flush..common::basic_response] Synchronously flush the data to the supplied SyncWriteStream.
+
+ template<
+ typename SyncWriteStream >
+ void ``[link cgi.reference.common__basic_response.flush.overload1 flush]``(
+ SyncWriteStream & sws);
+
+ template<
+ typename SyncWriteStream >
+ boost::system::error_code ``[link cgi.reference.common__basic_response.flush.overload2 flush]``(
+ SyncWriteStream & sws,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_response::flush (1 of 2 overloads)]
+
+Synchronously flush the data to the supplied SyncWriteStream.
+
+ template<
+ typename SyncWriteStream >
+ void flush(
+ SyncWriteStream & sws);
+
+
+This call uses throwing semantics. ie. an exception will be thrown on any failure. If there is no error, the buffer is cleared.
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::flush (2 of 2 overloads)]
+
+Synchronously flush the data via the supplied request.
+
+ template<
+ typename SyncWriteStream >
+ boost::system::error_code flush(
+ SyncWriteStream & sws,
+ boost::system::error_code & ec);
+
+
+This call uses error\_code semantics. ie. ec is set if an error occurs. If there is no error, the buffer is cleared.
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:header_value common::basic_response::header_value]
+
+[indexterm2 header_value..common::basic_response]
+
+ string_type header_value(
+ string_type const & name);
+
+
+
+[endsect]
+
+
+
+[section:headers common::basic_response::headers]
+
+[indexterm2 headers..common::basic_response] Get the headers.
+
+ std::vector< string_type > & headers();
+
+
+
+[endsect]
+
+
+
+[section:headers_ common::basic_response::headers_]
+
+[indexterm2 headers_..common::basic_response]
+
+ std::vector< string_type > headers_;
+
+
+
+[endsect]
+
+
+
+[section:headers_terminated common::basic_response::headers_terminated]
+
+[indexterm2 headers_terminated..common::basic_response]
+
+ bool headers_terminated() const;
+
+
+
+[endsect]
+
+
+
+[section:headers_terminated_ common::basic_response::headers_terminated_]
+
+[indexterm2 headers_terminated_..common::basic_response]
+
+ bool headers_terminated_;
+
+
+
+[endsect]
+
+
+
+[section:http_status_ common::basic_response::http_status_]
+
+[indexterm2 http_status_..common::basic_response]
+
+ http::status_code http_status_;
+
+
+
+[endsect]
+
+
+[section:operator_lt__lt_ common::basic_response::operator<<]
+
+[indexterm2 operator<<..common::basic_response]
+
+ template<
+ typename T >
+ self_type & ``[link cgi.reference.common__basic_response.operator_lt__lt_.overload1 operator<<]``(
+ T t);
+
+ self_type & ``[link cgi.reference.common__basic_response.operator_lt__lt_.overload2 operator<<]``(
+ charset_header< char_type > const & hdr);
+
+ self_type & ``[link cgi.reference.common__basic_response.operator_lt__lt_.overload3 operator<<]``(
+ basic_header< char_type > const & hdr);
+
+ self_type & ``[link cgi.reference.common__basic_response.operator_lt__lt_.overload4 operator<<]``(
+ basic_cookie< char_type > const & ck);
+
+ self_type & ``[link cgi.reference.common__basic_response.operator_lt__lt_.overload5 operator<<]``(
+ http::status_code stat);
+
+ self_type & ``[link cgi.reference.common__basic_response.operator_lt__lt_.overload6 operator<<]``(
+ self_type & other);
+
+
+[section:overload1 common::basic_response::operator<< (1 of 6 overloads)]
+
+
+
+ template<
+ typename T >
+ self_type & operator<<(
+ T t);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::operator<< (2 of 6 overloads)]
+
+
+
+ self_type & operator<<(
+ charset_header< char_type > const & hdr);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_response::operator<< (3 of 6 overloads)]
+
+
+
+ self_type & operator<<(
+ basic_header< char_type > const & hdr);
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::basic_response::operator<< (4 of 6 overloads)]
+
+
+
+ self_type & operator<<(
+ basic_cookie< char_type > const & ck);
+
+
+
+[endsect]
+
+
+
+[section:overload5 common::basic_response::operator<< (5 of 6 overloads)]
+
+
+
+ self_type & operator<<(
+ http::status_code stat);
+
+
+
+[endsect]
+
+
+
+[section:overload6 common::basic_response::operator<< (6 of 6 overloads)]
+
+
+
+ self_type & operator<<(
+ self_type & other);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:ostream common::basic_response::ostream]
+
+[indexterm2 ostream..common::basic_response] Get the ostream containing the response body.
+
+ ostream_type & ostream();
+
+
+
+[endsect]
+
+
+
+[section:ostream_ common::basic_response::ostream_]
+
+[indexterm2 ostream_..common::basic_response]
+
+ ostream_type ostream_;
+
+
+
+[endsect]
+
+
+
+[section:ostream_type common::basic_response::ostream_type]
+
+[indexterm2 ostream_type..common::basic_response]
+
+ typedef std::basic_ostream< CharT > ostream_type;
+
+
+
+
+[endsect]
+
+
+
+[section:rdbuf common::basic_response::rdbuf]
+
+[indexterm2 rdbuf..common::basic_response] Get the buffer associated with the stream.
+
+ common::streambuf * rdbuf();
+
+
+
+[endsect]
+
+
+
+[section:resend common::basic_response::resend]
+
+[indexterm2 resend..common::basic_response] Resend headers + content regardless of value of `headers_terminated_`.
+
+ template<
+ typename SyncWriteStream >
+ void resend(
+ SyncWriteStream & sws);
+
+
+
+[endsect]
+
+
+
+[section:reset common::basic_response::reset]
+
+[indexterm2 reset..common::basic_response] Return the response to the 'just constructed' state.
+
+ void reset();
+
+
+
+[endsect]
+
+
+
+[section:reset_headers common::basic_response::reset_headers]
+
+[indexterm2 reset_headers..common::basic_response]
+
+ void reset_headers();
+
+
+
+[endsect]
+
+
+
+[section:self_type common::basic_response::self_type]
+
+[indexterm2 self_type..common::basic_response]
+
+ typedef basic_response< CharT > self_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_response.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_response.ostream_type [*ostream_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_response.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_response.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_response.async_send [*async_send]]]
+ [Asynchronously send the data through the supplied request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.basic_response [*basic_response]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.charset [*charset]]]
+ [Get the charset. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.clear [*clear]]]
+ [Clear the response buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.clear_headers [*clear_headers]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.content_length [*content_length]]]
+ [Get the length of the body of the response (ie. not including the headers). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.do_async_send [*do_async_send]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.end_headers [*end_headers]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.flush [*flush]]]
+ [Synchronously flush the data to the supplied SyncWriteStream. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.header_value [*header_value]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers [*headers]]]
+ [Get the headers. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers_terminated [*headers_terminated]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.operator_lt__lt_ [*operator<<]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.ostream [*ostream]]]
+ [Get the ostream containing the response body. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.rdbuf [*rdbuf]]]
+ [Get the buffer associated with the stream. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.resend [*resend]]]
+ [Resend headers + content regardless of value of `headers_terminated_`. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.reset [*reset]]]
+ [Return the response to the 'just constructed' state. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.reset_headers [*reset_headers]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.send [*send]]]
+ [Synchronously send the data via the supplied request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.set [*set]]]
+ [Add a header after appending the CRLF sequence. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.set_header [*set_header]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.status [*status]]]
+ [Set the status code associated with the response. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.str [*str]]]
+ [Get the contents of the response as a string. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.unterminate_headers [*unterminate_headers]]]
+ [Allow more headers to be added (WARNING: avoid using this). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.write [*write]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response._basic_response [*~basic_response]]]
+ []
+ ]
+
+]
+
+[heading Protected Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_response.buffer_ [*buffer_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.charset_ [*charset_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers_ [*headers_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.headers_terminated_ [*headers_terminated_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.http_status_ [*http_status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_response.ostream_ [*ostream_]]]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:send common::basic_response::send]
+
+[indexterm2 send..common::basic_response] Synchronously send the data via the supplied request.
+
+ template<
+ typename SyncWriteStream >
+ void ``[link cgi.reference.common__basic_response.send.overload1 send]``(
+ SyncWriteStream & sws);
+
+ template<
+ typename SyncWriteStream >
+ boost::system::error_code ``[link cgi.reference.common__basic_response.send.overload2 send]``(
+ SyncWriteStream & sws,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::basic_response::send (1 of 2 overloads)]
+
+Synchronously send the data via the supplied request.
+
+ template<
+ typename SyncWriteStream >
+ void send(
+ SyncWriteStream & sws);
+
+
+This call uses throwing semantics. ie. an exception will be thrown on any failure. Note: The data in the stream isn't cleared after this call.
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::send (2 of 2 overloads)]
+
+Synchronously send the data via the supplied request.
+
+ template<
+ typename SyncWriteStream >
+ boost::system::error_code send(
+ SyncWriteStream & sws,
+ boost::system::error_code & ec);
+
+
+This call will not throw, but will set `ec` such that `ec == true` if an error occurs. Details of the error are held in the `error\_code` object.
+
+
+[endsect]
+
+
+[endsect]
+
+[section:set common::basic_response::set]
+
+[indexterm2 set..common::basic_response] Add a header after appending the CRLF sequence.
+
+ basic_response< char_type > & ``[link cgi.reference.common__basic_response.set.overload1 set]``(
+ basic_header< char_type > const & hdr);
+
+ basic_response< char_type > & ``[link cgi.reference.common__basic_response.set.overload2 set]``(
+ const basic_cookie< char_type > & ck);
+
+
+[section:overload1 common::basic_response::set (1 of 2 overloads)]
+
+Add a header after appending the CRLF sequence.
+
+ basic_response< char_type > & set(
+ basic_header< char_type > const & hdr);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::set (2 of 2 overloads)]
+
+
+
+ basic_response< char_type > & set(
+ const basic_cookie< char_type > & ck);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:set_header common::basic_response::set_header]
+
+[indexterm2 set_header..common::basic_response]
+
+ basic_response< char_type > & ``[link cgi.reference.common__basic_response.set_header.overload1 set_header]``(
+ const string_type & value);
+
+ basic_response< char_type > & ``[link cgi.reference.common__basic_response.set_header.overload2 set_header]``(
+ string_type const & name,
+ string_type const & value);
+
+
+[section:overload1 common::basic_response::set_header (1 of 2 overloads)]
+
+
+
+ basic_response< char_type > & set_header(
+ const string_type & value);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::set_header (2 of 2 overloads)]
+
+Format and add a header given name and value, appending CRLF.
+
+ basic_response< char_type > & set_header(
+ string_type const & name,
+ string_type const & value);
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:status common::basic_response::status]
+
+[indexterm2 status..common::basic_response] Set the status code associated with the response.
+
+ basic_response< char_type > & ``[link cgi.reference.common__basic_response.status.overload1 status]``(
+ const http::status_code & num);
+
+ http::status_code ``[link cgi.reference.common__basic_response.status.overload2 status]``() const;
+
+
+[section:overload1 common::basic_response::status (1 of 2 overloads)]
+
+Set the status code associated with the response.
+
+ basic_response< char_type > & status(
+ const http::status_code & num);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::status (2 of 2 overloads)]
+
+Get the status code associated with the response.
+
+ http::status_code status() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:str common::basic_response::str]
+
+[indexterm2 str..common::basic_response] Get the contents of the response as a string.
+
+ string_type str(
+ bool include_header = false) const;
+
+
+This copies the contents of the response into a string. Headers aren't included in the dump unless `include\_header` is true.
+
+
+[endsect]
+
+
+
+[section:string_type common::basic_response::string_type]
+
+[indexterm2 string_type..common::basic_response]
+
+ typedef std::basic_string< CharT > string_type;
+
+
+
+
+[endsect]
+
+
+
+[section:unterminate_headers common::basic_response::unterminate_headers]
+
+[indexterm2 unterminate_headers..common::basic_response] Allow more headers to be added (WARNING: avoid using this).
+
+ void unterminate_headers();
+
+
+
+[endsect]
+
+
+[section:write common::basic_response::write]
+
+[indexterm2 write..common::basic_response]
+
+ std::size_t ``[link cgi.reference.common__basic_response.write.overload1 write]``(
+ const char_type * str,
+ std::size_t len);
+
+ std::size_t ``[link cgi.reference.common__basic_response.write.overload2 write]``(
+ string_type const & str);
+
+ template<
+ typename ConstBufferSequence >
+ std::size_t ``[link cgi.reference.common__basic_response.write.overload3 write]``(
+ const ConstBufferSequence & buf);
+
+
+[section:overload1 common::basic_response::write (1 of 3 overloads)]
+
+
+
+ std::size_t write(
+ const char_type * str,
+ std::size_t len);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::basic_response::write (2 of 3 overloads)]
+
+
+
+ std::size_t write(
+ string_type const & str);
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::basic_response::write (3 of 3 overloads)]
+
+
+
+ template<
+ typename ConstBufferSequence >
+ std::size_t write(
+ const ConstBufferSequence & buf);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:_basic_response common::basic_response::~basic_response]
+
+[indexterm2 ~basic_response..common::basic_response]
+
+ ~basic_response();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__charset_header common::charset_header]
+
+
+
+ template<
+ typename CharT >
+ struct charset_header
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__charset_header.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__charset_header.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__charset_header.charset_header [*charset_header]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__charset_header.content [*content]]]
+ []
+ ]
+
+]
+
+
+[section:char_type common::charset_header::char_type]
+
+[indexterm2 char_type..common::charset_header]
+
+ typedef CharT char_type;
+
+
+
+
+[endsect]
+
+
+
+[section:charset_header common::charset_header::charset_header]
+
+[indexterm2 charset_header..common::charset_header]
+
+ charset_header(
+ const string_type & _content);
+
+
+
+[endsect]
+
+
+
+[section:content common::charset_header::content]
+
+[indexterm2 content..common::charset_header]
+
+ string_type content;
+
+
+
+[endsect]
+
+
+
+[section:string_type common::charset_header::string_type]
+
+[indexterm2 string_type..common::charset_header]
+
+ typedef std::basic_string< CharT > string_type;
+
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+
+[section:common__client_status common::client_status]
+
+[indexterm1 common::client_status]
+
+ enum client_status
+
+[heading Values]
+[variablelist
+
+ [
+ [none_]
+ []
+ ]
+
+ [
+ [constructed]
+ []
+ ]
+
+ [
+ [params_read]
+ []
+ ]
+
+ [
+ [stdin_read]
+ []
+ ]
+
+ [
+ [end_request_sent]
+ []
+ ]
+
+ [
+ [closed_]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:common__data_map_proxy common::data_map_proxy]
+
+A proxy class to provide access to the data maps as member variables.
+
+ template<
+ typename ``[link cgi.reference.MapType MapType]``>
+ struct data_map_proxy
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.allocator_type [*allocator_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.const_iterator [*const_iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.const_reverse_iterator [*const_reverse_iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.iterator [*iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.key_type [*key_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.map_type [*map_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.mapped_type [*mapped_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.reverse_iterator [*reverse_iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.size_type [*size_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.value_type [*value_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.as [*as]]]
+ [Get a value for the key as a specified type, with fallback. ]
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.begin [*begin]]]
+ [Map iterators. ]
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.clear [*clear]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.count [*count]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.empty [*empty]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.end [*end]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.operator_map_type_& [*operator map_type &]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.operator_not_ [*operator!]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.operator_openbrace__closebrace_ [*operator[]]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.pick [*pick]]]
+ [Get a value for the key, with fallback. ]
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.rbegin [*rbegin]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.rend [*rend]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.self_type [*self_type]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.set [*set]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.size [*size]]]
+ []
+ ]
+
+]
+
+This wraps the underlying data map and exposes a std::map-like interface for the different data maps.
+
+It also includes an as<> member function which casts the found data into any type the user specifies.
+
+
+[section:allocator_type common::data_map_proxy::allocator_type]
+
+[indexterm2 allocator_type..common::data_map_proxy]
+
+ typedef map_type::allocator_type allocator_type;
+
+
+
+
+[endsect]
+
+
+
+[section:as common::data_map_proxy::as]
+
+[indexterm2 as..common::data_map_proxy] Get a value for the key as a specified type, with fallback.
+
+ template<
+ typename T >
+ T as(
+ key_type const & key,
+ T const & default_value = T()) const;
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[key][The name of CGI parameter to look for. ]]
+
+[[default_value][The default return value. If no data exists in the map for the specified key, or the data cannot be converted into the type of the default\_ value, then this value is returned.]]
+
+]
+
+If the key cannot be found, returns a default-constructed object of type T.
+
+If the key is found, attempts to convert the value into the type T. This throws a boost::bad\_lexical\_cast when it fails.
+
+
+[endsect]
+
+
+[section:begin common::data_map_proxy::begin]
+
+[indexterm2 begin..common::data_map_proxy] Map iterators.
+
+ iterator ``[link cgi.reference.common__data_map_proxy.begin.overload1 begin]``();
+
+ const_iterator ``[link cgi.reference.common__data_map_proxy.begin.overload2 begin]``() const;
+
+
+[section:overload1 common::data_map_proxy::begin (1 of 2 overloads)]
+
+Map iterators.
+
+ iterator begin();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::data_map_proxy::begin (2 of 2 overloads)]
+
+
+
+ const_iterator begin() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:clear common::data_map_proxy::clear]
+
+[indexterm2 clear..common::data_map_proxy]
+
+ void clear();
+
+
+
+[endsect]
+
+
+
+[section:const_iterator common::data_map_proxy::const_iterator]
+
+[indexterm2 const_iterator..common::data_map_proxy]
+
+ typedef map_type::const_iterator const_iterator;
+
+
+
+
+[endsect]
+
+
+
+[section:const_reverse_iterator common::data_map_proxy::const_reverse_iterator]
+
+[indexterm2 const_reverse_iterator..common::data_map_proxy]
+
+ typedef map_type::const_reverse_iterator const_reverse_iterator;
+
+
+
+
+[endsect]
+
+
+
+[section:count common::data_map_proxy::count]
+
+[indexterm2 count..common::data_map_proxy]
+
+ size_type count(
+ const key_type & key);
+
+
+
+[endsect]
+
+
+
+[section:empty common::data_map_proxy::empty]
+
+[indexterm2 empty..common::data_map_proxy]
+
+ bool empty();
+
+
+
+[endsect]
+
+
+[section:end common::data_map_proxy::end]
+
+[indexterm2 end..common::data_map_proxy]
+
+ iterator ``[link cgi.reference.common__data_map_proxy.end.overload1 end]``();
+
+ const_iterator ``[link cgi.reference.common__data_map_proxy.end.overload2 end]``() const;
+
+
+[section:overload1 common::data_map_proxy::end (1 of 2 overloads)]
+
+
+
+ iterator end();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::data_map_proxy::end (2 of 2 overloads)]
+
+
+
+ const_iterator end() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:iterator common::data_map_proxy::iterator]
+
+[indexterm2 iterator..common::data_map_proxy]
+
+ typedef map_type::iterator iterator;
+
+
+
+
+[endsect]
+
+
+
+[section:key_type common::data_map_proxy::key_type]
+
+[indexterm2 key_type..common::data_map_proxy]
+
+ typedef map_type::key_type key_type;
+
+
+
+
+[endsect]
+
+
+
+[section:map_type common::data_map_proxy::map_type]
+
+[indexterm2 map_type..common::data_map_proxy]
+
+ typedef MapType map_type;
+
+
+
+
+[endsect]
+
+
+
+[section:mapped_type common::data_map_proxy::mapped_type]
+
+[indexterm2 mapped_type..common::data_map_proxy]
+
+ typedef map_type::mapped_type mapped_type;
+
+
+
+
+[endsect]
+
+
+
+[section:operator_map_type_& common::data_map_proxy::operator map_type &]
+
+[indexterm2 operator map_type &..common::data_map_proxy]
+
+ operator map_type &();
+
+
+
+[endsect]
+
+
+
+[section:operator_not_ common::data_map_proxy::operator!]
+
+[indexterm2 operator!..common::data_map_proxy]
+
+ bool operator!() const;
+
+
+
+[endsect]
+
+
+[section:operator_openbrace__closebrace_ common::data_map_proxy::operator[]]
+
+[indexterm2 operator[]..common::data_map_proxy]
+
+ mapped_type & ``[link cgi.reference.common__data_map_proxy.operator_openbrace__closebrace_.overload1 operator[]]``(
+ const char * varname);
+
+ mapped_type & ``[link cgi.reference.common__data_map_proxy.operator_openbrace__closebrace_.overload2 operator[]]``(
+ const char * varname) const;
+
+ mapped_type & ``[link cgi.reference.common__data_map_proxy.operator_openbrace__closebrace_.overload3 operator[]]``(
+ key_type const & varname);
+
+ mapped_type const & ``[link cgi.reference.common__data_map_proxy.operator_openbrace__closebrace_.overload4 operator[]]``(
+ key_type const & varname) const;
+
+
+[section:overload1 common::data_map_proxy::operator[] (1 of 4 overloads)]
+
+
+
+ mapped_type & operator[](
+ const char * varname);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::data_map_proxy::operator[] (2 of 4 overloads)]
+
+
+
+ mapped_type & operator[](
+ const char * varname) const;
+
+
+
+[endsect]
+
+
+
+[section:overload3 common::data_map_proxy::operator[] (3 of 4 overloads)]
+
+
+
+ mapped_type & operator[](
+ key_type const & varname);
+
+
+
+[endsect]
+
+
+
+[section:overload4 common::data_map_proxy::operator[] (4 of 4 overloads)]
+
+
+
+ mapped_type const & operator[](
+ key_type const & varname) const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:pick common::data_map_proxy::pick]
+
+[indexterm2 pick..common::data_map_proxy] Get a value for the key, with fallback.
+
+ mapped_type const & pick(
+ key_type const & key,
+ mapped_type const & default_value) const;
+
+
+
+[endsect]
+
+
+[section:rbegin common::data_map_proxy::rbegin]
+
+[indexterm2 rbegin..common::data_map_proxy]
+
+ reverse_iterator ``[link cgi.reference.common__data_map_proxy.rbegin.overload1 rbegin]``();
+
+ const_reverse_iterator ``[link cgi.reference.common__data_map_proxy.rbegin.overload2 rbegin]``() const;
+
+
+[section:overload1 common::data_map_proxy::rbegin (1 of 2 overloads)]
+
+
+
+ reverse_iterator rbegin();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::data_map_proxy::rbegin (2 of 2 overloads)]
+
+
+
+ const_reverse_iterator rbegin() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+[section:rend common::data_map_proxy::rend]
+
+[indexterm2 rend..common::data_map_proxy]
+
+ reverse_iterator ``[link cgi.reference.common__data_map_proxy.rend.overload1 rend]``();
+
+ const_reverse_iterator ``[link cgi.reference.common__data_map_proxy.rend.overload2 rend]``() const;
+
+
+[section:overload1 common::data_map_proxy::rend (1 of 2 overloads)]
+
+
+
+ reverse_iterator rend();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::data_map_proxy::rend (2 of 2 overloads)]
+
+
+
+ const_reverse_iterator rend() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:reverse_iterator common::data_map_proxy::reverse_iterator]
+
+[indexterm2 reverse_iterator..common::data_map_proxy]
+
+ typedef map_type::reverse_iterator reverse_iterator;
+
+
+
+
+[endsect]
+
+
+
+[section:self_type common::data_map_proxy::self_type]
+
+[indexterm2 self_type..common::data_map_proxy]
+
+ typedef data_map_proxy< map_type > self_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.allocator_type [*allocator_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.const_iterator [*const_iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.const_reverse_iterator [*const_reverse_iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.iterator [*iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.key_type [*key_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.map_type [*map_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.mapped_type [*mapped_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.reverse_iterator [*reverse_iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.size_type [*size_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__data_map_proxy.value_type [*value_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.as [*as]]]
+ [Get a value for the key as a specified type, with fallback. ]
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.begin [*begin]]]
+ [Map iterators. ]
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.clear [*clear]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.count [*count]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.empty [*empty]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.end [*end]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.operator_map_type_& [*operator map_type &]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.operator_not_ [*operator!]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.operator_openbrace__closebrace_ [*operator[]]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.pick [*pick]]]
+ [Get a value for the key, with fallback. ]
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.rbegin [*rbegin]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.rend [*rend]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.self_type [*self_type]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.set [*set]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__data_map_proxy.size [*size]]]
+ []
+ ]
+
+]
+
+This wraps the underlying data map and exposes a std::map-like interface for the different data maps.
+
+It also includes an as<> member function which casts the found data into any type the user specifies.
+
+
+
+[endsect]
+
+
+
+[section:self_type common::data_map_proxy::self_type]
+
+[indexterm2 self_type..common::data_map_proxy]
+
+ self_type();
+
+
+
+[endsect]
+
+
+
+[section:set common::data_map_proxy::set]
+
+[indexterm2 set..common::data_map_proxy]
+
+ void set(
+ map_type & data);
+
+
+
+[endsect]
+
+
+
+[section:size common::data_map_proxy::size]
+
+[indexterm2 size..common::data_map_proxy]
+
+ size_type size() const;
+
+
+
+[endsect]
+
+
+
+[section:size_type common::data_map_proxy::size_type]
+
+[indexterm2 size_type..common::data_map_proxy]
+
+ typedef map_type::size_type size_type;
+
+
+
+
+[endsect]
+
+
+
+[section:value_type common::data_map_proxy::value_type]
+
+[indexterm2 value_type..common::data_map_proxy]
+
+ typedef map_type::value_type value_type;
+
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+
+[section:common__error__cgi_errors common::error::cgi_errors]
+
+[indexterm1 common::error::cgi_errors]
+
+ enum cgi_errors
+
+[heading Values]
+[variablelist
+
+ [
+ [client_closed]
+ []
+ ]
+
+ [
+ [duplicate_request]
+ []
+ ]
+
+ [
+ [accepting_on_an_open_request]
+ []
+ ]
+
+ [
+ [invalid_socket]
+ []
+ ]
+
+ [
+ [invalid_form_type]
+ []
+ ]
+
+ [
+ [broken_pipe]
+ []
+ ]
+
+ [
+ [bad_read]
+ []
+ ]
+
+ [
+ [bad_write]
+ []
+ ]
+
+ [
+ [client_not_open]
+ []
+ ]
+
+ [
+ [eof]
+ []
+ ]
+
+ [
+ [multipart_form_boundary_not_found]
+ []
+ ]
+
+ [
+ [multipart_meta_data_not_terminated]
+ []
+ ]
+
+ [
+ [no_boundary_marker]
+ []
+ ]
+
+ [
+ [already_closed]
+ []
+ ]
+
+ [
+ [max_post_exceeded]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:common__form_parser common::form_parser]
+
+A class for parsing POST data sent to a CGI process.
+
+ class form_parser
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__form_parser.buffer_type [*buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_parser.callback_type [*callback_type]]]
+ [The callback functor to read more data. ]
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_parser__context [*context]]]
+ [The context used for parsing. ]
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_parser.map_type [*map_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_parser.mutable_buffers_type [*mutable_buffers_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_parser.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__form_parser.buffer_string [*buffer_string]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser.form_parser [*form_parser]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser.move_to_start_of_first_part [*move_to_start_of_first_part]]]
+ [Erase any front-cruft on the form data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser.parse [*parse]]]
+ [Run the parser on the given `context`. ]
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser.parse_boundary_marker [*parse_boundary_marker]]]
+ [Get the boundary marker from the CONTENT_TYPE header. ]
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser.parse_form_part [*parse_form_part]]]
+ [Parse a single form part. ]
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser.parse_multipart_form [*parse_multipart_form]]]
+ [Parse a multipart form. ]
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser.parse_url_encoded_form [*parse_url_encoded_form]]]
+ [URL-encoded forms. ]
+ ]
+
+]
+
+Construct this and then call `form\_parserparse` with an instance of form_parser::context (or compatible struct).
+
+This is minimal and doesn't extract all meta-data yet, but is known to work on Windows XP with MSVC9.0 and Ubuntu linux with gcc 4.2.x and 4.3.x.
+
+Valid Form Encodings > `application/x-www-form-urlencoded` > `multipart/form-data`
+
+File uploads (ie. in `multipart/form-data` forms) are saved to disk. See the `BOOST\_CGI\_UPLOAD\_DIRECTORY` macro.
+
+Should also work for HTTP POST data.
+
+
+[section:buffer_string common::form_parser::buffer_string]
+
+[indexterm2 buffer_string..common::form_parser]
+
+ string_type buffer_string();
+
+
+
+[endsect]
+
+
+
+[section:buffer_type common::form_parser::buffer_type]
+
+[indexterm2 buffer_type..common::form_parser]
+
+ typedef common::form_part::buffer_type buffer_type;
+
+
+
+
+[endsect]
+
+
+
+[section:callback_type common::form_parser::callback_type]
+
+[indexterm2 callback_type..common::form_parser] The callback functor to read more data.
+
+ typedef boost::function< std::size_t(boost::system::error_code &) > callback_type;
+
+
+
+
+[endsect]
+
+
+
+[section:form_parser common::form_parser::form_parser]
+
+[indexterm2 form_parser..common::form_parser]
+
+ form_parser();
+
+
+
+[endsect]
+
+
+
+[section:map_type common::form_parser::map_type]
+
+[indexterm2 map_type..common::form_parser]
+
+ typedef common::map map_type;
+
+
+
+
+[endsect]
+
+
+
+[section:move_to_start_of_first_part common::form_parser::move_to_start_of_first_part]
+
+[indexterm2 move_to_start_of_first_part..common::form_parser] Erase any front-cruft on the form data.
+
+ boost::system::error_code move_to_start_of_first_part(
+ boost::system::error_code & ec);
+
+
+In multipart forms, any characters that precede the first form boundary are ignored. This function erases those characters.
+
+
+[endsect]
+
+
+
+[section:mutable_buffers_type common::form_parser::mutable_buffers_type]
+
+[indexterm2 mutable_buffers_type..common::form_parser]
+
+ typedef boost::asio::mutable_buffers_1 mutable_buffers_type;
+
+
+
+
+[endsect]
+
+
+
+[section:parse common::form_parser::parse]
+
+[indexterm2 parse..common::form_parser] Run the parser on the given `context`.
+
+ boost::system::error_code parse(
+ context ctx,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:parse_boundary_marker common::form_parser::parse_boundary_marker]
+
+[indexterm2 parse_boundary_marker..common::form_parser] Get the boundary marker from the CONTENT_TYPE header.
+
+ boost::system::error_code parse_boundary_marker(
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:parse_form_part common::form_parser::parse_form_part]
+
+[indexterm2 parse_form_part..common::form_parser] Parse a single form part.
+
+ boost::system::error_code parse_form_part(
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:parse_multipart_form common::form_parser::parse_multipart_form]
+
+[indexterm2 parse_multipart_form..common::form_parser] Parse a multipart form.
+
+ boost::system::error_code parse_multipart_form(
+ boost::system::error_code & ec);
+
+
+Parse forms where the content-type is "multipart/form-data".
+
+
+[endsect]
+
+
+
+[section:parse_url_encoded_form common::form_parser::parse_url_encoded_form]
+
+[indexterm2 parse_url_encoded_form..common::form_parser] URL-encoded forms.
+
+ boost::system::error_code parse_url_encoded_form(
+ boost::system::error_code & ec);
+
+
+Parse forms where the content-type is "application/www-url-encoded".
+
+
+[endsect]
+
+
+
+[section:string_type common::form_parser::string_type]
+
+[indexterm2 string_type..common::form_parser]
+
+ typedef common::form_part::string_type string_type;
+
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__form_parser__context common::form_parser::context]
+
+The context used for parsing.
+
+ struct context
+
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__form_parser__context.boundary_marker [*boundary_marker]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.boundary_markers [*boundary_markers]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.buffer [*buffer]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.bytes_left [*bytes_left]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.callback [*callback]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.content_type [*content_type]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.data_map [*data_map]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.offset [*offset]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.pos [*pos]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.random_string [*random_string]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.stdin_parsed [*stdin_parsed]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_parser__context.uploads_map [*uploads_map]]]
+ []
+ ]
+
+]
+
+
+[section:boundary_marker common::form_parser::context::boundary_marker]
+
+[indexterm2 boundary_marker..common::form_parser::context]
+
+ string_type boundary_marker;
+
+
+
+[endsect]
+
+
+
+[section:boundary_markers common::form_parser::context::boundary_markers]
+
+[indexterm2 boundary_markers..common::form_parser::context]
+
+ std::list< string_type > boundary_markers;
+
+
+
+[endsect]
+
+
+
+[section:buffer common::form_parser::context::buffer]
+
+[indexterm2 buffer..common::form_parser::context]
+
+ buffer_type & buffer;
+
+
+
+[endsect]
+
+
+
+[section:bytes_left common::form_parser::context::bytes_left]
+
+[indexterm2 bytes_left..common::form_parser::context]
+
+ std::size_t & bytes_left;
+
+
+
+[endsect]
+
+
+
+[section:callback common::form_parser::context::callback]
+
+[indexterm2 callback..common::form_parser::context]
+
+ const callback_type callback;
+
+
+
+[endsect]
+
+
+
+[section:content_type common::form_parser::context::content_type]
+
+[indexterm2 content_type..common::form_parser::context]
+
+ string_type & content_type;
+
+
+
+[endsect]
+
+
+
+[section:data_map common::form_parser::context::data_map]
+
+[indexterm2 data_map..common::form_parser::context]
+
+ common::post_map & data_map;
+
+
+
+[endsect]
+
+
+
+[section:offset common::form_parser::context::offset]
+
+[indexterm2 offset..common::form_parser::context]
+
+ std::size_t offset;
+
+
+
+[endsect]
+
+
+
+[section:pos common::form_parser::context::pos]
+
+[indexterm2 pos..common::form_parser::context]
+
+ buffer_type::iterator pos;
+
+
+
+[endsect]
+
+
+
+[section:random_string common::form_parser::context::random_string]
+
+[indexterm2 random_string..common::form_parser::context]
+
+ string_type random_string;
+
+
+
+[endsect]
+
+
+
+[section:stdin_parsed common::form_parser::context::stdin_parsed]
+
+[indexterm2 stdin_parsed..common::form_parser::context]
+
+ bool & stdin_parsed;
+
+
+
+[endsect]
+
+
+
+[section:uploads_map common::form_parser::context::uploads_map]
+
+[indexterm2 uploads_map..common::form_parser::context]
+
+ common::upload_map & uploads_map;
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__form_part common::form_part]
+
+
+
+ struct form_part
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__form_part.buffer_type [*buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_part.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_part.iter_t [*iter_t]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_part.meta_data_map_type [*meta_data_map_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_part.pair_t [*pair_t]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_part.range_type [*range_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__form_part.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__form_part.c_str [*c_str]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.empty [*empty]]]
+ [TODO: Check that the uploaded file isn't empty too. ]
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.operator_const_char_type_* [*operator const char_type *]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.operator_std__basic_string_lt__T__gt_ [*operator std::basic_string< T >]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.operator_string_type [*operator string_type]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.operator_string_type_const_& [*operator string_type const &]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part._form_part [*~form_part]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__form_part.boundary_marker_ [*boundary_marker_]]]
+ [The boundary marker that's needed. ]
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.buffer_ [*buffer_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.content_disposition [*content_disposition]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.content_type [*content_type]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.filename [*filename]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.meta_data_ [*meta_data_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.name [*name]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.path [*path]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__form_part.value [*value]]]
+ []
+ ]
+
+]
+
+[heading Friends]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__form_part.operator_lt__lt_ [*operator<<]]]
+ []
+ ]
+
+]
+
+
+[section:boundary_marker_ common::form_part::boundary_marker_]
+
+[indexterm2 boundary_marker_..common::form_part] The boundary marker that's needed.
+
+ string_type boundary_marker_;
+
+
+
+[endsect]
+
+
+
+[section:buffer_ common::form_part::buffer_]
+
+[indexterm2 buffer_..common::form_part]
+
+ pair_t buffer_;
+
+
+
+[endsect]
+
+
+
+[section:buffer_type common::form_part::buffer_type]
+
+[indexterm2 buffer_type..common::form_part]
+
+ typedef string_type buffer_type;
+
+
+
+
+[endsect]
+
+
+
+[section:c_str common::form_part::c_str]
+
+[indexterm2 c_str..common::form_part]
+
+ const char_type * c_str() const;
+
+
+
+[endsect]
+
+
+
+[section:char_type common::form_part::char_type]
+
+[indexterm2 char_type..common::form_part]
+
+ typedef char char_type;
+
+
+
+
+[endsect]
+
+
+
+[section:content_disposition common::form_part::content_disposition]
+
+[indexterm2 content_disposition..common::form_part]
+
+ string_type content_disposition;
+
+
+
+[endsect]
+
+
+
+[section:content_type common::form_part::content_type]
+
+[indexterm2 content_type..common::form_part]
+
+ string_type content_type;
+
+
+
+[endsect]
+
+
+
+[section:empty common::form_part::empty]
+
+[indexterm2 empty..common::form_part] TODO: Check that the uploaded file isn't empty too.
+
+ bool empty() const;
+
+
+
+[endsect]
+
+
+
+[section:filename common::form_part::filename]
+
+[indexterm2 filename..common::form_part]
+
+ boost::filesystem::path filename;
+
+
+
+[endsect]
+
+
+
+[section:iter_t common::form_part::iter_t]
+
+[indexterm2 iter_t..common::form_part]
+
+ typedef buffer_type::iterator iter_t;
+
+
+
+
+[endsect]
+
+
+
+[section:meta_data_ common::form_part::meta_data_]
+
+[indexterm2 meta_data_..common::form_part]
+
+ meta_data_map_type meta_data_;
+
+
+
+[endsect]
+
+
+
+[section:meta_data_map_type common::form_part::meta_data_map_type]
+
+[indexterm2 meta_data_map_type..common::form_part]
+
+ typedef std::map< string_type, pair_t > meta_data_map_type;
+
+
+
+
+[endsect]
+
+
+
+[section:name common::form_part::name]
+
+[indexterm2 name..common::form_part]
+
+ string_type name;
+
+
+
+[endsect]
+
+
+
+[section:operator_const_char_type_* common::form_part::operator const char_type *]
+
+[indexterm2 operator const char_type *..common::form_part]
+
+ operator const char_type *() const;
+
+
+
+[endsect]
+
+
+
+[section:operator_std__basic_string_lt__T__gt_ common::form_part::operator std::basic_string< T >]
+
+[indexterm2 operator std::basic_string< T >..common::form_part]
+
+ template<
+ typename T >
+ operator std::basic_string< T >();
+
+
+
+[endsect]
+
+
+
+[section:operator_string_type common::form_part::operator string_type]
+
+[indexterm2 operator string_type..common::form_part]
+
+ operator string_type() const;
+
+
+
+[endsect]
+
+
+
+[section:operator_string_type_const_& common::form_part::operator string_type const &]
+
+[indexterm2 operator string_type const &..common::form_part]
+
+ operator string_type const &() const;
+
+
+
+[endsect]
+
+
+
+[section:operator_lt__lt_ common::form_part::operator<<]
+
+[indexterm2 operator<<..common::form_part]
+
+ friend std::ostream & operator<<(
+ std::ostream & os,
+ form_part const & part);
+
+
+
+[endsect]
+
+
+
+[section:pair_t common::form_part::pair_t]
+
+[indexterm2 pair_t..common::form_part]
+
+ typedef std::pair< iter_t, iter_t > pair_t;
+
+
+
+
+[endsect]
+
+
+
+[section:path common::form_part::path]
+
+[indexterm2 path..common::form_part]
+
+ boost::filesystem::path path;
+
+
+
+[endsect]
+
+
+
+[section:range_type common::form_part::range_type]
+
+[indexterm2 range_type..common::form_part]
+
+ typedef boost::iterator_range< buffer_type::const_iterator > range_type;
+
+
+
+
+[endsect]
+
+
+
+[section:string_type common::form_part::string_type]
+
+[indexterm2 string_type..common::form_part]
+
+ typedef std::basic_string< char_type > string_type;
+
+
+
+
+[endsect]
+
+
+
+[section:value common::form_part::value]
+
+[indexterm2 value..common::form_part]
+
+ string_type value;
+
+
+
+[endsect]
+
+
+
+[section:_form_part common::form_part::~form_part]
+
+[indexterm2 ~form_part..common::form_part]
+
+ ~form_part();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__has_hidden_io_service common::has_hidden_io_service]
+
+
+
+ template<
+ typename Protocol >
+ struct has_hidden_io_service
+
+
+
+[endsect]
+
+[section:common__has_hidden_io_service_lt__tags__cgi__gt_ common::has_hidden_io_service< tags::cgi >]
+
+
+
+ template<>
+ struct has_hidden_io_service< tags::cgi >
+
+
+
+[endsect]
+
+[section:common__ichar_traits common::ichar_traits]
+
+
+
+ template<
+ typename CharT >
+ struct ichar_traits
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__ichar_traits.compare [*compare]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__ichar_traits.eq [*eq]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__ichar_traits.find [*find]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__ichar_traits.lt [*lt]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__ichar_traits.ne [*ne]]]
+ []
+ ]
+
+]
+
+
+[section:compare common::ichar_traits::compare]
+
+[indexterm2 compare..common::ichar_traits]
+
+ static int compare(
+ const char * str1,
+ const char * str2,
+ std::size_t num);
+
+
+
+[endsect]
+
+
+
+[section:eq common::ichar_traits::eq]
+
+[indexterm2 eq..common::ichar_traits]
+
+ static bool eq(
+ char c1,
+ char c2);
+
+
+
+[endsect]
+
+
+
+[section:find common::ichar_traits::find]
+
+[indexterm2 find..common::ichar_traits]
+
+ static const char * find(
+ const char * str,
+ int n,
+ char a);
+
+
+
+[endsect]
+
+
+
+[section:lt common::ichar_traits::lt]
+
+[indexterm2 lt..common::ichar_traits]
+
+ static bool lt(
+ char c1,
+ char c2);
+
+
+
+[endsect]
+
+
+
+[section:ne common::ichar_traits::ne]
+
+[indexterm2 ne..common::ichar_traits]
+
+ static bool ne(
+ char c1,
+ char c2);
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__io_service_provider common::io_service_provider]
+
+Hold a set number of io_services and return them based on the Policy.
+
+ template<
+ typename PoolingPolicy >
+ class io_service_provider
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__io_service_provider.get_io_service [*get_io_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__io_service_provider.io_service_provider [*io_service_provider]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__io_service_provider.reset [*reset]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__io_service_provider.run [*run]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__io_service_provider.stop [*stop]]]
+ []
+ ]
+
+]
+
+Contains six member functions: io\_service() - returns a reference to an io\_service stop() - stops all io\_services run() - runs all io\_services reset() - resets all io\_services
+
+(strike) stop\_one() - stops one (running) io\_service (strike) run\_one() - runs one (not-yet-started/reset) io\_service
+
+It can also be set up so that only required io\_services are run: each call to io\_service() can get an io\_service, call io\_service::run() on it and then return it.
+
+
+[section:get_io_service common::io_service_provider::get_io_service]
+
+[indexterm2 get_io_service..common::io_service_provider]
+
+ ::BOOST_CGI_NAMESPACE::common::io_service & get_io_service();
+
+
+
+[endsect]
+
+
+[section:io_service_provider common::io_service_provider::io_service_provider]
+
+[indexterm2 io_service_provider..common::io_service_provider]
+
+ ``[link cgi.reference.common__io_service_provider.io_service_provider.overload1 io_service_provider]``(
+ int );
+
+ ``[link cgi.reference.common__io_service_provider.io_service_provider.overload2 io_service_provider]``();
+
+
+[section:overload1 common::io_service_provider::io_service_provider (1 of 2 overloads)]
+
+
+
+ io_service_provider(
+ int );
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::io_service_provider::io_service_provider (2 of 2 overloads)]
+
+
+
+ io_service_provider();
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:reset common::io_service_provider::reset]
+
+[indexterm2 reset..common::io_service_provider]
+
+ void reset();
+
+
+
+[endsect]
+
+
+
+[section:run common::io_service_provider::run]
+
+[indexterm2 run..common::io_service_provider]
+
+ void run();
+
+
+
+[endsect]
+
+
+
+[section:stop common::io_service_provider::stop]
+
+[indexterm2 stop..common::io_service_provider]
+
+ void stop();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__is_async common::is_async]
+
+
+
+ template<
+ typename Protocol >
+ struct is_async
+
+
+
+[endsect]
+
+[section:common__is_async_lt__tags__cgi__gt_ common::is_async< tags::cgi >]
+
+
+
+ template<>
+ struct is_async< tags::cgi >
+
+
+
+[endsect]
+
+[section:common__map_read_error common::map_read_error]
+
+
+
+ template<
+ typename T >
+ struct map_read_error
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__map_read_error.map_read_error [*map_read_error]]]
+ []
+ ]
+
+]
+
+
+[section:map_read_error common::map_read_error::map_read_error]
+
+[indexterm2 map_read_error..common::map_read_error]
+
+ map_read_error();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+
+[section:common__parse_options common::parse_options]
+
+[indexterm1 common::parse_options]
+
+ enum parse_options
+
+[heading Values]
+[variablelist
+
+ [
+ [parse_none]
+ []
+ ]
+
+ [
+ [parse_env]
+ []
+ ]
+
+ [
+ [parse_get_only]
+ []
+ ]
+
+ [
+ [parse_get]
+ []
+ ]
+
+ [
+ [parse_post_only]
+ []
+ ]
+
+ [
+ [parse_post]
+ []
+ ]
+
+ [
+ [parse_form]
+ []
+ ]
+
+ [
+ [parse_form_only]
+ []
+ ]
+
+ [
+ [parse_cookie_only]
+ []
+ ]
+
+ [
+ [parse_cookie]
+ []
+ ]
+
+ [
+ [parse_cookies_only]
+ []
+ ]
+
+ [
+ [parse_cookies]
+ []
+ ]
+
+ [
+ [parse_all]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:common__path_info common::path_info]
+
+
+
+ struct path_info
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__path_info.const_iterator [*const_iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__path_info.iterator [*iterator]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__path_info.size_type [*size_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__path_info.string_type [*string_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__path_info.value_type [*value_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__path_info.vector_type [*vector_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__path_info.begin [*begin]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.end [*end]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.extension [*extension]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.operator_value_type_& [*operator value_type &]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.operator_openbrace__closebrace_ [*operator[]]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.path_info [*path_info]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.stem [*stem]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.string [*string]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__path_info.parts [*parts]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__path_info.value [*value]]]
+ []
+ ]
+
+]
+
+[section:begin common::path_info::begin]
+
+[indexterm2 begin..common::path_info]
+
+ iterator ``[link cgi.reference.common__path_info.begin.overload1 begin]``();
+
+ const_iterator ``[link cgi.reference.common__path_info.begin.overload2 begin]``() const;
+
+
+[section:overload1 common::path_info::begin (1 of 2 overloads)]
+
+
+
+ iterator begin();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::path_info::begin (2 of 2 overloads)]
+
+
+
+ const_iterator begin() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:const_iterator common::path_info::const_iterator]
+
+[indexterm2 const_iterator..common::path_info]
+
+ typedef vector_type::const_iterator const_iterator;
+
+
+
+
+[endsect]
+
+
+[section:end common::path_info::end]
+
+[indexterm2 end..common::path_info]
+
+ iterator ``[link cgi.reference.common__path_info.end.overload1 end]``();
+
+ const_iterator ``[link cgi.reference.common__path_info.end.overload2 end]``() const;
+
+
+[section:overload1 common::path_info::end (1 of 2 overloads)]
+
+
+
+ iterator end();
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::path_info::end (2 of 2 overloads)]
+
+
+
+ const_iterator end() const;
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:extension common::path_info::extension]
+
+[indexterm2 extension..common::path_info]
+
+ string_type extension() const;
+
+
+
+[endsect]
+
+
+
+[section:iterator common::path_info::iterator]
+
+[indexterm2 iterator..common::path_info]
+
+ typedef vector_type::iterator iterator;
+
+
+
+
+[endsect]
+
+
+
+[section:operator_value_type_& common::path_info::operator value_type &]
+
+[indexterm2 operator value_type &..common::path_info]
+
+ operator value_type &();
+
+
+
+[endsect]
+
+
+
+[section:operator_openbrace__closebrace_ common::path_info::operator[]]
+
+[indexterm2 operator[]..common::path_info]
+
+ value_type & operator[](
+ int i);
+
+
+
+[endsect]
+
+
+
+[section:parts common::path_info::parts]
+
+[indexterm2 parts..common::path_info]
+
+ vector_type parts;
+
+
+
+[endsect]
+
+
+[section:path_info common::path_info::path_info]
+
+[indexterm2 path_info..common::path_info]
+
+ template<
+ typename P >
+ ``[link cgi.reference.common__path_info.path_info.overload1 path_info]``(
+ basic_request< P > & request);
+
+ ``[link cgi.reference.common__path_info.path_info.overload2 path_info]``(
+ value_type const & str);
+
+
+[section:overload1 common::path_info::path_info (1 of 2 overloads)]
+
+
+
+ template<
+ typename P >
+ path_info(
+ basic_request< P > & request);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::path_info::path_info (2 of 2 overloads)]
+
+
+
+ path_info(
+ value_type const & str);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:size_type common::path_info::size_type]
+
+[indexterm2 size_type..common::path_info]
+
+ typedef string_type::size_type size_type;
+
+
+
+
+[endsect]
+
+
+
+[section:stem common::path_info::stem]
+
+[indexterm2 stem..common::path_info]
+
+ string_type stem() const;
+
+
+
+[endsect]
+
+
+
+[section:string common::path_info::string]
+
+[indexterm2 string..common::path_info]
+
+ value_type & string();
+
+
+
+[endsect]
+
+
+
+[section:string_type common::path_info::string_type]
+
+[indexterm2 string_type..common::path_info]
+
+ typedef value_type string_type;
+
+
+
+
+[endsect]
+
+
+
+[section:value common::path_info::value]
+
+[indexterm2 value..common::path_info]
+
+ value_type value;
+
+
+
+[endsect]
+
+
+
+[section:value_type common::path_info::value_type]
+
+[indexterm2 value_type..common::path_info]
+
+ typedef std::string value_type;
+
+
+
+
+[endsect]
+
+
+
+[section:vector_type common::path_info::vector_type]
+
+[indexterm2 vector_type..common::path_info]
+
+ typedef std::vector< value_type > vector_type;
+
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__request_base common::request_base]
+
+ABC that defines the common interface for basic_request<>s.
+
+ template<
+ typename Protocol >
+ class request_base
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__request_base.base_type [*base_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_base.client [*client]]]
+ [Return the connection associated with the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.destroy [*destroy]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.is_open [*is_open]]]
+ [Return if the request is still open. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.load [*load]]]
+ [Synchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.load_environment [*load_environment]]]
+ [Load the base_environment into the current environment. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.parse_cookie_vars [*parse_cookie_vars]]]
+ [Read and parse the HTTP_COOKIE meta variable. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.parse_get_vars [*parse_get_vars]]]
+ [Read and parse the cgi GET meta variables. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.parse_post_vars [*parse_post_vars]]]
+ [Read and parse the cgi POST meta variables. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.read_some [*read_some]]]
+ [Read some data into the internal buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.request_id [*request_id]]]
+ [Get the request ID of a FastCGI request, or 1. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.set_service [*set_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.status [*status]]]
+ [Get the request status. ]
+ ]
+
+]
+
+This class provides generic member functions that can be used by any request type.
+
+
+[section:base_type common::request_base::base_type]
+
+[indexterm2 base_type..common::request_base]
+
+ typedef common::request_base< Protocol > base_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__request_base.base_type [*base_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_base.client [*client]]]
+ [Return the connection associated with the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.destroy [*destroy]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.is_open [*is_open]]]
+ [Return if the request is still open. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.load [*load]]]
+ [Synchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.load_environment [*load_environment]]]
+ [Load the base_environment into the current environment. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.parse_cookie_vars [*parse_cookie_vars]]]
+ [Read and parse the HTTP_COOKIE meta variable. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.parse_get_vars [*parse_get_vars]]]
+ [Read and parse the cgi GET meta variables. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.parse_post_vars [*parse_post_vars]]]
+ [Read and parse the cgi POST meta variables. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.read_some [*read_some]]]
+ [Read some data into the internal buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.request_id [*request_id]]]
+ [Get the request ID of a FastCGI request, or 1. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.set_service [*set_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base.status [*status]]]
+ [Get the request status. ]
+ ]
+
+]
+
+This class provides generic member functions that can be used by any request type.
+
+
+
+[endsect]
+
+
+
+[section:client common::request_base::client]
+
+[indexterm2 client..common::request_base] Return the connection associated with the request.
+
+ template<
+ typename ImplType >
+ ImplType::client_type & client(
+ ImplType & impl);
+
+
+
+[endsect]
+
+
+
+[section:destroy common::request_base::destroy]
+
+[indexterm2 destroy..common::request_base]
+
+ template<
+ typename ImplType >
+ void destroy(
+ ImplType & impl);
+
+
+
+[endsect]
+
+
+
+[section:is_open common::request_base::is_open]
+
+[indexterm2 is_open..common::request_base] Return if the request is still open.
+
+ template<
+ typename ImplType >
+ bool is_open(
+ ImplType & impl);
+
+
+
+[endsect]
+
+
+
+[section:load common::request_base::load]
+
+[indexterm2 load..common::request_base] Synchronously read/parse the request meta-data.
+
+ template<
+ typename ImplType >
+ boost::system::error_code load(
+ ImplType & impl,
+ common::parse_options parse_opts,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:load_environment common::request_base::load_environment]
+
+[indexterm2 load_environment..common::request_base] Load the base_environment into the current environment.
+
+ template<
+ typename ImplType >
+ void load_environment(
+ ImplType & impl,
+ char ** base_environment,
+ bool is_command_line);
+
+
+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.
+
+
+[endsect]
+
+
+
+[section:parse_cookie_vars common::request_base::parse_cookie_vars]
+
+[indexterm2 parse_cookie_vars..common::request_base] Read and parse the HTTP_COOKIE meta variable.
+
+ template<
+ typename ImplType >
+ boost::system::error_code parse_cookie_vars(
+ ImplType & impl,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:parse_get_vars common::request_base::parse_get_vars]
+
+[indexterm2 parse_get_vars..common::request_base] Read and parse the cgi GET meta variables.
+
+ template<
+ typename ImplType >
+ boost::system::error_code parse_get_vars(
+ ImplType & impl,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:parse_post_vars common::request_base::parse_post_vars]
+
+[indexterm2 parse_post_vars..common::request_base] Read and parse the cgi POST meta variables.
+
+ template<
+ typename ImplType ,
+ typename Callback >
+ boost::system::error_code & parse_post_vars(
+ ImplType & impl,
+ Callback callback,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[section:read_some common::request_base::read_some]
+
+[indexterm2 read_some..common::request_base] Read some data into the internal buffer.
+
+ template<
+ typename ImplType >
+ std::size_t ``[link cgi.reference.common__request_base.read_some.overload1 read_some]``(
+ ImplType & impl,
+ boost::system::error_code & ec);
+
+ template<
+ typename ImplType ,
+ typename MutableBufferSequence >
+ std::size_t ``[link cgi.reference.common__request_base.read_some.overload2 read_some]``(
+ ImplType & impl,
+ const MutableBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+[section:overload1 common::request_base::read_some (1 of 2 overloads)]
+
+Read some data into the internal buffer.
+
+ template<
+ typename ImplType >
+ std::size_t read_some(
+ ImplType & impl,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::request_base::read_some (2 of 2 overloads)]
+
+Read some data from the client into the supplied buffer.
+
+ template<
+ typename ImplType ,
+ typename MutableBufferSequence >
+ std::size_t read_some(
+ ImplType & impl,
+ const MutableBufferSequence & buf,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:request_id common::request_base::request_id]
+
+[indexterm2 request_id..common::request_base] Get the request ID of a FastCGI request, or 1.
+
+ template<
+ typename ImplType >
+ boost::uint16_t const & request_id(
+ ImplType & impl) const;
+
+
+
+[endsect]
+
+
+
+[section:set_service common::request_base::set_service]
+
+[indexterm2 set_service..common::request_base]
+
+ template<
+ typename ImplType >
+ void set_service(
+ ImplType & impl,
+ typename ImplType::protocol_service_type & ps);
+
+
+
+[endsect]
+
+
+[section:status common::request_base::status]
+
+[indexterm2 status..common::request_base] Get the request status.
+
+ template<
+ typename ImplType >
+ common::request_status ``[link cgi.reference.common__request_base.status.overload1 status]``(
+ ImplType & impl) const;
+
+ template<
+ typename ImplType >
+ void ``[link cgi.reference.common__request_base.status.overload2 status]``(
+ ImplType & impl,
+ common::request_status status);
+
+
+[section:overload1 common::request_base::status (1 of 2 overloads)]
+
+Get the request status.
+
+ template<
+ typename ImplType >
+ common::request_status status(
+ ImplType & impl) const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::request_base::status (2 of 2 overloads)]
+
+Set the request status.
+
+ template<
+ typename ImplType >
+ void status(
+ ImplType & impl,
+ common::request_status status);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[endsect]
+
+[section:common__request_base__callback_functor common::request_base::callback_functor]
+
+
+
+ template<
+ typename ImplType ,
+ typename Service >
+ struct callback_functor
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_base__callback_functor.callback_functor [*callback_functor]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__callback_functor.operator() [*operator()]]]
+ []
+ ]
+
+]
+
+
+[section:callback_functor common::request_base::callback_functor::callback_functor]
+
+[indexterm2 callback_functor..common::request_base::callback_functor]
+
+ callback_functor(
+ ImplType & impl,
+ Service * service);
+
+
+
+[endsect]
+
+
+
+[section:operator() common::request_base::callback_functor::operator()]
+
+[indexterm2 operator()..common::request_base::callback_functor]
+
+ std::size_t operator()(
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__request_base__impl_base common::request_base::impl_base]
+
+
+
+ struct impl_base
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.base_type [*base_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.buffer_type [*buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.client_type [*client_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.conn_ptr [*conn_ptr]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.connection_type [*connection_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.const_buffers_type [*const_buffers_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.form_parser_type [*form_parser_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.mutable_buffers_type [*mutable_buffers_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.protocol_service_type [*protocol_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.request_type [*request_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.string_type [*string_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.traits [*traits]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.var_map_type [*var_map_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.http_status [*http_status]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.impl_base [*impl_base]]]
+ [Construct. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.prepare [*prepare]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.status [*status]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.stdin_parsed [*stdin_parsed]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.all_done_ [*all_done_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.bytes_left_ [*bytes_left_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.client_ [*client_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.form_parts_ [*form_parts_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.fp_ [*fp_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.http_status_ [*http_status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.post_buffer_ [*post_buffer_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.request_status_ [*request_status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.service_ [*service_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.stdin_parsed_ [*stdin_parsed_]]]
+ [Whether the post data has been parsed yet. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.vars_ [*vars_]]]
+ []
+ ]
+
+]
+
+
+[section:all_done_ common::request_base::impl_base::all_done_]
+
+[indexterm2 all_done_..common::request_base::impl_base]
+
+ bool all_done_;
+
+
+
+[endsect]
+
+
+
+[section:base_type common::request_base::impl_base::base_type]
+
+[indexterm2 base_type..common::request_base::impl_base]
+
+ typedef impl_base base_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.base_type [*base_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.buffer_type [*buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.client_type [*client_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.conn_ptr [*conn_ptr]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.connection_type [*connection_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.const_buffers_type [*const_buffers_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.form_parser_type [*form_parser_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.mutable_buffers_type [*mutable_buffers_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.protocol_service_type [*protocol_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.request_type [*request_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.string_type [*string_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.traits [*traits]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_base__impl_base.var_map_type [*var_map_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.http_status [*http_status]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.impl_base [*impl_base]]]
+ [Construct. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.prepare [*prepare]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.status [*status]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.stdin_parsed [*stdin_parsed]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.all_done_ [*all_done_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.bytes_left_ [*bytes_left_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.client_ [*client_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.form_parts_ [*form_parts_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.fp_ [*fp_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.http_status_ [*http_status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.post_buffer_ [*post_buffer_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.request_status_ [*request_status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.service_ [*service_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.stdin_parsed_ [*stdin_parsed_]]]
+ [Whether the post data has been parsed yet. ]
+ ]
+
+ [
+ [[link cgi.reference.common__request_base__impl_base.vars_ [*vars_]]]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:buffer_type common::request_base::impl_base::buffer_type]
+
+[indexterm2 buffer_type..common::request_base::impl_base]
+
+ typedef traits::buffer_type buffer_type;
+
+
+
+
+[endsect]
+
+
+
+[section:bytes_left_ common::request_base::impl_base::bytes_left_]
+
+[indexterm2 bytes_left_..common::request_base::impl_base]
+
+ std::size_t bytes_left_;
+
+
+
+[endsect]
+
+
+
+[section:char_type common::request_base::impl_base::char_type]
+
+[indexterm2 char_type..common::request_base::impl_base]
+
+ typedef traits::char_type char_type;
+
+
+
+
+[endsect]
+
+
+
+[section:client_ common::request_base::impl_base::client_]
+
+[indexterm2 client_..common::request_base::impl_base]
+
+ client_type client_;
+
+
+
+[endsect]
+
+
+
+[section:client_type common::request_base::impl_base::client_type]
+
+[indexterm2 client_type..common::request_base::impl_base]
+
+ typedef traits::client_type client_type;
+
+
+
+
+[endsect]
+
+
+
+[section:conn_ptr common::request_base::impl_base::conn_ptr]
+
+[indexterm2 conn_ptr..common::request_base::impl_base]
+
+ typedef connection_type::pointer conn_ptr;
+
+
+
+
+[endsect]
+
+
+
+[section:connection_type common::request_base::impl_base::connection_type]
+
+[indexterm2 connection_type..common::request_base::impl_base]
+
+ typedef traits::connection_type connection_type;
+
+
+
+
+[endsect]
+
+
+
+[section:const_buffers_type common::request_base::impl_base::const_buffers_type]
+
+[indexterm2 const_buffers_type..common::request_base::impl_base]
+
+ typedef traits::const_buffers_type const_buffers_type;
+
+
+
+
+[endsect]
+
+
+
+[section:form_parser_type common::request_base::impl_base::form_parser_type]
+
+[indexterm2 form_parser_type..common::request_base::impl_base]
+
+ typedef traits::form_parser_type form_parser_type;
+
+
+
+
+[endsect]
+
+
+
+[section:form_parts_ common::request_base::impl_base::form_parts_]
+
+[indexterm2 form_parts_..common::request_base::impl_base]
+
+ std::vector< common::form_part > form_parts_;
+
+
+
+[endsect]
+
+
+
+[section:fp_ common::request_base::impl_base::fp_]
+
+[indexterm2 fp_..common::request_base::impl_base]
+
+ boost::scoped_ptr< form_parser_type > fp_;
+
+
+
+[endsect]
+
+
+
+[section:http_status common::request_base::impl_base::http_status]
+
+[indexterm2 http_status..common::request_base::impl_base]
+
+ common::http::status_code & http_status();
+
+
+
+[endsect]
+
+
+
+[section:http_status_ common::request_base::impl_base::http_status_]
+
+[indexterm2 http_status_..common::request_base::impl_base]
+
+ common::http::status_code http_status_;
+
+
+
+[endsect]
+
+
+
+[section:impl_base common::request_base::impl_base::impl_base]
+
+[indexterm2 impl_base..common::request_base::impl_base] Construct.
+
+ impl_base();
+
+
+
+[endsect]
+
+
+
+[section:mutable_buffers_type common::request_base::impl_base::mutable_buffers_type]
+
+[indexterm2 mutable_buffers_type..common::request_base::impl_base]
+
+ typedef traits::mutable_buffers_type mutable_buffers_type;
+
+
+
+
+[endsect]
+
+
+
+[section:post_buffer_ common::request_base::impl_base::post_buffer_]
+
+[indexterm2 post_buffer_..common::request_base::impl_base]
+
+ buffer_type post_buffer_;
+
+
+
+[endsect]
+
+
+
+[section:prepare common::request_base::impl_base::prepare]
+
+[indexterm2 prepare..common::request_base::impl_base]
+
+ mutable_buffers_type prepare(
+ std::size_t size);
+
+
+
+[endsect]
+
+
+
+[section:protocol_service_type common::request_base::impl_base::protocol_service_type]
+
+[indexterm2 protocol_service_type..common::request_base::impl_base]
+
+ typedef traits::protocol_service_type protocol_service_type;
+
+
+
+
+[endsect]
+
+
+
+[section:protocol_type common::request_base::impl_base::protocol_type]
+
+[indexterm2 protocol_type..common::request_base::impl_base]
+
+ typedef Protocol protocol_type;
+
+
+
+
+[endsect]
+
+
+
+[section:request_status_ common::request_base::impl_base::request_status_]
+
+[indexterm2 request_status_..common::request_base::impl_base]
+
+ common::request_status request_status_;
+
+
+
+[endsect]
+
+
+
+[section:request_type common::request_base::impl_base::request_type]
+
+[indexterm2 request_type..common::request_base::impl_base]
+
+ typedef traits::request_type request_type;
+
+
+
+
+[endsect]
+
+
+
+[section:service_ common::request_base::impl_base::service_]
+
+[indexterm2 service_..common::request_base::impl_base]
+
+ protocol_service_type * service_;
+
+
+
+[endsect]
+
+
+[section:status common::request_base::impl_base::status]
+
+[indexterm2 status..common::request_base::impl_base]
+
+ common::request_status ``[link cgi.reference.common__request_base__impl_base.status.overload1 status]``() const;
+
+ void ``[link cgi.reference.common__request_base__impl_base.status.overload2 status]``(
+ common::request_status & st);
+
+
+[section:overload1 common::request_base::impl_base::status (1 of 2 overloads)]
+
+
+
+ common::request_status status() const;
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::request_base::impl_base::status (2 of 2 overloads)]
+
+
+
+ void status(
+ common::request_status & st);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:stdin_parsed common::request_base::impl_base::stdin_parsed]
+
+[indexterm2 stdin_parsed..common::request_base::impl_base]
+
+ bool stdin_parsed();
+
+
+
+[endsect]
+
+
+
+[section:stdin_parsed_ common::request_base::impl_base::stdin_parsed_]
+
+[indexterm2 stdin_parsed_..common::request_base::impl_base] Whether the post data has been parsed yet.
+
+ bool stdin_parsed_;
+
+
+
+[endsect]
+
+
+
+[section:string_type common::request_base::impl_base::string_type]
+
+[indexterm2 string_type..common::request_base::impl_base]
+
+ typedef traits::string_type string_type;
+
+
+
+
+[endsect]
+
+
+
+[section:traits common::request_base::impl_base::traits]
+
+[indexterm2 traits..common::request_base::impl_base]
+
+ typedef detail::protocol_traits< Protocol > traits;
+
+
+
+
+[endsect]
+
+
+
+[section:var_map_type common::request_base::impl_base::var_map_type]
+
+[indexterm2 var_map_type..common::request_base::impl_base]
+
+ typedef boost::fusion::vector< common::env_map, common::get_map, common::post_map, common::cookie_map, common::upload_map, common::session_map > var_map_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 > Add a member variable to basic\_request<>
+
+
+[endsect]
+
+
+
+[section:vars_ common::request_base::impl_base::vars_]
+
+[indexterm2 vars_..common::request_base::impl_base]
+
+ var_map_type vars_;
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:common__request_service common::request_service]
+
+The generic service class for basic_request<>s.
+
+ template<
+ typename Protocol >
+ class request_service
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__request_service.impl_type [*impl_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_service.implementation_type [*implementation_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_service.protocol_service_type [*protocol_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__request_service.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__request_service.async_load [*async_load]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.construct [*construct]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.destroy [*destroy]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.is_open [*is_open]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.load [*load]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.null [*null]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.request_service [*request_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.set_header [*set_header]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__request_service.shutdown_service [*shutdown_service]]]
+ []
+ ]
+
+]
+
+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.
+
+
+[section:async_load common::request_service::async_load]
+
+[indexterm2 async_load..common::request_service]
+
+ template<
+ typename Handler >
+ void async_load(
+ impl_type & impl,
+ bool parse_stdin,
+ Handler handler);
+
+
+
+[endsect]
+
+
+
+[section:construct common::request_service::construct]
+
+[indexterm2 construct..common::request_service]
+
+ void construct(
+ impl_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:destroy common::request_service::destroy]
+
+[indexterm2 destroy..common::request_service]
+
+ void destroy(
+ impl_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:impl_type common::request_service::impl_type]
+
+[indexterm2 impl_type..common::request_service]
+
+ typedef service_impl_type::impl_type impl_type;
+
+
+
+
+[endsect]
+
+
+
+[section:implementation_type common::request_service::implementation_type]
+
+[indexterm2 implementation_type..common::request_service]
+
+ typedef service_impl_type::implementation_type implementation_type;
+
+
+
+
+[endsect]
+
+
+
+[section:is_open common::request_service::is_open]
+
+[indexterm2 is_open..common::request_service]
+
+ bool is_open(
+ impl_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:load common::request_service::load]
+
+[indexterm2 load..common::request_service]
+
+ boost::system::error_code & load(
+ impl_type & impl,
+ bool parse_stdin,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:null common::request_service::null]
+
+[indexterm2 null..common::request_service]
+
+ impl_type null() const;
+
+
+
+[endsect]
+
+
+
+[section:protocol_service_type common::request_service::protocol_service_type]
+
+[indexterm2 protocol_service_type..common::request_service]
+
+ typedef common::basic_protocol_service< Protocol > protocol_service_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.ios_provider_type [*ios_provider_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.queue_type [*queue_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.request_ptr [*request_ptr]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.request_type [*request_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.set_type [*set_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.traits [*traits]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.basic_protocol_service [*basic_protocol_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.dispatch [*dispatch]]]
+ [Dispatch a handler through an available io_service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.io_service [*io_service]]]
+ [Return an available io_service from the IoServiceProvider. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.is_cgi [*is_cgi]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.post [*post]]]
+ [Post the handler through an available io_service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.reset [*reset]]]
+ [Reset all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.run [*run]]]
+ [Run all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.stop [*stop]]]
+ [Stop all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service._basic_protocol_service [*~basic_protocol_service]]]
+ []
+ ]
+
+]
+
+Holds the request queue and the connection queue. It is also a wrapper around asio::io\_service
+
+
+
+[endsect]
+
+
+
+[section:protocol_type common::request_service::protocol_type]
+
+[indexterm2 protocol_type..common::request_service]
+
+ typedef Protocol protocol_type;
+
+
+
+
+[endsect]
+
+
+[section:request_service common::request_service::request_service]
+
+[indexterm2 request_service..common::request_service]
+
+ ``[link cgi.reference.common__request_service.request_service.overload1 request_service]``(
+ ::BOOST_CGI_NAMESPACE::common::io_service & ios);
+
+ ``[link cgi.reference.common__request_service.request_service.overload2 request_service]``(
+ protocol_service_type & ps);
+
+
+[section:overload1 common::request_service::request_service (1 of 2 overloads)]
+
+
+
+ request_service(
+ ::BOOST_CGI_NAMESPACE::common::io_service & ios);
+
+
+
+[endsect]
+
+
+
+[section:overload2 common::request_service::request_service (2 of 2 overloads)]
+
+
+
+ request_service(
+ protocol_service_type & ps);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:set_header common::request_service::set_header]
+
+[indexterm2 set_header..common::request_service]
+
+ boost::system::error_code & set_header(
+ impl_type & impl,
+ const std::string & name,
+ const std::string & value,
+ boost::system::error_code & ec);
+
+
+
+[endsect]
+
+
+
+[section:shutdown_service common::request_service::shutdown_service]
+
+[indexterm2 shutdown_service..common::request_service]
+
+ void shutdown_service();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+
+[section:common__request_status common::request_status]
+
+[indexterm1 common::request_status]
+
+ enum request_status
+
+[heading Values]
+[variablelist
+
+ [
+ [null]
+ []
+ ]
+
+ [
+ [unloaded]
+ []
+ ]
+
+ [
+ [activated]
+ []
+ ]
+
+ [
+ [accepted]
+ []
+ ]
+
+ [
+ [begin_request_found]
+ []
+ ]
+
+ [
+ [env_read]
+ []
+ ]
+
+ [
+ [get_read]
+ []
+ ]
+
+ [
+ [post_read]
+ []
+ ]
+
+ [
+ [cookies_read]
+ []
+ ]
+
+ [
+ [loaded]
+ []
+ ]
+
+ [
+ [ok]
+ []
+ ]
+
+ [
+ [aborted]
+ []
+ ]
+
+ [
+ [closed]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:common__role__authorizer common::role::authorizer]
+
+
+
+ struct authorizer
+
+
+
+[endsect]
+
+[section:common__role__filter common::role::filter]
+
+
+
+ struct filter
+
+
+
+[endsect]
+
+[section:common__role__responder common::role::responder]
+
+
+
+ struct responder
+
+
+
+[endsect]
+
+
+[section:common__role_type common::role_type]
+
+[indexterm1 common::role_type]
+
+ enum role_type
+
+[heading Values]
+[variablelist
+
+ [
+ [none]
+ []
+ ]
+
+ [
+ [responder]
+ []
+ ]
+
+ [
+ [authorizer]
+ []
+ ]
+
+ [
+ [filter]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:common__tags__async_stdio common::tags::async_stdio]
+
+
+
+ struct async_stdio
+
+
+
+[endsect]
+
+[section:common__tags__cgi common::tags::cgi]
+
+
+
+ struct cgi
+
+
+
+[endsect]
+
+[section:common__tags__fcgi common::tags::fcgi]
+
+
+
+ struct fcgi
+
+
+
+[endsect]
+
+[section:common__tags__null common::tags::null]
+
+
+
+ struct null
+
+
+
+[endsect]
+
+[section:common__tags__round_robin common::tags::round_robin]
+
+
+
+ struct round_robin
+
+
+
+[endsect]
+
+[section:common__tags__scgi common::tags::scgi]
+
+
+
+ struct scgi
+
+
+
+[endsect]
+
+[section:common__tags__service_pool common::tags::service_pool]
+
+
+
+ struct service_pool
+
+
+
+[endsect]
+
+[section:common__tags__shareable_tcp_socket common::tags::shareable_tcp_socket]
+
+
+
+ struct shareable_tcp_socket
+
+
+
+[endsect]
+
+[section:common__tags__single_service common::tags::single_service]
+
+
+
+ struct single_service
+
+
+
+[endsect]
+
+[section:common__tags__stdio common::tags::stdio]
+
+
+
+ struct stdio
+
+
+
+[endsect]
+
+[section:common__tags__tcp_socket common::tags::tcp_socket]
+
+
+
+ struct tcp_socket
+
+
+
+[endsect]
+
+[section:connection_base connection_base]
+
+Abstract Base Class for all connection types.
+
+ class connection_base
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.connection_base._connection_base [*~connection_base]]]
+ []
+ ]
+
+]
+
+
+[section:_connection_base connection_base::~connection_base]
+
+[indexterm2 ~connection_base..connection_base]
+
+ ~connection_base();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+
+[section: fcgi__acceptor]
+
+Typedef for common usage (FCGI).
+
+ typedef ::BOOST_CGI_NAMESPACE::common::basic_request_acceptor< fcgi_request_acceptor_service<> > acceptor;
+
+
+
+
+[endsect]
+
+
+
+[section: fcgi__client]
+
+
+
+ typedef common::basic_client< connections::shareable_tcp,::BOOST_CGI_NAMESPACE::common::tags::fcgi > client;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_client.connection_ptr [*connection_ptr]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.connection_type [*connection_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.header_buffer_type [*header_buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.io_service_type [*io_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.map_type [*map_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.mutable_buffers_type [*mutable_buffers_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_client.role_type [*role_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_client.async_read_some [*async_read_some]]]
+ [Asynchronously read some data from the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.async_write_some [*async_write_some]]]
+ [Asynchronously write some data to the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.basic_client [*basic_client]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.bytes_left [*bytes_left]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.close [*close]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.connection [*connection]]]
+ [Get a shared_ptr of the connection associated with the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.construct [*construct]]]
+ [Construct the client by claiming a request id. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.handle_write [*handle_write]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.is_open [*is_open]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.keep_connection [*keep_connection]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.prepare_buffer [*prepare_buffer]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.read_some [*read_some]]]
+ [Read data into the supplied buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.request_id [*request_id]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.set_connection [*set_connection]]]
+ [Associate a connection with this client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.status [*status]]]
+ [Get the status of the client. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.write_some [*write_some]]]
+ [Write some data to the client. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_client.bytes_left_ [*bytes_left_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.header_ [*header_]]]
+ [Buffer used to check the header of each packet. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.keep_connection_ [*keep_connection_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.outbuf_ [*outbuf_]]]
+ [Output buffer. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.request_id_ [*request_id_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.role_ [*role_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.status_ [*status_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.total_sent_bytes_ [*total_sent_bytes_]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_client.total_sent_packets_ [*total_sent_packets_]]]
+ []
+ ]
+
+]
+
+A client is for two things: 1. To hold a full-duplex connection (or separate input and output connections). 2. To hold any protocol-specific data about the request. For now, this means the internal 'request number' associated by FastCGI with each request (ie. so incoming/outgoing packets can be wrapped with data noting what request it relates to). 3. Buffering. Not sure about how far this should go yet, but probably no further than minimal buffering. 4. Share a connection. Since a multiplexing connection is shared between multiple clients, the client should be responsible for taking possesion of the connection for a period of time (so it can write a complete packet). This idea could be taken quite far into genericity by making clients aware of how busy the connection is and size its output packets accordingly... But I'm not doing that.
+
+
+
+[endsect]
+
+
+
+[section: fcgi__request]
+
+
+
+ typedef common::basic_request< common::tags::fcgi > request;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_request.buffer_type [*buffer_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.client_type [*client_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.implementation_type [*implementation_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.pointer [*pointer]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.protocol_service_type [*protocol_service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.service_type [*service_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.string_type [*string_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_request.traits [*traits]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_request.abort [*abort]]]
+ [Abort a request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.auth_type [*auth_type]]]
+ [Set the output for the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.basic_request [*basic_request]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.charset [*charset]]]
+ [Get the charset from the CONTENT_TYPE header. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.clear [*clear]]]
+ [Clear the data for the request, for reusing this object. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.client [*client]]]
+ [Get the client connection associated with the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.close [*close]]]
+ [Asynchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.content_length [*content_length]]]
+ [Get the content length as a long. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.content_type [*content_type]]]
+ [The content type of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.create [*create]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.gateway_interface [*gateway_interface]]]
+ [The protocol used by the server to communicate to the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.hash [*hash]]]
+ [Get a hashed interpretation of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.http_cookie [*http_cookie]]]
+ [The cookies sent by the user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.http_from [*http_from]]]
+ [The email of the user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.id [*id]]]
+ [The id of this request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.is_open [*is_open]]]
+ [Check if the request is still open (ie. not aborted or closed). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.load [*load]]]
+ [Synchronously read/parse the request meta-data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.method [*method]]]
+ [The method of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.path_info [*path_info]]]
+ [Additional information, appendended to the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.path_translated [*path_translated]]]
+ [The translated version of the path info. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.post_buffer [*post_buffer]]]
+ [Get the buffer containing the POST data. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.query_string [*query_string]]]
+ [The query string for the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.read_some [*read_some]]]
+ [Read some data into the request, parsing if necessary. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.referer [*referer]]]
+ [Get the web page the user came from. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.reject [*reject]]]
+ [Reject the request with a '500 Internal Server Error' error. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_addr [*remote_addr]]]
+ [The host address of the remote user. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_host [*remote_host]]]
+ [The host name of the remote user's machine. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_ident [*remote_ident]]]
+ [The user making the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.remote_user [*remote_user]]]
+ [The userid of the person accessing the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.request_method [*request_method]]]
+ [The method of the request (long-hand of `method()`). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.request_uri [*request_uri]]]
+ [Get the URI of the request (long-hand of `uri()`). ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.role [*role]]]
+ [The role that the request is playing. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_name [*script_name]]]
+ [The name of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_uri [*script_uri]]]
+ [The full URI of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.script_url [*script_url]]]
+ [The URL of the script. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_name [*server_name]]]
+ [Get the name of the server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_port [*server_port]]]
+ [Get the port the calling server is listening on. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_protocol [*server_protocol]]]
+ [Get the protocol being used by the calling server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.server_software [*server_software]]]
+ [Get a string identifying the calling server. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.set_protocol_service [*set_protocol_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.status [*status]]]
+ [Get / Set the status of a request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.uri [*uri]]]
+ [Get the URI of the request. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request._basic_request [*~basic_request]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_request.cookies [*cookies]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.env [*env]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.form [*form]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.get [*get]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.post [*post]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_request.uploads [*uploads]]]
+ []
+ ]
+
+]
+
+Note: By default, synchronous protocols (ie. cgi) auto-load AND parse STDIN,whereas async protocols don't.
+
+Note: The alternative functions which take a boost::system::error\_code are the non-throwing versions. Instead of a boost::system::system\_error being thrown in case of an error, the passed error\_code will be set to the value of the error, s.t. if (error) evaluates to true.`
+
+Note: This class isn't thread safe: carrying around a mutex-per-request seems prohibitively expensive. There could be functions which take a mutex as an argument and lock it. (Async calls could get messy if you need a protected request object).
+
+
+
+[endsect]
+
+
+
+[section: fcgi__service]
+
+
+
+ typedef common::basic_protocol_service< common::tags::fcgi > service;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.ios_provider_type [*ios_provider_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.queue_type [*queue_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.request_ptr [*request_ptr]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.request_type [*request_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.set_type [*set_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.common__basic_protocol_service.traits [*traits]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.basic_protocol_service [*basic_protocol_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.dispatch [*dispatch]]]
+ [Dispatch a handler through an available io_service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.io_service [*io_service]]]
+ [Return an available io_service from the IoServiceProvider. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.is_cgi [*is_cgi]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.post [*post]]]
+ [Post the handler through an available io_service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.reset [*reset]]]
+ [Reset all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.run [*run]]]
+ [Run all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service.stop [*stop]]]
+ [Stop all the io_services contained by this service. ]
+ ]
+
+ [
+ [[link cgi.reference.common__basic_protocol_service._basic_protocol_service [*~basic_protocol_service]]]
+ []
+ ]
+
+]
+
+Holds the request queue and the connection queue. It is also a wrapper around asio::io\_service
+
+
+
+[endsect]
+
+
+[section:request_acceptor_service request_acceptor_service]
+
+
+
+ template<
+ typename Protocol >
+ class request_acceptor_service
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.request_acceptor_service.implementation_type [*implementation_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.request_acceptor_service.protocol_type [*protocol_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.request_acceptor_service.accept [*accept]]]
+ [Accept a request. ]
+ ]
+
+ [
+ [[link cgi.reference.request_acceptor_service.async_accept [*async_accept]]]
+ [Asynchronously accept a request. ]
+ ]
+
+ [
+ [[link cgi.reference.request_acceptor_service.construct [*construct]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.request_acceptor_service.destroy [*destroy]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.request_acceptor_service.request_acceptor_service [*request_acceptor_service]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.request_acceptor_service.shutdown_service [*shutdown_service]]]
+ []
+ ]
+
+]
+
+
+[section:accept request_acceptor_service::accept]
+
+[indexterm2 accept..request_acceptor_service] Accept a request.
+
+ template<
+ typename CommonGatewayRequest >
+ boost::system::error_code & accept(
+ implementation_type & impl,
+ CommonGatewayRequest & request,
+ boost::system::error_code & ec);
+
+
+Check if there is a waiting request in the queue. If not, accept a connection, and associate it with the request.
+
+
+[endsect]
+
+
+
+[section:async_accept request_acceptor_service::async_accept]
+
+[indexterm2 async_accept..request_acceptor_service] Asynchronously accept a request.
+
+ template<
+ typename CommonGatewayRequest ,
+ typename Handler >
+ void async_accept(
+ implementation_type & impl,
+ CommonGatewayRequest & request,
+ Handler handler);
+
+
+
+[endsect]
+
+
+
+[section:construct request_acceptor_service::construct]
+
+[indexterm2 construct..request_acceptor_service]
+
+ void construct(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:destroy request_acceptor_service::destroy]
+
+[indexterm2 destroy..request_acceptor_service]
+
+ void destroy(
+ implementation_type & impl);
+
+
+
+[endsect]
+
+
+
+[section:implementation_type request_acceptor_service::implementation_type]
+
+[indexterm2 implementation_type..request_acceptor_service]
+
+ typedef service_impl_type::impl_type implementation_type;
+
+
+
+
+[endsect]
+
+
+
+[section:protocol_type request_acceptor_service::protocol_type]
+
+[indexterm2 protocol_type..request_acceptor_service]
+
+ typedef Protocol protocol_type;
+
+
+
+
+[endsect]
+
+
+
+[section:request_acceptor_service request_acceptor_service::request_acceptor_service]
+
+[indexterm2 request_acceptor_service..request_acceptor_service]
+
+ request_acceptor_service(
+ basic_protocol_service< protocol_type > & s);
+
+
+
+[endsect]
+
+
+
+[section:shutdown_service request_acceptor_service::shutdown_service]
+
+[indexterm2 shutdown_service..request_acceptor_service]
+
+ void shutdown_service();
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:stencils__dictionary stencils::dictionary]
+
+A lightweight wrapper around a ctemplate::TemplateDictionary.
+
+ class dictionary
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.impl_type [*impl_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__dictionary.add [*add]]]
+ [Add a section into the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.dictionary [*dictionary]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.include [*include]]]
+ [Include a file into the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.set [*set]]]
+ [Set the varible `name` to `value` in the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.show [*show]]]
+ [Show a section. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__dictionary.impl [*impl]]]
+ []
+ ]
+
+]
+
+
+[section:add stencils::dictionary::add]
+
+[indexterm2 add..stencils::dictionary] Add a section into the stencil.
+
+ dictionary add(
+ section const & sec);
+
+
+
+[endsect]
+
+
+[section:dictionary stencils::dictionary::dictionary]
+
+[indexterm2 dictionary..stencils::dictionary]
+
+ ``[link cgi.reference.stencils__dictionary.dictionary.overload1 dictionary]``();
+
+ ``[link cgi.reference.stencils__dictionary.dictionary.overload2 dictionary]``(
+ impl_type * impl);
+
+
+[section:overload1 stencils::dictionary::dictionary (1 of 2 overloads)]
+
+
+
+ dictionary();
+
+
+
+[endsect]
+
+
+
+[section:overload2 stencils::dictionary::dictionary (2 of 2 overloads)]
+
+
+
+ dictionary(
+ impl_type * impl);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:impl stencils::dictionary::impl]
+
+[indexterm2 impl..stencils::dictionary]
+
+ impl_type * impl;
+
+
+
+[endsect]
+
+
+
+[section:impl_type stencils::dictionary::impl_type]
+
+[indexterm2 impl_type..stencils::dictionary]
+
+ typedef ctemplate::TemplateDictionary impl_type;
+
+
+
+
+[endsect]
+
+
+[section:include stencils::dictionary::include]
+
+[indexterm2 include..stencils::dictionary] Include a file into the stencil.
+
+ dictionary ``[link cgi.reference.stencils__dictionary.include.overload1 include]``(
+ string_type const & section_name,
+ string_type const & filename);
+
+ dictionary ``[link cgi.reference.stencils__dictionary.include.overload2 include]``(
+ section const & sec);
+
+
+[section:overload1 stencils::dictionary::include (1 of 2 overloads)]
+
+Include a file into the stencil.
+
+ dictionary include(
+ string_type const & section_name,
+ string_type const & filename);
+
+
+
+[heading Return Value]
+
+dictionary The returned sub-dictionary is used to set fields in an included stencil.
+
+[heading Parameters]
+
+
+[variablelist
+
+[[section_name][The name of the section, and of the marker in the stencil. Add {{>section\_name}} into the stencil to include a file's contents. ]]
+
+[[filename][The name of the file to include. This must be set. ]]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:overload2 stencils::dictionary::include (2 of 2 overloads)]
+
+Include a file into the stencil.
+
+ dictionary include(
+ section const & sec);
+
+
+
+[heading Return Value]
+
+dictionary The returned sub-dictionary is used to set fields in an included stencil.
+
+[heading Parameters]
+
+
+[variablelist
+
+[[sec][The section to include. Be sure to set *both* the section name and filename first. ]]
+
+]
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:self_type stencils::dictionary::self_type]
+
+[indexterm2 self_type..stencils::dictionary]
+
+ typedef dictionary self_type;
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.impl_type [*impl_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.self_type [*self_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__dictionary.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__dictionary.add [*add]]]
+ [Add a section into the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.dictionary [*dictionary]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.include [*include]]]
+ [Include a file into the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.set [*set]]]
+ [Set the varible `name` to `value` in the stencil. ]
+ ]
+
+ [
+ [[link cgi.reference.stencils__dictionary.show [*show]]]
+ [Show a section. ]
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__dictionary.impl [*impl]]]
+ []
+ ]
+
+]
+
+
+
+[endsect]
+
+
+[section:set stencils::dictionary::set]
+
+[indexterm2 set..stencils::dictionary] Set the varible `name` to `value` in the stencil.
+
+ template<
+ typename T >
+ self_type & ``[link cgi.reference.stencils__dictionary.set.overload1 set]``(
+ string_type const & name,
+ T value);
+
+ template<
+ typename T >
+ self_type & ``[link cgi.reference.stencils__dictionary.set.overload2 set]``(
+ string_type const & name,
+ T value,
+ section const & sec);
+
+ template<>
+ dictionary & ``[link cgi.reference.stencils__dictionary.set.overload3 set]``(
+ string_type const & name,
+ string_type const & value);
+
+ template<>
+ dictionary & ``[link cgi.reference.stencils__dictionary.set.overload4 set]``(
+ string_type const & name,
+ string_type const & value,
+ section const & sec);
+
+
+[section:overload1 stencils::dictionary::set (1 of 4 overloads)]
+
+Set the varible `name` to `value` in the stencil.
+
+ template<
+ typename T >
+ self_type & set(
+ string_type const & name,
+ T value);
+
+
+
+[heading Parameters]
+
+
+[variablelist
+
+[[name][The name of the variable. Use {{name}} in the stencil. ]]
+
+[[value][The value, can be any type that is supported by boost::lexical\_cast. See the docs for lexical\_cast: http://www.boost.org/libs/lexical\_cast]]
+
+]
+
+
+
+[endsect]
+
+
+
+[section:overload2 stencils::dictionary::set (2 of 4 overloads)]
+
+Set a variable and show a section in one go.
+
+ template<
+ typename T >
+ self_type & set(
+ string_type const & name,
+ T value,
+ section const & sec);
+
+
+
+[endsect]
+
+
+
+[section:overload3 stencils::dictionary::set (3 of 4 overloads)]
+
+Set the varible `name` to `value` in the stencil.
+
+ template<>
+ dictionary & set(
+ string_type const & name,
+ string_type const & value);
+
+
+
+[endsect]
+
+
+
+[section:overload4 stencils::dictionary::set (4 of 4 overloads)]
+
+Set a variable and show a section in one go.
+
+ template<>
+ dictionary & set(
+ string_type const & name,
+ string_type const & value,
+ section const & sec);
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:show stencils::dictionary::show]
+
+[indexterm2 show..stencils::dictionary] Show a section.
+
+ self_type & show(
+ section const & sec);
+
+
+
+[endsect]
+
+
+
+[section:string_type stencils::dictionary::string_type]
+
+[indexterm2 string_type..stencils::dictionary]
+
+ typedef std::string string_type;
+
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:stencils__include_error stencils::include_error]
+
+
+
+ class include_error
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__include_error.include_error [*include_error]]]
+ []
+ ]
+
+]
+
+
+[section:include_error stencils::include_error::include_error]
+
+[indexterm2 include_error..stencils::include_error]
+
+ template<
+ typename Str >
+ include_error(
+ Str const & section_name,
+ Str const & filename);
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:stencils__section stencils::section]
+
+A class used to represent a section in the stencil.
+
+ class section
+
+
+[heading Types]
+[table
+ [[Name][Description]]
+
+ [
+
+ [[link cgi.reference.stencils__section.char_type [*char_type]]]
+ []
+
+ ]
+
+ [
+
+ [[link cgi.reference.stencils__section.string_type [*string_type]]]
+ []
+
+ ]
+
+]
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__section.section [*section]]]
+ []
+ ]
+
+]
+
+[heading Data Members]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__section.filename [*filename]]]
+ []
+ ]
+
+ [
+ [[link cgi.reference.stencils__section.name [*name]]]
+ []
+ ]
+
+]
+
+
+[section:char_type stencils::section::char_type]
+
+[indexterm2 char_type..stencils::section]
+
+ typedef char char_type;
+
+
+
+
+[endsect]
+
+
+
+[section:filename stencils::section::filename]
+
+[indexterm2 filename..stencils::section]
+
+ string_type filename;
+
+
+
+[endsect]
+
+
+
+[section:name stencils::section::name]
+
+[indexterm2 name..stencils::section]
+
+ string_type name;
+
+
+
+[endsect]
+
+
+[section:section stencils::section::section]
+
+[indexterm2 section..stencils::section]
+
+ ``[link cgi.reference.stencils__section.section.overload1 section]``();
+
+ ``[link cgi.reference.stencils__section.section.overload2 section]``(
+ const char_type * name,
+ const char_type * filename = "");
+
+ ``[link cgi.reference.stencils__section.section.overload3 section]``(
+ string_type const & name,
+ string_type const & filename = "");
+
+
+[section:overload1 stencils::section::section (1 of 3 overloads)]
+
+
+
+ section();
+
+
+
+[endsect]
+
+
+
+[section:overload2 stencils::section::section (2 of 3 overloads)]
+
+
+
+ section(
+ const char_type * name,
+ const char_type * filename = "");
+
+
+
+[endsect]
+
+
+
+[section:overload3 stencils::section::section (3 of 3 overloads)]
+
+
+
+ section(
+ string_type const & name,
+ string_type const & filename = "");
+
+
+
+[endsect]
+
+
+[endsect]
+
+
+[section:string_type stencils::section::string_type]
+
+[indexterm2 string_type..stencils::section]
+
+ typedef std::basic_string< char_type > string_type;
+
+
+
+
+[endsect]
+
+
+
+[endsect]
+
+[section:stencils__template_error stencils::template_error]
+
+
+
+ class template_error
+
+
+[heading Member Functions]
+[table
+ [[Name][Description]]
+
+ [
+ [[link cgi.reference.stencils__template_error.template_error [*template_error]]]
+ []
+ ]
+
+]
+
+
+[section:template_error stencils::template_error::template_error]
+
+[indexterm2 template_error..stencils::template_error]
+
+ template<
+ typename Str >
+ template_error(
+ Str const & filename);
-[xinclude ../autodoc.xml]
-[section Quick Reference]
-Reference coming...
+[endsect]
-Requests
-
- * 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 functions
- * script_name()
- * request_method()
- * content_length()
- * content_encoding()
- * etc...
- * constructors
- * load()
- * async_load()
- * close()
- * clear()
- * id()
- * client()
-
-Acceptor
-
- * constructors
- * accept()
- * async_accept()
- * cancel()
-
-
-Service
-
- * run()
- * stop()
- * reset()
- * get_io_service()
-
-Responses
-
- * operator<<
- * send()
- * clear()
- * data()
- * content_length()
-[endsect] [/ quick_reference]
-[endsect] [/ ref]
+[endsect]
+[endsect]
\ No newline at end of file
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/troubleshooting.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/troubleshooting.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/troubleshooting.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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/trunk/libs/cgi/doc/src/user_guide.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,9 +9,9 @@
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:building user_guide/building.qbk]
-[include:server_config user_guide/server_configuration.qbk]
+[/include:server_config user_guide/server_configuration.qbk]
[endsect]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/headers.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/headers.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/headers.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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/trunk/libs/cgi/doc/src/user_guide/request_objects.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/request_objects.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/request_objects.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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/trunk/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/10_min_intro.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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/trunk/libs/cgi/doc/src/user_guide/tutorial/quickstart.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/quickstart.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/quickstart.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -17,6 +17,11 @@
[main]
-That's all quite simple, right?
+[section:building Building]
+
+Now to compile and run the example. It's probably beyond the scope of these docs to go into too
+much detail here but
+
+[endsect]
[endsect]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/tutorial.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/tutorial.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/doc/src/user_guide/tutorial/tutorial.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -1,7 +1,9 @@
[section Tutorial]
-[include hello_world.qbk]
+**FIXME** - If this doesn't get fixed, please remind me!
+
+[/include hello_world.qbk]
[section:what_next The next step]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/Jamfile.v2 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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/trunk/libs/cgi/example/cgi/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/Jamfile.v2 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -7,6 +7,8 @@
# By default, just build the examples
build-project hello_world ;
build-project echo ;
+build-project cookies ;
+build-project file_browser ;
# If the user explicitly passes "install" on the command line, build the
# CGI examples and copy them to $(cgi-bin)
@@ -14,6 +16,8 @@
:
hello_world
echo
+ cookies
+ file_browser
:
<location>$(cgi-bin)
;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/doc.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/doc.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/doc.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -5,5 +5,15 @@
[include echo/doc.qbk]
+[include command_line/doc.qbk]
+
+[include cookie_game/doc.qbk]
+
+[include cookie_game2/doc.qbk]
+
+[include file_browser/doc.qbk]
+
+[include stencil/doc.qbk]
+
[endsect][/ cgi_examples]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/echo/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -1,6 +1,6 @@
-// -- main.hpp --
+// -- 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)
@@ -17,45 +17,112 @@
#include <boost/cgi/cgi.hpp>
-using namespace boost::cgi;
+namespace cgi = boost::cgi;
+
+// The styling information for the page, just to make things look nicer.
+static const char* gCSS_text =
+"body { padding: 0; margin: 3%; border-color: #efe; }"
+".var_map_title"
+ "{ font-weight: bold; font-size: large; }"
+".var_map"
+ "{ border: 1px dotted; padding: 2px 3px; margin-bottom: 3%; }"
+".var_pair"
+ "{ border-top: 1px dotted; overflow: auto; padding: 0; margin: 0; }"
+".var_name"
+ "{ position: relative; float: left; width: 30%; font-weight: bold; }"
+".var_value"
+ "{ position: relative; float: left; width: 65%; left: 1%;"
+ " border-left: 1px solid; padding: 0 5px 0 5px;"
+ " overflow: auto; white-space: pre; }"
+;
//
// This function writes the title and map contents to the ostream in an
// HTML-encoded format (to make them easier on the eye).
//
-template<typename OStreamT, typename MapT>
-void show_map_contents(OStreamT& os, MapT& m, const std::string& title)
+// The request data is all held in std::map<>-like containers and can use the same
+// member functions. There are some additional functions included for common
+// CGI tasks, such as lexical casting.
+//
+template<typename OStream, typename Request, typename Map>
+void format_map(OStream& os, Request& req, Map& m, const std::string& title)
{
- os<< "<h3>" << title << "</h3>";
-
+ os<< "<div class=\"var_map\">"
+ "<div class=\"var_map_title\">"
+ << title
+ << "</div>";
+
if (m.empty())
- os<< "NONE<br />";
+ os<< "<div class=\"var_pair\">EMPTY</div>";
else
- for (typename MapT::const_iterator i = m.begin(); i != m.end(); ++i)
- os<< "<b>" << i->first << "</b> = <i>"
- << i->second << "</i><br />";
+ {
+ for (typename Map::const_iterator iter(m.begin()), end(m.end());
+ iter != m.end();
+ ++iter)
+ {
+ os<< "<div class=\"var_pair\">"
+ "<div class=\"var_name\">"
+ << iter->first
+ << "</div>"
+ "<div class=\"var_value\">"
+ << iter->second
+ << (req.uploads.count(iter->first) ? " (file)" : "")
+ << "</div>"
+ "</div>";
+ }
+ }
+ os<< "</div>";
}
int main()
{
- request req; // 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");
+ // A basic CGI request auto-parses everything (including POST data).
+ cgi::request req;
+ cgi::response resp;
+
+ // You can also stream text to a response.
+ // All of this just prints out the form
+ resp<< "<html>"
+ "<head>"
+ "<title>CGI Echo Example</title>"
+ "<style type=\"text/css\">"
+ << gCSS_text <<
+ "</style>"
+ "<head>"
+ "<body>"
+ "Request ID = " << req.id() << "<br />"
+ "<form method=post enctype=\"multipart/form-data\">"
+ "<input type=text name=name value='"
+ << req.post["name"] << "' />"
+ "<br />"
+ "<input type=text name=hello value='"
+ << req.post["hello"] << "' />"
+ "<br />"
+ "<input type=file name=user_file />"
+ "<input type=hidden name=cmd value=multipart_test />"
+ "<br />";
+ // Access file uploads (which are saved to disk).
+ if (req.uploads.count("user_file")) {
+ cgi::common::form_part& part = req.uploads["user_file"];
+ if (!part.filename.empty())
+ resp<< "Saved uploaded file to: " << part.path << "<br />";
+ }
+ resp<< "<input type=submit value=submit />"
+ "<br />";
+ "</form><p />";
+
+ format_map(resp, req, req.env, "Environment Variables");
+ //format_map(resp, req, req.get, "GET Variables");
+ format_map(resp, req, req.form, "Form [" + req.method() + "] Variables");
+ format_map(resp, req, req.cookies, "Cookie Variables");
+ format_map(resp, req, req.uploads, "Uploaded Files");
// Note that this (and any other) HTTP header can go either before or after
// the response contents.
- resp<< content_type("text/html");
-
- // Send the response to the client associated with the request.
- resp.send(req.client());
+ resp<< cgi::content_type("text/html");
- return 0;
+ // Send the response to the client that made the request.
+ return cgi::commit(req, resp);
}
//]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/cgi/hello_world/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -9,26 +9,48 @@
//
//[cgi_hello_world
//
-// The simplest CGI program, outputs only "Hello there, universe."
+// A simple CGI program.
+//
+// Outputs only "Hello there, universe." and saves a session cookie "test=check" to the browser.
//
#include <iostream>
#include <boost/cgi/cgi.hpp>
-using namespace boost::cgi;
+namespace cgi = boost::cgi;
int main()
{
- request req; // Our request (POST data won't be parsed yet).
- response resp; // A response object to make our lives easier.
-
- // This is a minimal response. The content_type(...) may go before or after
+try {
+ // Construct a request. Parses all GET, POST and environment data,
+ // as well as cookies.
+ cgi::request req;
+ // Using a response is the simplest way to write data back to the client.
+ cgi::response resp;
+
+ // This is a minimal response. The cgi::cookie(...) may go before or after
// the response text.
- resp<< content_type("text/plain")
- << "Hello there, universe.";
+ resp<< "Hello there, universe."
+ << cgi::cookie("test", "check")
+ << cgi::charset("ascii")
+ ;
+ //resp.set(cgi::cookie("test", "check"));
// Leave this function, after sending the response and closing the request.
- return_(resp, req, 0); // Note the underscore: returns "0" to the OS.
+ // Returns 0 on success.
+ return cgi::commit(req, resp);
+
+} catch(std::exception& e) {
+ using namespace std;
+ cout<< "Content-type: text/plain\r\n\r\n"
+ << "Error: " << e.what() << endl;
+ return 1;
+} catch(...) {
+ using namespace std;
+ cout<< "Content-type: text/plain\r\n\r\n"
+ << "Unexpected exception." << endl;
+ return 1;
+}
}
//]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/doc.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/doc.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/doc.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -23,8 +23,6 @@
[include cgi/doc.qbk]
-[include acgi/doc.qbk]
-
[include fcgi/doc.qbk]
[include xcgi/doc.qbk]
Deleted: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/amortization.tpl
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/amortization.tpl 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
+++ (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/trunk/libs/cgi/example/fcgi/amortization/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/amortization/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -21,8 +21,9 @@
#include <iostream>
#include <iomanip>
#include <boost/cgi/fcgi.hpp>
+#include <boost/cgi/utility.hpp>
#include <boost/algorithm/string/regex.hpp>
-#include <google/template.h>
+#include <ctemplate/template.h>
using namespace boost::fcgi;
@@ -34,15 +35,14 @@
return amt;
}
-/// This function fills the dictionary and sub-dictionaries with relevant values.
+/// This function fills a dictionary.
template<typename Request>
-void fill_amortization_dictionary(google::TemplateDictionary& dict, Request& req)
+void fill_amortization_dictionary(
+ ctemplate::TemplateDictionary& dict, Request& req)
{
- std::string tmp( req.POST("LoanAmt") );
- dict.SetValue("LoanAmt", tmp.empty() ? "$250,000" : tmp);
-
- tmp = req.POST("YearlyIntRate");
- dict.SetValue("YearlyIntRate", tmp.empty() ? "6.000" : tmp);
+ dict.SetValue("LoanAmt", has_key(req.post, "LoanAmt")
+ ? "$250,000" : req.post["LoanAmt"]);
+ dict.SetIntValue("YearlyIntRate", req.post.as("YearlyIntRate", 6.000));
boost::array<std::string, 8> year_opts
= {{ "5", "7", "10", "20", "30", "40", "50" }};
@@ -52,16 +52,18 @@
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 = req.post.as<double>("YearlyIntRate", 1) / 1200;
+ double n = req.post.as<double>("TermYrs", 1) * 12;
double monthly_payments = (P*i) / (1 - std::pow((1+i), -n));
- google::TemplateDictionary* sub_dict = dict.AddSectionDictionary("RegPmtSummary");
+ ctemplate::TemplateDictionary* sub_dict
+ = dict.AddSectionDictionary("RegPmtSummary");
sub_dict->ShowSection("RegPmtSummary");
sub_dict->SetFormattedValue("MonthlyPmt", "%.2f", monthly_payments);
@@ -74,7 +76,8 @@
double principal_paid;
double total_interest = 0;
do{
- google::TemplateDictionary* sub_dict2 = dict.AddSectionDictionary("PaymentEntry");
+ ctemplate::TemplateDictionary* sub_dict2
+ = dict.AddSectionDictionary("PaymentEntry");
sub_dict2->ShowSection("PaymentEntry");
sub_dict2->SetFormattedValue("Payment", "%.2f", monthly_payments);
sub_dict2->SetIntValue("ROW_NUM", ++row_num);
@@ -89,51 +92,49 @@
}while(balance > 0);
- sub_dict->SetFormattedValue("RegPmt_TotalIntPd", "%.2f", total_interest);
- sub_dict->SetFormattedValue("RegPmt_TotalPmts", "%.2f", total_interest + P);
+ sub_dict->SetFormattedValue(
+ "RegPmt_TotalIntPd", "%.2f", total_interest);
+ sub_dict->SetFormattedValue(
+ "RegPmt_TotalPmts", "%.2f", total_interest + P);
}
}
template<typename Request>
int write_amortization_template(Request& req, response& resp)
{
- google::TemplateDictionary dict("amortization");
+ ctemplate::TemplateDictionary dict("amortization");
fill_amortization_dictionary(dict, req);
- google::Template* tmpl
- = google::Template::GetTemplate("amortization.tpl", google::STRIP_WHITESPACE);
+ ctemplate::Template* tmpl
+ = ctemplate::Template::GetTemplate("../templates/amortization.html", ctemplate::STRIP_WHITESPACE);
std::string h("Content-type: text/html\r\n\r\n");
write(req.client(), buffer(h));
- std::string arg(req.GET("arg"));
- if (arg.empty())
- arg = "2"; // set this as default (for no particular reason).
+ int arg = req.get.as("arg", 2); // 2 is the default.
// Different, but equivalent ways of writing the output.
- if (arg == "1")
+ std::string output;
+ switch (arg)
{
- std::string output;
+ case 1:
tmpl->Expand(&output, &dict);
resp<< output;
- }else
- if (arg == "2")
- {
- std::string output;
+ break;
+ case 2:
tmpl->Expand(&output, &dict);
write(req.client(), buffer(output));
- }else
-// if (arg == "3")
-// {
+ break;
+ case 3:
// // This requires a modified version of Google.cTemplate, so it won't work.
// std::string s;
// std::vector<boost::asio::const_buffer> out;
//
// tmpl->Expand(&s, &out, &dict);
// write(req.client(), out);
-// }else
- {
+ break;
+ default:
resp<< "Error!";
return 1;
}
@@ -154,52 +155,50 @@
response resp;
++num;
- // Accepting on a closed request is fine (and more efficient than constantly
- // creating/destructing request objects). You must call close() first though!
+ // Accepting on a closed request is fine (and more efficient than
+ // constantly creating/destructing request objects).
a.accept(req);
- req.load(true);
+ 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);
- resp.send(req.client(), ec);
-
- ret = ret ? ret : req.close(resp.status(), 0, ec);
+ ret = commit(req, resp, 0, ec);
}
return ret;
}
-void accept_requests(acceptor& a)
-{
- for(;;)
- {
- // Keep handling requests until something goes wrong.
- if (handle_request(a))
- break;
- }
-}
-
int main()
{
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);
+ for(;;)
+ {
+ // Keep handling requests until something goes wrong.
+ // An exception will be thrown.
+ if (handle_request(a))
+ break;
+ }
return 0;
- }catch(boost::system::error_code& err){
- std::cerr<< "CGI error(" << err.value() << "): " << err.message() << std::endl;
}catch(boost::system::system_error& err){
- std::cerr<< "System error(" << err.code() << "): " << err.what() << std::endl;
+ std::cout<< "Content-type: text/plain\r\n\r\n"
+ << "Error (" << err.code() << "): " << err.what();
+ return 0;
+ }catch(std::exception& e){
+ std::cout<< "Content-type: text/html\r\n\r\n"
+ << "Exception caught: " << e.what();
+ return 0;
}catch(...){
- std::cerr<< "ERROR!! BOOM!" << std::endl;
+ std::cout<< "Content-type: text/html\r\n\r\n"
+ << "Unknown error!";
}
}
//]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/doc.qbk
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/doc.qbk (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/doc.qbk 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -3,8 +3,16 @@
[include echo/doc.qbk]
+[include async_echo/doc.qbk]
+
[include amortization/doc.qbk]
+[include stencil/doc.qbk]
+
+[include file_browser/doc.qbk]
+
+[include upload/doc.qbk]
+
[section Servers]
[include server1/doc.qbk]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/echo/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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)
@@ -15,61 +15,64 @@
// variables QUERY_STRING and HTTP_COOKIE respectively.
//
///////////////////////////////////////////////////////////
+#include <iostream>
+///////////////////////////////////////////////////////////
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/program_options/environment_iterator.hpp>
///////////////////////////////////////////////////////////
#include "boost/cgi/fcgi.hpp"
-using namespace std;
+//using namespace std;
+using std::cerr;
+using std::endl;
using namespace boost::fcgi;
-// This is a file to put internal logging info into
-#define LOG_FILE "/var/www/log/fcgi_echo.txt"
-
// The styling information for the page, just to make things look nicer.
static const char* gCSS_text =
"body { padding: 0; margin: 3%; border-color: #efe; }"
-".var_map_title"
+"ul.data-map .title"
"{ font-weight: bold; font-size: large; }"
-".var_map"
+"ul.data-map"
"{ border: 1px dotted; padding: 2px 3px 2px 3px; margin-bottom: 3%; }"
-".var_pair"
+"ul.data-map li"
"{ border-top: 1px dotted; overflow: auto; padding: 0; margin: 0; }"
-".var_name"
+"ul.data-map div.name"
"{ position: relative; float: left; width: 30%; font-weight: bold; }"
-".var_value"
+"ul.data-map div.value"
"{ position: relative; float: left; width: 65%; left: 1%;"
" border-left: 1px solid; padding: 0 5px 0 5px;"
" overflow: auto; white-space: pre; }"
+".clear"
+ "{ clear: both; }"
;
//
// This function writes the title and map contents to the ostream in an
// HTML-encoded format (to make them easier on the eye).
//
-template<typename OStreamT, typename MapT>
-void format_map(OStreamT& os, MapT& m, const std::string& title)
+template<typename OStream, typename Request, typename Map>
+void format_map(OStream& os, Request& req, Map& m, const std::string& title)
{
- os<< "<div class=\"var_map\">"
- "<div class=\"var_map_title\">"
+ os<< "<ul class=\"data-map\">"
+ "<div class=\"title\">"
<< title
<< "</div>";
if (m.empty())
- os<< "<div class=\"var_pair\">EMPTY</div>";
+ os<< "<li>EMPTY</li>";
else
- for (typename MapT::const_iterator i = m.begin(); i != m.end(); ++i)
+ for (typename Map::const_iterator i = m.begin(); i != m.end(); ++i)
{
- os<< "<div class=\"var_pair\">"
- "<div class=\"var_name\">"
+ os<< "<li>"
+ "<div class=\"name\">"
<< i->first
<< "</div>"
- "<div class=\"var_value\">"
+ "<div class=\"value\">"
<< i->second
<< "</div>"
- "</div>";
+ "</li>";
}
- os<< "</div>";
+ os<< "<div class=\"clear\"></div></ul>";
}
std::size_t process_id()
@@ -82,16 +85,14 @@
}
-/// This function accepts and handles a single request.
-template<typename Request>
-int handle_request(Request& req)
+int handle_request(request& req)
{
boost::system::error_code ec;
//
// 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).
@@ -115,13 +116,14 @@
"<head>"
"<body>"
"Request ID = " << req.id() << "<br />"
+ "Request Hash = " << req.hash() << "<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,49 +135,42 @@
// 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, req.env, "Environment Variables");
+ format_map(resp, req, req.get, "GET Variables");
+ format_map(resp, req, req.post, "POST Variables");
+ format_map(resp, req, req.uploads, "File Uploads");
+ format_map(resp, req, req.cookies, "Cookie Variables");
- // Print the complete buffer containing the POST data and the FastCGI params.
+ // Print the buffer containing the POST data and the FastCGI params.
resp<< "<pre>";
- BOOST_FOREACH(char& ch, req.post_buffer())
- {
- resp<< ch;
- }
- // << req.get_buffer()
+ resp<< std::string(req.post_buffer().begin(), req.post_buffer().end());
resp<< "</pre>";
//
// Response headers can be added at any time before send/flushing it:
//
resp<< "Response content-length == "
- << resp.content_length() // the content-length (returns std::size_t)
- << content_length(resp); // a content-length header
+ << resp.content_length(); // the content-length (returns std::size_t)
- // This funky macro finishes up:
- return_(resp, req, 0);
- //
- // It is equivalent to the below, where the third argument is represented by
- // `program_status`:
- //
- // resp.send(req.client());
- // req.close(resp.status(), program_status);
- // return program_status;
- //
- // Note: in this case `program_status == 0`.
- //
+ // This function finishes up. The optional third argument
+ // is the program status (default: 0).
+ return commit(req, resp);
}
int main()
{
try {
+ std::cerr<< "*** Ping! ***" << '\n';
// Make a `service` (more about this in other examples).
service s;
+
// Make an `acceptor` for accepting requests through.
+#if defined (BOOST_WINDOWS)
+ acceptor a(s, 8009); // Accept requests on port 8009.
+#else
acceptor a(s);
+#endif // defined (BOOST_WINDOWS)
//
// After the initial setup, we can enter a loop to handle one request at a
@@ -184,40 +179,42 @@
int ret(0);
for (;;)
{
- request req(s);
//
- // Now we enter another loop that reuses the request's memory - makes
- // things more efficient). You should always do this for
- // now; this requirement might be removed in future.
+ // An acceptor can take a request handler as an argument to `accept` and it
+ // will accept a request and pass the handler the request. The return value
+ // of `accept` when used like this is the result of the handler.
//
- for (;;)
- {
- a.accept(req);
- ret = handle_request(req);
- if (ret)
- break;
- //
- // Clear the request's data, so information doesn't pass between
- // different users (this step isn't really necessary, because
- // the library will do this automatically.
- //
- req.clear();
- }
+ // Note that a request handler is any function or function object with the
+ // signature:
+ // boost::function<int (boost::fcgi::request&)>
+ // See the documentation for Boost.Function and Boost.Bind for more.
+ //
+ // The acceptor maintains an internal queue of requests and will reuse a
+ // dead request if one is waiting.
+ //
+ ret = a.accept(&handle_request);
+ if (ret)
+ break;
}
+ std::cerr<< "Processing finished. Press enter to continue..." << std::endl;
+ std::cin.get();
+
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){
+ std::cerr<< "[fcgi] System error: " << se.what() << std::endl;
+ return -1;
+}catch(std::exception const& e){
// Catch any other exceptions
- cerr<< "[fcgi] Exception: " << e->what() << endl;
- return 666;
+ std::cerr<< "[fcgi] Exception: " << e.what() << std::endl;
+ return -2;
}catch(...){
- cerr<< "[fcgi] Uncaught exception!" << endl;
- return 667;
+ std::cerr<< "[fcgi] Uncaught exception!" << std::endl;
+ return -3;
}
+ std::cerr<< "Press enter to continue." << std::endl;
+ std::cin.get();
}
//]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/hello_world/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -13,7 +13,6 @@
//
#include <boost/cgi/fcgi.hpp>
-#include <boost/cgi.hpp>
using namespace std;
using namespace boost::fcgi;
@@ -23,51 +22,78 @@
{
// This is a minimal response. The content_type(...) may go before or after
// the response text.
+ req.load(parse_env);
resp<< content_type("text/plain")
+ << header("X-Protocol", "FastCGI")
<< "Hello there, universe.";
- return_(resp, req, 0);
+ return commit(req, resp, 0);
}
-int main()
-{
-try
+
+//
+template<typename OStreamT, typename MapT>
+void show_map_contents(OStreamT& os, MapT& m, const std::string& title)
{
- service s; // This becomes useful with async operations.
- acceptor a(s); // The acceptor is for accepting requests
+ 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 (;;)
+
+ //for(long i=1000000000; i != 0; --i)
+ //{
+ // std::sqrt(1236.456L); // waste time
+ //}
+
+ try
{
- request req(s); // Our request (reusing this when possible saves expensive
- // construction/destruction of the request's memory).
-
- for (;;) // Handle requests until something goes wrong
- // (an exception will be thrown).
+ service s; // This becomes useful with async operations.
+#if defined (BOOST_WINDOWS)
+ // On Windows, set up an external server to listen on port 8008.
+ // You will need to set your HTTP server to use port 8008.
+ acceptor a(s, 8008);
+#else
+ // On Linux, you can do the above, or just accept on the default
+ // socket. This means setup of your HTTP server is simpler and
+ // FastCGI processes can be started automatically by your server.
+ acceptor a(s);
+#endif // defined (BOOST_WINDOWS)
+
+ for (;;)
{
- a.accept(req);
- response resp; // Use the response class to make our lives easier.
- ret = handle_request(req, resp); // The class defined above.
- if (ret) break; // Use a new request if something went wrong.
+ // Reusing a request object when possible saves repeated
+ // construction/destruction of the request's memory.
+ request req(s);
+
+ for (;;) // Handle requests until something goes wrong
+ // (an exception will be thrown).
+ {
+ a.accept(req);
+ response resp; // Use the response class to make our lives easier.
+ ret = handle_request(req, resp); // The class defined above.
+ if (ret) break; // Use a new request if something went wrong.
+ }
+ if (!a.is_open()) break; // Quit completely if the acceptor bails out.
}
- if (!a.is_open()) break; // Quit completely if the acceptor bails out.
+ }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;
}
-// This library throws only this type of exception (see Boost.System documentation).
-catch(boost::system::system_error& err)
-{
- std::cerr<< "System error " << err.code() << ": "
- << err.what() << std::endl;
- return 1;
-}
-catch(...)
-{
- std::cerr<< "Unknown error!" << std::endl;
- return 2;
-}
-}
//]
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -20,6 +20,7 @@
// This is very similar to the fcgi_echo example.
//
+#include <iostream>
#include "boost/cgi/fcgi.hpp"
#include "./server.hpp"
@@ -53,25 +54,16 @@
<< "Hello there, universe!<p />";
// Use the function defined above to show some of the request data.
- format_map(resp, req[env_data], "Environment Variables");
- format_map(resp, req[get_data], "GET Variables");
- format_map(resp, req[cookie_data], "Cookie Variables");
+ format_map(resp, req.env, "Environment Variables");
+ format_map(resp, req.get, "GET Variables");
+ format_map(resp, req.cookies, "Cookie Variables");
// Response headers can be added at any time before send/flushing it:
resp<< "<h3>Response Length</h3>" << resp.content_length()
// response::content_length() returns the length of the *body*
// of the response (ie. not including the headers).
<< content_length(resp);
- // This funky macro finishes up:
- return_(resp, req, 0);
- // It is equivalent to the below, where the third argument is represented by
- // `program_status`:
- //
- // resp.send(req.client());
- // req.close(resp.status(), program_status);
- // return program_status;
- //
- // Note: in this case `program_status == 0`.
+ return commit(req, resp);
}
///////////////////////////////////////////////////////////
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/server.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/server.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server1/server.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -59,14 +59,14 @@
}
// Load in the request data so we can access it easily.
- new_request->load(ec, true); // The 'true' means read and parse POST data.
+ // Read and parse POST data.
+ new_request->load(boost::fcgi::parse_post, ec);
- // Call the request handler and capture the result of handling the request.
+ // Call the request handler and capture the result of handling
+ // the request.
ret = handler_(*new_request, ec);
// A non-zero return value indicates an error.
- // Note: bailing out here isn't strictly necessary, but easier and safer,
- // given the current state of the library.
if (ret)
break;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server2/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -65,22 +65,13 @@
<< "Hello there, universe!<p />";
// Use the function defined above to show some of the request data.
- format_map(resp, req[env_data], "Environment Variables");
- format_map(resp, req[get_data], "GET Variables");
- format_map(resp, req[cookie_data], "Cookie Variables");
+ format_map(resp, req.env, "Environment Variables");
+ format_map(resp, req.get, "GET Variables");
+ format_map(resp, req.cookies, "Cookie Variables");
//log_<< "Handled request, handling another." << std::endl;
- // This funky macro finishes up:
- return_(resp, req, 0);
- // It is equivalent to the below, where the third argument is represented by
- // `program_status`:
- //
- // resp.send(req.client());
- // req.close(resp.status(), program_status);
- // return program_status;
- //
- // Note: in this case `program_status == 0`.
+ return commit(req, resp);
}
@@ -134,16 +125,16 @@
);
}
- void handle_accept(request_type::pointer req
+ int handle_accept(request_type::pointer req
, boost::system::error_code ec)
{
if (ec)
{
//std::cerr<< "Error accepting request: " << ec.message() << std::endl;
- return;
+ return -1;
}
- req->load(ec, true);
+ req->load(parse_all, ec);
//req->async_load(boost::bind(&server::handle_request, this
// , req, boost::asio::placeholders::error)
@@ -157,13 +148,14 @@
requests_.insert(new_request);
start_accept(new_request);
+ return 0;
}
void handle_request(request_type::pointer req
, boost::system::error_code ec)
{
- handler_(*req, ec);
- if (ec)
+
+ if (handler_(*req, ec) || ec)
{
//std::cerr<< "Request handled, but ended in error: " << ec.message()
// << std::endl;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/main.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/main.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/fcgi/server3/main.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -50,16 +50,7 @@
//log_<< "Handled request, handling another." << std::endl;
- // This funky macro finishes up:
- return_(resp, req, 0);
- // It is equivalent to the below, where the third argument is represented by
- // `program_status`:
- //
- // resp.send(req.client());
- // req.close(resp.status(), program_status);
- // return program_status;
- //
- // Note: in this case `program_status == 0`.
+ return commit(req, resp);
}
/// The server is used to abstract away protocol-specific setup of requests.
@@ -107,7 +98,7 @@
}
// Load in the request data so we can access it easily.
- new_request->load(ec, true); // The 'true' means read and parse POST data.
+ new_request->load(parse_all, ec); // Read and parse POST data and cookies.
ret = handler_(*new_request, ec);
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/example/xcgi/server1/Server.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/example/xcgi/server1/Server.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/example/xcgi/server1/Server.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,8 @@
#define BOOST_CGI_EXAMPLES_XCGI_SERVER2_SERVER_HPP_INCLUDED_
//[xcgi_server1_server
-#include <boost/cgi.hpp>
+#include <boost/cgi/cgi.hpp>
+#include <boost/cgi/fcgi.hpp>
class Server
{
@@ -24,11 +25,8 @@
template<typename Handler>
int handle_cgi_request(Handler handler)
{
- // **FIXME**
- // Uses acgi - would be better if boost::cgi::request was asynchronous.
- boost::acgi::service srv;
- boost::acgi::request req(srv);
- boost::acgi::response resp;
+ boost::cgi::request req;
+ boost::cgi::response resp;
return handler(req, resp);
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/src/library_sources.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/src/library_sources.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/src/library_sources.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -8,8 +8,8 @@
* eg.
* libs/cgi/build$ bjam --build-cgi (builds the library)
*
- * libs/cgi/example$ bjam --build-cgi install
- *
+ * libs/cgi/example$ bjam --build-cgi install
+ *
* (builds and installs all the examples using the compiled binary
* - which will be installed if necessary - see the docs for more)
*
@@ -33,4 +33,3 @@
//#include <boost/cgi/impl/response.ipp>
#include <boost/cgi/impl/fcgi_request_service.ipp>
#include <boost/cgi/detail/url_decode.ipp>
-
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/Jamfile.v2 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -44,12 +44,10 @@
[ compile shareable_tcp_connection.cpp ]
# services
- [ compile acgi_service.cpp ]
[ compile fcgi_service.cpp ]
# requests
[ compile cgi_request.cpp ]
- [ compile acgi_request.cpp ]
[ compile fcgi_request.cpp ]
# response
@@ -61,7 +59,6 @@
# misc tests
[ compile cgi_header_check.cpp ]
- [ compile is_async_test.cpp ]
:
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE=1
<toolset>msvc:<define>_CRT_NONSTDC_NO_DEPRECATE=1
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/async_stdio_connection.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/async_stdio_connection.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/async_stdio_connection.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,8 +2,8 @@
int main()
{
- cgi::common::io_service ios;
- cgi::common::async_stdio_connection conn(ios);
+ boost::cgi::common::io_service ios;
+ boost::cgi::connections::async_stdio conn(ios);
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_header_check.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_header_check.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_header_check.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,7 @@
int main()
{
- cgi::cgi_request req;
+ boost::cgi::request req;
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_request.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_request.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_request.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,7 @@
int main()
{
- cgi::request req;
+ boost::cgi::request req;
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_service.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_service.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/cgi_service.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,7 @@
int main()
{
- cgi::acgi::service s;
+ boost::acgi::service s;
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_acceptor.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_acceptor.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_acceptor.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,8 +2,8 @@
int main()
{
- cgi::fcgi::service s;
- cgi::fcgi::acceptor a(s);
+ boost::fcgi::service s;
+ boost::fcgi::acceptor a(s);
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_request.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_request.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_request.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,8 +2,8 @@
int main()
{
- cgi::fcgi::service s;
- cgi::fcgi::request req(s);
+ boost::fcgi::service s;
+ boost::fcgi::request req(s);
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_service.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_service.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/fcgi_service.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,7 @@
int main()
{
- cgi::fcgi::service s;
+ boost::fcgi::service s;
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/response.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/response.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/response.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,7 @@
int main(int, char**)
{
- cgi::common::response resp;
+ boost::cgi::common::response resp;
resp<< "blah";
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_acceptor.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_acceptor.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_acceptor.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -3,8 +3,8 @@
int main()
{
- cgi::scgi::service s;
- cgi::scgi::acceptor a(s);
+ boost::scgi::service s;
+ boost::scgi::acceptor a(s);
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_request.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_request.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_request.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -3,8 +3,8 @@
int main()
{
- cgi::scgi::service s;
- cgi::scgi::request r(s);
+ boost::scgi::service s;
+ boost::scgi::request r(s);
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_service.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_service.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/scgi_service.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,7 @@
int main()
{
- cgi::scgi::service s;
+ boost::scgi::service s;
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/shareable_tcp_connection.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/shareable_tcp_connection.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/shareable_tcp_connection.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,8 +2,8 @@
int main()
{
- cgi::common::io_service ios;
- cgi::common::connection::shareable_tcp conn(ios);
+ boost::cgi::common::io_service ios;
+ boost::cgi::connections::shareable_tcp conn(ios);
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/stdio_connection.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/stdio_connection.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/stdio_connection.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,7 +2,7 @@
int main()
{
- cgi::common::connection::stdio conn;
+ boost::cgi::connections::stdio conn;
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/tcp_connection.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/tcp_connection.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/compile/tcp_connection.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,8 +2,8 @@
int main()
{
- cgi::common::io_service ios;
- cgi::common::connection::tcp conn(ios);
+ boost::cgi::common::io_service ios;
+ boost::cgi::connections::tcp conn(ios);
return 0;
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2 (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/Jamfile.v2 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -7,8 +7,9 @@
: requirements
<library>/boost/test//boost_unit_test_framework/
<library>/boost/system/
- <library>/boost/thread/
- <library>/boost/regex/
+ <linkflags>-pthread
+ #<library>/boost/thread/
+ #<library>/boost/regex/
;
#local rule run-test( name )
@@ -25,10 +26,10 @@
[ run cookie.cpp ]
[ run response.cpp ]
[ run cgi_simple_request.cpp ]
- [ run acgi_simple_request.cpp ]
[ run name_test.cpp ]
[ run map_test.cpp ]
[ run parse_options.cpp ]
+ #[ run has_key.cpp ]
;
test-suite wget_test
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/acgi_simple_request.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/acgi_simple_request.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/acgi_simple_request.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -34,7 +34,7 @@
using namespace boost::acgi;
service s;
- request req(s, true);
+ request req(s, parse_all);
TEST_ENV_DATA(req);
}
@@ -43,7 +43,7 @@
{
using namespace boost::acgi;
service s;
- request req(s, true);
+ request req(s, parse_all);
TEST_GET_DATA(req);
}
@@ -54,7 +54,7 @@
{
service s;
- request req(s, true);
+ request req(s, parse_all);
TEST_ONE_COOKIE(req);
}
@@ -63,7 +63,7 @@
setenv("HTTP_COOKIE", "foo=bar;another_one=stuff", 1);
service s;
- request req(s, true);
+ request req(s, parse_all);
TEST_TWO_COOKIES(req);
}
@@ -72,7 +72,7 @@
setenv("HTTP_COOKIE", "foo=bar; encoded=%22%C2%A3$%^$*^hh%%thd@:", 1);
service s;
- request req(s, true);
+ request req(s, parse_all);
TEST_ENCODED_COOKIE(req);
}
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/cookie.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/cookie.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/cookie.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -17,8 +17,8 @@
// Constructing a cookie with only a name should be a valid way to
// delete the cookie. ie. set its value to NULL and give it a date
// in the past
- using namespace cgi;
- using cgi::common::cookie;
+ using namespace boost::cgi;
+ using boost::cgi::common::cookie;
using namespace std;
string ex("Fri, 05-Jun-1989 15:30:00 GMT");
@@ -38,8 +38,8 @@
BOOST_AUTO_TEST_CASE( cookie_constructor_full )
{
// Check the full version of the constructor works (simple test)
- using namespace cgi;
- using cgi::common::cookie;
+ using namespace boost::cgi;
+ using boost::cgi::common::cookie;
using namespace std;
string ex("Wed, 03-Oct-2007 16:26:06 GMT");
@@ -63,8 +63,8 @@
// Constructing a cookie with only a name should be a valid way to
// delete the cookie. ie. set its value to NULL and give it a date
// in the past
- using namespace cgi;
- using cgi::common::cookie;
+ using namespace boost::cgi;
+ using boost::cgi::common::cookie;
using namespace std;
string cookie_content(
@@ -96,3 +96,4 @@
string ostr(oss.str());
BOOST_CHECK_EQUAL(ostr, cookie_content);
}
+
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/map_test.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/map_test.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/map_test.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -7,7 +7,7 @@
BOOST_AUTO_TEST_CASE( map_test )
{
- cgi::common::map m;
+ boost::cgi::common::map m;
/// First check that upper case compares with lower case.
m["foo"] = "bar";
@@ -18,4 +18,7 @@
m["FATFOO"] = "minibar";
BOOST_CHECK_EQUAL( m["FATFOO"], "minibar" );
BOOST_CHECK_EQUAL( m["fatfoo"], "minibar" );
+
+ // Sanity check.
+ BOOST_CHECK_NOT_EQUAL( m["nonfoo"], "dfpij" );
}
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/name_test.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/name_test.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/name_test.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -5,7 +5,7 @@
#define BOOST_TEST_MODULE name_test_suite
#include <boost/test/unit_test.hpp>
-using cgi::common::name;
+using boost::cgi::common::name;
BOOST_AUTO_TEST_CASE( case_insensitive_cmp )
{
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/parse_options.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/parse_options.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/parse_options.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -5,7 +5,7 @@
BOOST_AUTO_TEST_CASE( test_parse_options )
{
- using namespace cgi::common;
+ using namespace boost::cgi::common;
{
parse_options opt = parse_env;
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/request_test_template.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/request_test_template.hpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/request_test_template.hpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -2,16 +2,16 @@
#define TEST_ENV_DATA(req) \
\
/* Check environment parsing */ \
- BOOST_CHECK( req[env_data].size() ); \
- BOOST_CHECK_EQUAL( req[env]["HTTP_HOST"], "localhost" ); \
- BOOST_CHECK_EQUAL( req[env]["EMPTY_VAR"], "" ); \
- BOOST_CHECK_EQUAL( req[env]["UGLY_VAR"], "$££$^%%£&&^%@%26$ £_abcd" ); \
- BOOST_CHECK_EQUAL( req[env]["QUERY_STRING"] \
+ BOOST_CHECK( req.env.size() ); \
+ BOOST_CHECK_EQUAL( req.env["HTTP_HOST"], "localhost" ); \
+ BOOST_CHECK_EQUAL( req.env["EMPTY_VAR"], "" ); \
+ BOOST_CHECK_EQUAL( req.env["UGLY_VAR"], "$££$^%%£&&^%@%26$ £_abcd" ); \
+ BOOST_CHECK_EQUAL( req.env["QUERY_STRING"] \
, "hello=world&foo=bar&encoded=%22!%C2%A3$%^$*^hh%%thd@:~" ); \
/* Check case-insensitive name comparing */ \
- BOOST_CHECK_EQUAL( req[env]["http_host"], "localhost" ); \
+ BOOST_CHECK_EQUAL( req.env["http_host"], "localhost" ); \
/* Check helper function (need to test them all?) */ \
- BOOST_CHECK_EQUAL( req.script_name(), "some/test/script" );
+ BOOST_CHECK_EQUAL( req.script_name(), "some/test/script" );
#define TEST_GET_DATA(req) \
@@ -20,34 +20,34 @@
BOOST_CHECK_EQUAL( req.request_method(), "GET" ); \
\
/* Check GET data/query string parsing */ \
- BOOST_CHECK( req[get].size() ); \
- BOOST_CHECK_EQUAL( req[get]["hello"], "world" ); \
- BOOST_CHECK_EQUAL( req[get]["foo"], "bar" ); \
+ BOOST_CHECK( req.get.size() ); \
+ BOOST_CHECK_EQUAL( req.get["hello"], "world" ); \
+ BOOST_CHECK_EQUAL( req.get["foo"], "bar" ); \
/* Case-insensitive check */ \
- BOOST_CHECK_EQUAL( req[get]["FOO"], "bar" ); \
+ BOOST_CHECK_EQUAL( req.get["FOO"], "bar" ); \
/* Value should be case-sensitive */ \
- BOOST_CHECK_NE( req[get]["foo"], "BAR" ); \
+ BOOST_CHECK_NE( req.get["foo"], "BAR" ); \
/* Check url-decoding */ \
- BOOST_CHECK_EQUAL( req[get]["encoded"], "\"!£$%^$*^hh%%thd@:~" );
+ BOOST_CHECK_EQUAL( req.get["encoded"], "\"!£$%^$*^hh%%thd@:~" );
#define TEST_ONE_COOKIE(req) \
\
/* Check cookie parsing */ \
- BOOST_CHECK( req[cookies].size() ); \
- BOOST_CHECK_EQUAL( req[cookies]["foo"], "bar" ); \
- /* Check case-insensitive name comparing */ \
- BOOST_CHECK_EQUAL( req[cookies]["FOO"], "bar" );
+ BOOST_CHECK( req.cookies.size() ); \
+ BOOST_CHECK_EQUAL( req.cookies["foo"], "bar" ); \
+ /* Check case-insensitive name comparison */ \
+ BOOST_CHECK_EQUAL( req.cookies["FOO"], "bar" );
#define TEST_TWO_COOKIES(req) \
\
- BOOST_CHECK_EQUAL( req[cookies]["foo"], "bar" ); \
- BOOST_CHECK_EQUAL( req[cookies]["another_one"], "stuff" );
-
+ BOOST_CHECK_EQUAL( req.cookies["foo"], "bar" ); \
+ BOOST_CHECK_EQUAL( req.cookies["another_one"], "stuff" );
+
#define TEST_ENCODED_COOKIE(req) \
\
- BOOST_CHECK_EQUAL( req[cookies]["foo"], "bar" ); \
- BOOST_CHECK_EQUAL( req[cookies]["encoded"], "\"£$%^$*^hh%%thd@:" );
+ BOOST_CHECK_EQUAL( req.cookies["foo"], "bar" ); \
+ BOOST_CHECK_EQUAL( req.cookies["encoded"], "\"£$%^$*^hh%%thd@:" );
#include <string>
@@ -58,7 +58,7 @@
// MSVC doesn't support setenv, but it does support putenv
void setenv(std::string const& name, std::string const& val, int reset = 0)
{
-
+
//char *envvar = new char["
if (0 != _putenv((name + "=" + val).c_str()))
{
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/response.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/response.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/response.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -52,7 +52,7 @@
BOOST_AUTO_TEST_CASE( response_test )
{
- using namespace cgi::common;
+ using namespace boost::cgi::common;
dummy_request req;
string s ("Hello, world.");
Modified: sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/stdio_connection.cpp
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/stdio_connection.cpp (original)
+++ sandbox/SOC/2007/cgi/trunk/libs/cgi/test/run/stdio_connection.cpp 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -4,7 +4,7 @@
int main()
{
- cgi::common::connection::stdio conn;
+ boost::cgi::common::connections::stdio conn;
boost::system::error_code ec;
Modified: sandbox/SOC/2007/cgi/trunk/project-root.jam
==============================================================================
--- sandbox/SOC/2007/cgi/trunk/project-root.jam (original)
+++ sandbox/SOC/2007/cgi/trunk/project-root.jam 2010-01-31 17:43:15 EST (Sun, 31 Jan 2010)
@@ -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