Public Member Functions | Private Attributes | List of all members
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.

39 {}

◆ ~HttpParser()

FIX::HttpParser::~HttpParser ( )
inline

Definition at line 40 of file HttpParser.h.

References readHttpMessage().

40 {}

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.

References m_buffer.

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

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

◆ addToStream() [2/2]

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

Definition at line 47 of file HttpParser.h.

References m_buffer.

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

◆ readHttpMessage()

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

Definition at line 32 of file HttpParser.cpp.

Referenced by FIX::HttpConnection::readMessage(), and ~HttpParser().

34 {
35  std::string::size_type pos = 0;
36 
37  if( m_buffer.length() < 4 )
38  return false;
39  pos = m_buffer.find( "\r\n\r\n" );
40  if( m_buffer.length() > 2048 )
41  throw MessageParseError();
42  if( pos == std::string::npos )
43  return false;
44  str.assign( m_buffer, 0, pos + 4 );
45  m_buffer.erase( 0, pos + 4 );
46 
47  return true;
48 }
std::string m_buffer
Definition: HttpParser.h:51

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:

Generated on Wed Aug 28 2019 14:13:46 for QuickFIX by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2001