ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject cvs commit: ws-axis/c/src/transport/axis3 HTTPTransport.cpp
Date Fri, 04 Mar 2005 13:31:13 GMT
prestonf    2005/03/04 05:31:13

  Modified:    c/src/transport/axis3 HTTPTransport.cpp
  Log:
  Hi All,
  I think this will complete what needs to be done for AXISCPP-492.
  
  Regards,
  Fred Preston.
  
  Revision  Changes    Path
  1.19      +37 -6     ws-axis/c/src/transport/axis3/HTTPTransport.cpp
  
  Index: HTTPTransport.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/transport/axis3/HTTPTransport.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- HTTPTransport.cpp	3 Mar 2005 14:55:11 -0000	1.18
  +++ HTTPTransport.cpp	4 Mar 2005 13:31:13 -0000	1.19
  @@ -400,7 +400,14 @@
   
   		    if( !m_bReadPastHTTPHeaders)
   		    {
  -				unsigned int start = std::string::npos;
  +				unsigned int	start = std::string::npos;
  +// getBytes needs to be able to exit any of the following loops if the expected
  +// character sequence is never detected.  This is done using a simple counter.
  +// If the loop has not exited on its own accord after say 100 tries, it is safe
  +// to assume that it never will...  To make the test less likely to cause
  +// problems with very long messages, the countdown is only decremented when no
  +// data has been received.
  +				int				iIterationCountdown = 100;
   
   				do
   				{
  @@ -409,9 +416,22 @@
   						if (m_strReceived.find( "\r\n\r\n") == std::string::npos)
   						{
   							*m_pActiveChannel >> m_pszRxBuffer;
  -						    m_strReceived += m_pszRxBuffer;
  +
  +// If data has been received, then add the data to the received message buffer
  +// and reset the countdown.  Otherwise, decrement the countdown.
  +							if( strlen( m_pszRxBuffer) > 0)
  +							{
  +							    m_strReceived += m_pszRxBuffer;
  +								iIterationCountdown = 100;
  +							}
  +							else
  +							{
  +								iIterationCountdown--;
  +							}
   						}
  -					} while( m_strReceived.find( "\r\n\r\n") == std::string::npos);
  +					} while( m_strReceived.find( "\r\n\r\n") == std::string::npos && iIterationCountdown
> 0);
  +
  +					iIterationCountdown = 100;
   
   					if( m_strReceived.find ("HTTP") == std::string::npos)
   					{
  @@ -424,9 +444,20 @@
   							if( m_strReceived.find( "\r\n\r\n") == std::string::npos)
   							{
   								*m_pActiveChannel >> m_pszRxBuffer;
  -								m_strReceived += m_pszRxBuffer;
  +
  +// If data has been received, then add the data to the received message buffer
  +// and reset the countdown.  Otherwise, decrement the countdown.
  +								if( strlen( m_pszRxBuffer) > 0)
  +								{
  +									m_strReceived += m_pszRxBuffer;
  +									iIterationCountdown = 100;
  +								}
  +								else
  +								{
  +									iIterationCountdown--;
  +								}
   							}
  -						} while( m_strReceived.find( "\r\n\r\n") == std::string::npos);
  +						} while( m_strReceived.find( "\r\n\r\n") == std::string::npos && iIterationCountdown
> 0);
   			// now this must contain HTTP. Else there is a conent error.
   					}
   
  @@ -476,7 +507,7 @@
   						*m_pActiveChannel >> m_pszRxBuffer;
   						m_strReceived = m_pszRxBuffer;
   					}
  -				} while( m_iResponseHTTPStatusCode == 100);
  +				} while( m_iResponseHTTPStatusCode == 100 && iIterationCountdown > 0);
   
                   if ( m_iResponseHTTPStatusCode != 500 &&
                       ( m_iResponseHTTPStatusCode < 200 || m_iResponseHTTPStatusCode >=
300 ))
  
  
  

Mime
View raw message