![]() |
Parses HTTP messages off an input stream. More...
#include <HttpParser.h>
Public Member Functions | |
HttpParser () | |
~HttpParser () | |
bool | readHttpMessage (std::string &str) throw ( MessageParseError ) |
void | addToStream (const char *str, size_t len) |
void | addToStream (const std::string &str) |
Private Attributes | |
std::string | m_buffer |
int | m_bufferSize |
Parses HTTP messages off an input stream.
Definition at line 36 of file HttpParser.h.
FIX::HttpParser::HttpParser | ( | ) | [inline] |
Definition at line 39 of file HttpParser.h.
00040 : m_bufferSize( 0 ) {}
FIX::HttpParser::~HttpParser | ( | ) | [inline] |
Definition at line 41 of file HttpParser.h.
void FIX::HttpParser::addToStream | ( | const std::string & | str | ) | [inline] |
void FIX::HttpParser::addToStream | ( | const char * | str, | |
size_t | len | |||
) | [inline] |
Definition at line 46 of file HttpParser.h.
References m_buffer.
Referenced by FIX::HttpConnection::read().
00047 { m_buffer.append( str, len ); }
bool FIX::HttpParser::readHttpMessage | ( | std::string & | str | ) | throw ( MessageParseError ) |
Definition at line 33 of file HttpParser.cpp.
References QF_STACK_POP, and QF_STACK_PUSH.
00035 { QF_STACK_PUSH(HttpParser::readFixMessage) 00036 00037 std::string::size_type pos = 0; 00038 00039 if( m_buffer.length() < 4 ) 00040 return false; 00041 pos = m_buffer.find( "\r\n\r\n" ); 00042 if( m_buffer.length() > 2048 ) 00043 throw MessageParseError(); 00044 if( pos == std::string::npos ) 00045 return false; 00046 str = m_buffer.substr( 0, pos + 4 ); 00047 m_buffer.erase( 0, pos + 4 ); 00048 00049 return true; 00050 00051 QF_STACK_POP 00052 }
std::string FIX::HttpParser::m_buffer [private] |
Definition at line 52 of file HttpParser.h.
Referenced by addToStream().
int FIX::HttpParser::m_bufferSize [private] |
Definition at line 53 of file HttpParser.h.