3 #include <boost/bind.hpp> 4 #include <boost/make_shared.hpp> 11 : strand_(io_service), socket_(io_service), request_handler_(handler),
12 write_in_progress_(false)
29 boost::tribool result;
30 const char* parse_end;
50 request_, shared_from_this(), begin, end);
60 const boost::system::error_code& e,
61 std::size_t bytes_transferred)
76 boost::throw_exception(boost::system::system_error(
last_error_));
82 callback, boost::asio::placeholders::error,
83 boost::asio::placeholders::bytes_transferred)));
88 boost::shared_ptr<std::vector<unsigned char>> buffer(
89 new std::vector<unsigned char>());
91 write(boost::asio::buffer(*buffer), buffer);
96 boost::shared_ptr<std::string> str(
new std::string(content));
97 write(boost::asio::buffer(*str), str);
112 const std::vector<boost::asio::const_buffer>& buffers,
ResourcePtr resource)
128 boost::throw_exception(boost::system::system_error(
last_error_));
134 boost::asio::placeholders::error,
141 std::vector<ResourcePtr> resources)
void handle_read_raw(ReadHandler callback, const boost::system::error_code &e, std::size_t bytes_transferred)
boost::array< char, 8192 > buffer_
boost::mutex write_mutex_
boost::asio::ip::tcp::socket socket_
void write(const std::string &)
HttpServerRequestHandler request_handler_
HttpConnection(boost::asio::io_service &io_service, HttpServerRequestHandler request_handler)
void async_read(ReadHandler callback)
std::vector< boost::asio::const_buffer > pending_write_buffers_
boost::system::error_code last_error_
boost::function< void(const char *begin, const char *end)> ReadHandler
boost::asio::io_service::strand strand_
void handle_write(const boost::system::error_code &e, std::vector< ResourcePtr > resources)
std::vector< ResourcePtr > pending_write_resources_
void write_and_clear(std::vector< unsigned char > &data)
HttpRequestParser request_parser_
boost::function< bool(const HttpRequest &, boost::shared_ptr< HttpConnection >, const char *begin, const char *end)> HttpServerRequestHandler
static HttpServerRequestHandler stock_reply(status_type status)
void handle_read(const char *begin, const char *end)
boost::asio::ip::tcp::socket & socket()
boost::shared_ptr< const void > ResourcePtr
boost::tuple< boost::tribool, InputIterator > parse(HttpRequest &req, InputIterator begin, InputIterator end)