Esempio n. 1
0
TProtocolState::Type Http::TCommonProtocol::Decode(TStreamBuffer& Buffer)
{
	//	read next header
	while ( !mHeadersComplete )
	{
		std::string Header;
		if ( !Buffer.Pop("\r\n", Header, false ) )
			return TProtocolState::Waiting;
		
		//	parse header
		PushHeader( Header );
	}
	
	//	read data
	if ( mContentLength == 0 )
		return TProtocolState::Finished;
	
	if ( !Buffer.Pop( mContentLength, GetArrayBridge(mContent) ) )
		return TProtocolState::Waiting;
	
	if ( !mKeepAlive )
		return TProtocolState::Disconnect;
	
	return TProtocolState::Finished;
}
Esempio n. 2
0
	bool XMLPrinter::VisitEnter( const XMLDocument& doc )
	{
		_processEntities = doc.ProcessEntities();
		if ( doc.HasBOM() ) {
			PushHeader( true, false );
		}
		return true;
	}