Public Member Functions | Private Attributes
FIX::HttpParser Class Reference

Parses HTTP messages off an input stream. More...

#include <HttpParser.h>

List of all members.

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

Definition at line 39 of file HttpParser.h.

{}

Definition at line 40 of file HttpParser.h.

{}

Member Function Documentation

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().

  { m_buffer.append( str, len ); }
void FIX::HttpParser::addToStream ( const std::string &  str) [inline]

Definition at line 47 of file HttpParser.h.

References m_buffer.

  { m_buffer.append( str ); }
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

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 Mon Jun 23 2014 23:49:39 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001