10 #ifndef __PION_HTTP_REQUEST_READER_HEADER__ 11 #define __PION_HTTP_REQUEST_READER_HEADER__ 13 #include <boost/asio.hpp> 14 #include <boost/bind.hpp> 15 #include <boost/function.hpp> 16 #include <boost/function/function2.hpp> 17 #include <boost/shared_ptr.hpp> 18 #include <boost/enable_shared_from_this.hpp> 19 #include <pion/config.hpp> 20 #include <pion/http/request.hpp> 21 #include <pion/http/reader.hpp> 33 public boost::enable_shared_from_this<request_reader>
39 typedef boost::function3<void, http::request_ptr, tcp::connection_ptr,
52 static inline boost::shared_ptr<request_reader>
53 create(
const tcp::connection_ptr& tcp_conn, finished_handler_t handler)
55 return boost::shared_ptr<request_reader>
71 request_reader(
const tcp::connection_ptr& tcp_conn, finished_handler_t handler)
75 m_http_msg->set_remote_ip(tcp_conn->get_remote_ip());
76 set_logger(PION_GET_LOGGER(
"pion.http.request_reader"));
83 boost::asio::placeholders::error,
84 boost::asio::placeholders::bytes_transferred));
114 typedef boost::shared_ptr<request_reader> request_reader_ptr;
void consume_bytes(void)
Consumes bytes that have been read using an HTTP parser.
virtual http::message & get_message(void)
Returns a reference to the HTTP message being parsed.
virtual void finished_parsing_headers(const boost::system::error_code &ec)
Called after we have finished parsing the HTTP message headers.
finished_handler_t m_finished
function called after the HTTP message has been parsed
static boost::shared_ptr< request_reader > create(const tcp::connection_ptr &tcp_conn, finished_handler_t handler)
http::request_ptr m_http_msg
The new HTTP message container being created.
tcp::connection_ptr & get_connection(void)
returns a shared pointer to the TCP connection
virtual void read_bytes(void)
Reads more bytes from the TCP connection.
boost::function3< void, http::request_ptr, tcp::connection_ptr, const boost::system::error_code & > finished_handler_t
function called after the HTTP message has been parsed
virtual void finished_reading(const boost::system::error_code &ec)
Called after we have finished reading/parsing the HTTP message.
void set_headers_parsed_callback(finished_handler_t &h)
sets a function to be called after HTTP headers have been parsed
finished_handler_t m_parsed_headers
function called after the HTTP message headers have been parsed
void set_logger(logger log_ptr)
sets the logger to be used
request_reader(const tcp::connection_ptr &tcp_conn, finished_handler_t handler)