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
30namespace FIX
31{
32bool HttpParser::readHttpMessage( std::string& str )
33throw( 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}
bool readHttpMessage(std::string &str)
Unable to parse message.
Definition Exceptions.h:74

Generated on Mon Mar 4 2024 21:10:02 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001