You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2008/05/03 05:21:03 UTC
svn commit: r652988 -
/webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp
Author: nadiramra
Date: Fri May 2 20:21:03 2008
New Revision: 652988
URL: http://svn.apache.org/viewvc?rev=652988&view=rev
Log:
AXISCPP-1043 Error handling several HTTP headers in one response
Modified:
webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp
Modified: webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp?rev=652988&r1=652987&r2=652988&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp (original)
+++ webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp Fri May 2 20:21:03 2008
@@ -1306,10 +1306,13 @@
}
while( iPosition != std::string::npos);
- // HTTP protocol allows body with no Content-Length and no transfer-encoding! This
- // means that we read from the stream until we are unable to read anymore. So ensure
- // state is set correctly. In this case we set it to not-chunked.
- if (m_GetBytesState == eWaitingForHTTPHeader)
+ // If 100 Continue is the response header, then we need to ensure we are waiting for
+ // an HTTP header. Otherwise, HTTP protocol allows body with no Content-Length
+ // and no transfer-encoding! This means that we read from the stream until we are unable
+ // to read anymore. So ensure state is set correctly. In this case we set it to not-chunked.
+ if (m_iResponseHTTPStatusCode == 100)
+ m_GetBytesState = eWaitingForHTTPHeader;
+ else if (m_GetBytesState == eWaitingForHTTPHeader)
m_GetBytesState = eSOAPMessageIsNotChunked;
}
@@ -1374,7 +1377,8 @@
/* HTTPTransport::processMimeHeaders() Is a public method used to
* parse the Mime headers of the response message.
*/
-void HTTPTransport::processMimeHeader()
+void HTTPTransport::
+processMimeHeader()
{
string::size_type pos = 0;
string::size_type temppos = 0;
@@ -1647,11 +1651,11 @@
int numberOfBytesRead;
string::size_type iHTTPStart;
string::size_type iHTTPEnd;
-
+
+ resetInputStateMachine();
+
do
{
- resetInputStateMachine();
-
while (m_strReceived.find( ASCII_S_HTTP) == std::string::npos
|| m_strReceived.find( ASCII_S_CRLFCRLF) == std::string::npos)
{
@@ -1679,6 +1683,10 @@
// Process the HTTP header
processHTTPHeader();
+
+ // Remove the HTTP header from the buffer since it has been processed.
+ m_strReceived = m_strReceived.substr( iHTTPEnd + 4);
+ m_iBytesLeft = m_strReceived.length();
}
while( m_iResponseHTTPStatusCode == 100);
@@ -1693,11 +1701,6 @@
m_GetBytesState = eWaitingForHTTPHeader;
throw HTTPTransportException( SERVER_TRANSPORT_HTTP_EXCEPTION, m_strResponseHTTPStatusMessage.c_str());
}
-
- // We are home-free, now is the time to set the HTTP body - i.e. the SOAP message. Note that
- // we could have done this in the loop, but why allocate resources if we do not need to.
- m_strReceived = m_strReceived.substr( iHTTPEnd + 4);
- m_iBytesLeft = m_strReceived.length();
}
int HTTPTransport::
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org