|
Boost-Commit : |
From: lists.drrngrvy_at_[hidden]
Date: 2007-10-17 16:42:43
Author: drrngrvy
Date: 2007-10-17 16:42:43 EDT (Wed, 17 Oct 2007)
New Revision: 40135
URL: http://svn.boost.org/trac/boost/changeset/40135
Log:
[merging from SF]
* Fixing fcgi/client.hpp and scgi/client.hpp.
* Test (plus adding blank scgi_init.hpp file)
Added:
sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/detail/scgi_init.hpp (contents, props changed)
Text files modified:
sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/header.hpp | 9 +++++++++
sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/acceptor_service_impl.hpp | 18 ++++++++++--------
sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/client.hpp | 18 +++++++++++++-----
3 files changed, 32 insertions(+), 13 deletions(-)
Added: sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/detail/scgi_init.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/detail/scgi_init.hpp 2007-10-17 16:42:43 EDT (Wed, 17 Oct 2007)
@@ -0,0 +1,31 @@
+// -- detail/scgi_init.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_DETAIL_SCGI_INIT_HPP_INCLUDED__
+#define CGI_DETAIL_SCGI_INIT_HPP_INCLUDED__
+
+#include <map>
+#include <string>
+
+namespace cgi {
+ namespace detail {
+
+ /// Setup the process environment for SCGI use
+ /**
+ * Not implemented yet. Basically this will catch OS signals
+ * and make sure a minor problem doesn't crash the whole server.
+ */
+ template<typename T>
+ class scgi_init
+ {
+ };
+
+ } // namespace detail
+} // namespace cgi
+
+#endif // CGI_DETAIL_SCGI_INIT_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/header.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/header.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/header.hpp 2007-10-17 16:42:43 EDT (Wed, 17 Oct 2007)
@@ -20,6 +20,9 @@
{
}
+ /// Templated constructor to allow user-defined types to be converted
+ template<typename T> header(T& t);
+
header(const std::string& name, const std::string& val)
: content(name + ": " + val + "\r\n")
{
@@ -39,6 +42,12 @@
return header("Location", url);
}
+ inline template<>
+ header::header(cookie& ck)
+ : content(ck.to_string())
+ {
+ }
+
} // namespace cgi
#endif // CGI_HEADER_HPP_INCLUDED__
Modified: sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/acceptor_service_impl.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/acceptor_service_impl.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/acceptor_service_impl.hpp 2007-10-17 16:42:43 EDT (Wed, 17 Oct 2007)
@@ -50,20 +50,22 @@
typedef basic_protocol_service<protocol_type> protocol_service_type;
typedef boost::asio::ip::tcp native_protocol_type;
typedef acceptor_service_type::native_type native_type;
- typedef boost::asio::socket_acceptor_service<
- native_protocol_type> acceptor_service_type;
+ typedef implementation_type::acceptor_service_type acceptor_service_type;
/// The unique service identifier
//static boost::asio::io_service::id id;
struct implementation_type
{
- typedef Protocol protocol_type;
- typedef scgi::request request_type;
- acceptor_service_type::implementation_type acceptor_;
- boost::mutex mutex_;
- std::queue<boost::shared_ptr<request_type> > waiting_requests_;
- protocol_service_type* service_;
+ typedef Protocol protocol_type;
+ typedef scgi::request request_type;
+ typedef boost::asio::socket_acceptor_service<
+ native_protocol_type> acceptor_service_type;
+
+ acceptor_service_type::implementation_type acceptor_;
+ boost::mutex mutex_;
+ std::queue<boost::shared_ptr<request_type> > waiting_requests_;
+ protocol_service_type* service_;
};
explicit scgi_request_acceptor_service(cgi::io_service& ios)
Modified: sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/client.hpp
==============================================================================
--- sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/client.hpp (original)
+++ sandbox/SOC/2007/cgi/branches/merge_from_SF_17_oct/boost/cgi/scgi/client.hpp 2007-10-17 16:42:43 EDT (Wed, 17 Oct 2007)
@@ -1,4 +1,4 @@
-// -- fcgi/client.hpp --
+// -- scgi/client.hpp --
//
// Copyright (c) Darren Garvey 2007.
// Distributed under the Boost Software License, Version 1.0.
@@ -6,8 +6,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
//
////////////////////////////////////////////////////////////////
-#ifndef CGI_FCGI_SPECIFICATION_HPP_INCLUDED__
-#define CGI_FCGI_SPECIFICATION_HPP_INCLUDED__
+#ifndef CGI_SCGI_CLIENT_HPP_INCLUDED__
+#define CGI_SCGI_CLIENT_HPP_INCLUDED__
#include "boost/cgi/map.hpp"
#include "boost/cgi/io_service.hpp"
@@ -27,12 +27,20 @@
struct connection_type : Connection
{ typedef boost::shared_ptr<connection_type> pointer; }
+ /// Construct
basic_client(io_service_type& ios)
: io_service_(ios)
, connection_(new connection_type::pointer(ios))
{
}
+ /// Destroy
+ /** Closing the connection as early as possible is good for efficiency */
+ ~basic_client()
+ {
+ connection_->close();
+ }
+
io_service_type& io_service() { return io_service_; }
/// Associate a connection with this client
@@ -93,7 +101,7 @@
connection_ptr connection_;
};
- } // namespace fcgi
+ } // namespace scgi
}// namespace cgi
-#endif // CGI_FCGI_SPECIFICATION_HPP_INCLUDED__
+#endif // CGI_SCGI_CLIENT_HPP_INCLUDED__
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk