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 2006/11/28 17:59:40 UTC
svn commit: r480128 - in /webservices/axis/trunk/c/src/transport/axis3:
HTTPChannel/HTTPChannel.cpp HTTPSSLChannel/HTTPSSLChannel.cpp
HTTPTransport.cpp
Author: nadiramra
Date: Tue Nov 28 08:59:39 2006
New Revision: 480128
URL: http://svn.apache.org/viewvc?view=rev&rev=480128
Log:
Put back in the counter and do not throw exception on read of 0-length.
will revisit later.
Modified:
webservices/axis/trunk/c/src/transport/axis3/HTTPChannel/HTTPChannel.cpp
webservices/axis/trunk/c/src/transport/axis3/HTTPSSLChannel/HTTPSSLChannel.cpp
webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp
Modified: webservices/axis/trunk/c/src/transport/axis3/HTTPChannel/HTTPChannel.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/transport/axis3/HTTPChannel/HTTPChannel.cpp?view=diff&rev=480128&r1=480127&r2=480128
==============================================================================
--- webservices/axis/trunk/c/src/transport/axis3/HTTPChannel/HTTPChannel.cpp (original)
+++ webservices/axis/trunk/c/src/transport/axis3/HTTPChannel/HTTPChannel.cpp Tue Nov 28 08:59:39 2006
@@ -226,11 +226,7 @@
}
else if ( 0 == nByteRecv )
{
- // read-side of socket is closed - anytime we come down expecting to read something
- // and read-side is closed means that there must be a parsing bug in http transport level.
- m_LastError = "Remote side of socket has been closed.";
- CloseChannel();
- throw HTTPTransportException( SERVER_TRANSPORT_INPUT_STREAMING_ERROR, m_LastError.c_str());
+ // read-side of socket is closed.
}
else if( nByteRecv)
{
Modified: webservices/axis/trunk/c/src/transport/axis3/HTTPSSLChannel/HTTPSSLChannel.cpp
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/transport/axis3/HTTPSSLChannel/HTTPSSLChannel.cpp?view=diff&rev=480128&r1=480127&r2=480128
==============================================================================
--- webservices/axis/trunk/c/src/transport/axis3/HTTPSSLChannel/HTTPSSLChannel.cpp (original)
+++ webservices/axis/trunk/c/src/transport/axis3/HTTPSSLChannel/HTTPSSLChannel.cpp Tue Nov 28 08:59:39 2006
@@ -691,12 +691,8 @@
}
else if ( 0 == nByteRecv )
{
- // read-side of socket is closed - anytime we come down expecting to read something
- // and read-side is closed means that there must be a parsing bug in http transport level.
- OpenSSL_Close();
- close();
- m_LastError = "Remote side of socket has been closed.";
- throw HTTPTransportException( SERVER_TRANSPORT_INPUT_STREAMING_ERROR, m_LastError.c_str());
+ // read-side of socket is closed
+ *(pszRxBuffer + nByteRecv) = '\0';
}
else
{
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?view=diff&rev=480128&r1=480127&r2=480128
==============================================================================
--- webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp (original)
+++ webservices/axis/trunk/c/src/transport/axis3/HTTPTransport.cpp Tue Nov 28 08:59:39 2006
@@ -1493,8 +1493,13 @@
// not be assumed that the HTTP header will be read in one block, thus there
// must be processing that first identifies the beginning of the HTTP header
// block (i.e. looks for 'HTTP') and then additional processing that identifies
- // the end of the HTTP header block (i.e. looks for CR LF CR LF).
+ // the end of the HTTP header block (i.e. looks for CR LF CR LF). To stop the
+ // search becoming 'stuck' because of an incomplete, corrupt or unexpected
+ // message an iteration count has been added (this could become configurable if
+ // the user needs to remove this feature if the server is particularily slow,
+ // etc.).
bool bHTTPHeaderFound = false;
+ int iIterationCount = 100;
m_strReceived = "";
@@ -1509,6 +1514,12 @@
// Add the new message part to the received string.
m_strReceived += m_pszRxBuffer;
+ // Do iteration processing.
+ if( strlen( m_pszRxBuffer) > 0)
+ iIterationCount = 100;
+ else
+ iIterationCount--;
+
// Check for beginning and end of HTTP header.
if( m_strReceived.find( ASCII_S_HTTP) != std::string::npos &&
m_strReceived.find( ASCII_S_CRLFCRLF) != std::string::npos)
@@ -1516,7 +1527,14 @@
bHTTPHeaderFound = true;
}
}
- while(!bHTTPHeaderFound);
+ while( !bHTTPHeaderFound && iIterationCount > 0);
+
+ // If the HTTP header was not found in the given number of iterations then throw an exception.
+ if( iIterationCount == 0)
+ {
+ throw HTTPTransportException( SERVER_TRANSPORT_INPUT_STREAMING_ERROR,
+ "Timed out waiting for HTTP header message.");
+ }
}
void HTTPTransport::
@@ -1617,17 +1635,27 @@
bool HTTPTransport::
getNextDataPacket( const char * pcszExceptionMessage)
{
+ int iIterationCount = 100;
bool bDataRead = false;
+ do
+ {
// Read whatever part of the response message that has arrived at the active channel socket.
m_pszRxBuffer[0] = '\0';
*m_pActiveChannel >> m_pszRxBuffer;
- if( strlen( m_pszRxBuffer) > 0)
+ // Do iteration processing.
+ if( strlen( m_pszRxBuffer) == 0)
+ iIterationCount--;
+ else
+ bDataRead = true;
+ }
+ while( !bDataRead && iIterationCount > 0);
+
+ if( bDataRead)
{
m_strReceived += m_pszRxBuffer;
m_iBytesLeft = m_strReceived.length();
- bDataRead = true;
}
else if( m_strReceived.length() == 0)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org