HttpParser.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (c) 2001-2014
3 **
4 ** This file is part of the QuickFIX FIX Engine
5 **
6 ** This file may be distributed under the terms of the quickfixengine.org
7 ** license as defined by quickfixengine.org and appearing in the file
8 ** LICENSE included in the packaging of this file.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 ** See http://www.quickfixengine.org/LICENSE for licensing information.
14 **
15 ** Contact ask@quickfixengine.org if any conditions of this licensing are
16 ** not clear to you.
17 **
18 ****************************************************************************/
19 
20 #ifdef _MSC_VER
21 #include "stdafx.h"
22 #else
23 #include "config.h"
24 #endif
25 
26 #include "HttpParser.h"
27 #include "Utility.h"
28 #include <algorithm>
29 
30 namespace FIX
31 {
32 bool HttpParser::readHttpMessage( std::string& str )
33 throw( MessageParseError )
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 }
49 }
FIX::HttpParser::readHttpMessage
bool readHttpMessage(std::string &str)
Definition: HttpParser.cpp:49
HttpParser.h
FIX
Definition: Acceptor.cpp:34
Utility.h

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001