HttpParser.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifdef _MSC_VER
00021 #include "stdafx.h"
00022 #else
00023 #include "config.h"
00024 #endif
00025 #include "CallStack.h"
00026
00027 #include "HttpParser.h"
00028 #include "Utility.h"
00029 #include <algorithm>
00030
00031 namespace FIX
00032 {
00033 bool HttpParser::readHttpMessage( std::string& str )
00034 throw( MessageParseError )
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 }
00053 }