HttpParser.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (c) 2001-2014
00003 **
00004 ** This file is part of the QuickFIX FIX Engine
00005 **
00006 ** This file may be distributed under the terms of the quickfixengine.org
00007 ** license as defined by quickfixengine.org and appearing in the file
00008 ** LICENSE included in the packaging of this file.
00009 **
00010 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00011 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00012 **
00013 ** See http://www.quickfixengine.org/LICENSE for licensing information.
00014 **
00015 ** Contact ask@quickfixengine.org if any conditions of this licensing are
00016 ** not clear to you.
00017 **
00018 ****************************************************************************/
00019 
00020 #ifdef _MSC_VER
00021 #include "stdafx.h"
00022 #else
00023 #include "config.h"
00024 #endif
00025 
00026 #include "HttpParser.h"
00027 #include "Utility.h"
00028 #include <algorithm>
00029 
00030 namespace FIX
00031 {
00032 bool HttpParser::readHttpMessage( std::string& str )
00033 throw( MessageParseError )
00034 {
00035   std::string::size_type pos = 0;
00036 
00037   if( m_buffer.length() < 4 ) 
00038     return false;
00039   pos = m_buffer.find( "\r\n\r\n" );
00040   if( m_buffer.length() > 2048 )
00041     throw MessageParseError();
00042   if( pos == std::string::npos ) 
00043     return false;
00044   str.assign( m_buffer, 0, pos + 4 );
00045   m_buffer.erase( 0, pos + 4 );
00046 
00047   return true;
00048 }
00049 }

Generated on Mon Jun 23 2014 23:49:38 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001