# pion::net::HTTPReader Class Reference

`#include <HTTPReader.hpp>`

Inherits pion::net::HTTPParser.

Inherited by pion::net::HTTPRequestReader, and pion::net::HTTPResponseReader.

List of all members.

## Detailed Description

HTTPReader: asynchronously reads and parses HTTP messages

Definition at line 28 of file HTTPReader.hpp.

## Public Member Functions

virtual | ~HTTPReader ()
void | receive (void)
| Incrementally reads & parses the HTTP message.
TCPConnectionPtr & | getTCPConnection (void)
| returns a shared pointer to the TCP connection
void | setTimeout (boost::uint32_t seconds)
| sets the maximum number of seconds for read operations

## Protected Member Functions

| HTTPReader (const bool is_request, TCPConnectionPtr &tcp_conn)
void | consumeBytes (const boost::system::error_code &read_error, std::size_t bytes_read)
void | consumeBytes (void)
| Consumes bytes that have been read using an HTTP parser.
virtual void | readBytes (void)=0
| Reads more bytes from the TCP connection.
virtual void | finishedReading (const boost::system::error_code &ec)=0
| Called after we have finished reading/parsing the HTTP message.
virtual HTTPMessage & | getMessage (void)=0
| Returns a reference to the HTTP message being parsed.

## Constructor & Destructor Documentation

pion::net::HTTPReader::HTTPReader | ( | const bool | is_request,
|  | TCPConnectionPtr & | tcp_conn |
| ) |  |  | `[inline, protected]`

protected constructor: only derived classes may create objects

Parameters:

  | is_request | if true, the message is parsed as an HTTP request; if false, the message is parsed as an HTTP response
  | tcp_conn | TCP connection containing a new message to parse

Definition at line 55 of file HTTPReader.hpp.

## Member Function Documentation

void pion::net::HTTPReader::consumeBytes | ( | const boost::system::error_code & | read_error,
|  | std::size_t | bytes_read |
| ) |  |  | `[protected]`

Consumes bytes that have been read using an HTTP parser

Parameters:

  | read_error | error status from the last read operation
  | bytes_read | number of bytes consumed by the last read operation

Definition at line 41 of file HTTPReader.cpp.

References consumeBytes(), pion::net::HTTPParser::isParsingRequest(), pion::net::HTTPParser::m_logger, and pion::net::HTTPParser::setReadBuffer().

The documentation for this class was generated from the following files:

- net/include/pion/net/HTTPReader.hpp
- net/src/HTTPReader.cpp