FIX::HttpParser Class Reference

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

## Detailed Description

Parses HTTP messages off an input stream.

Definition at line 36 of file HttpParser.h.

## Constructor & Destructor Documentation

## HttpParser()

FIX::HttpParser::HttpParser | ( |  | ) |

inline

Definition at line 39 of file HttpParser.h.

{}

## ~HttpParser()

FIX::HttpParser::~HttpParser | ( |  | ) |

inline

Definition at line 40 of file HttpParser.h.

{}

## Member Function Documentation

## addToStream() [1/2]

void FIX::HttpParser::addToStream | ( | const char * | str,
|  | size_t | len
| ) |  |

inline

Definition at line 45 of file HttpParser.h.

{ m_buffer.append( str, len ); }
FIX::HttpParser::m_buffer
std::string m_buffer
Definition: HttpParser.h:51

References m_buffer.

Referenced by FIX::HttpConnection::read().

## addToStream() [2/2]

void FIX::HttpParser::addToStream | ( | const std::string & | str | ) |

inline

Definition at line 47 of file HttpParser.h.

{ m_buffer.append( str ); }

References m_buffer.

## readHttpMessage()

bool FIX::HttpParser::readHttpMessage | ( | std::string & | str | ) |
throw | ( | MessageParseError
| ) |  |

Definition at line 32 of file HttpParser.cpp.

{
std::string::size_type pos = 0;
if( m_buffer.length() < 4 )
return false;
pos = m_buffer.find( "\r\n\r\n" );
if( m_buffer.length() > 2048 )
throw MessageParseError();
if( pos == std::string::npos )
return false;
str.assign( m_buffer, 0, pos + 4 );
m_buffer.erase( 0, pos + 4 );
return true;
}

## Member Data Documentation

## m_buffer

std::string FIX::HttpParser::m_buffer

private

Definition at line 51 of file HttpParser.h.

Referenced by addToStream().

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

- HttpParser.h
- HttpParser.cpp