applayerpluginsandutils/httpprotocolplugins/httpclient/chttpresponseparser.cpp
branchRCL_3
changeset 53 c59bddbfd7b9
parent 40 a0da872af3fa
equal deleted inserted replaced
40:a0da872af3fa 53:c59bddbfd7b9
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   294 					}
   294 					}
   295 				}
   295 				}
   296 			
   296 			
   297 			}
   297 			}
   298 		else
   298 		else
   299 	        {		    
   299 	        {
   300             // Check client has asked to return Default Error occured while Disconnect received
   300             CHttpRequestComposer& request = static_cast<CHttpRequestComposer&>(iProtTrans->TxData());
       
   301 			// Check client has asked to return Default Error occured while Disconnect received
   301             if (clientTrans->PropogateDefaultError())
   302             if (clientTrans->PropogateDefaultError())
   302                {
   303                 {
   303                NotifyObserverError(aError);             
   304                 NotifyObserverError(aError);             
   304                return;
   305                 return;
   305                }
   306                 }
   306             // Need to map to appropriate error code if the disconnect notification is
   307             // Need to map to appropriate error code if the disconnect notification is
   307             // asked by the client			
   308             // asked by the client
   308 			if ( clientTrans->NeedDisconnectNotification() )
   309             if ( clientTrans->NeedDisconnectNotification() )
   309 				{
   310 				{
   310 				CHttpRequestComposer& request = static_cast<CHttpRequestComposer&>(iProtTrans->TxData());
       
   311 				// if we are consuming response then the request has been not sent fully.
   311 				// if we are consuming response then the request has been not sent fully.
   312 				if ( ConsumingResponse () || !request.RequestSent() )
   312 				if ( ConsumingResponse () || !request.RequestSent() )
   313 					aError = KErrHttpRequestNotSent;
   313 					aError = KErrHttpRequestNotSent;
   314 				// Check if we received some response
   314 				// Check if we received some response
   315 				// Check for status code that means we received something as response
   315 				// Check for status code that means we received something as response
   501                  #if defined (_DEBUG) && defined (_LOGGING)
   501                  #if defined (_DEBUG) && defined (_LOGGING)
   502                      __FLOG_0(_T8("Pipelining is disabled for WebLogic Server- \n"));
   502                      __FLOG_0(_T8("Pipelining is disabled for WebLogic Server- \n"));
   503                  #endif
   503                  #endif
   504                  manager->AppendPipelineFailedHost(hostVal.StrF().DesC());
   504                  manager->AppendPipelineFailedHost(hostVal.StrF().DesC());
   505                  }
   505                  }
   506 		}
   506  		    }
   507 		
       
   508  		if (name.DesC().CompareF(stringPool.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable()).DesC()) == KErrNone)
   507  		if (name.DesC().CompareF(stringPool.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable()).DesC()) == KErrNone)
   509             {
   508  		    {
   510             _LIT8(KNtlmProtocolName,"NTLM");
   509             _LIT8(KNtlmProtocolName,"NTLM");
   511             if (aFieldValue.FindF(KNtlmProtocolName)!= KErrNotFound)
   510             if (aFieldValue.FindF(KNtlmProtocolName)!= KErrNotFound)
   512                 {
   511                 {
   513                 CHttpClientTransaction& protTran = static_cast<CHttpClientTransaction&>(*iProtTrans);
   512                 CHttpClientTransaction& protTran = static_cast<CHttpClientTransaction&>(*iProtTrans);
   514                 CHttpConnectionManager* manager = protTran.ConnectionManager();
   513                 CHttpConnectionManager* manager = protTran.ConnectionManager();
   528                         }
   527                         }
   529                     else
   528                     else
   530                         {
   529                         {
   531                         RStringF ntlmId= stringPool.OpenFStringL( KNtlmConnId );
   530                         RStringF ntlmId= stringPool.OpenFStringL( KNtlmConnId );
   532                         CleanupClosePushL(ntlmId);
   531                         CleanupClosePushL(ntlmId);
   533                         THTTPHdrVal value;
   532 												THTTPHdrVal value;
   534                         value.SetInt(manager->GetNtlmConnId());
   533                         value.SetInt(manager->GetNtlmConnId());
   535                         trans.PropertySet().SetPropertyL( ntlmId, value );    
   534                         trans.PropertySet().SetPropertyL( ntlmId, value );
   536                         CleanupStack::PopAndDestroy(&ntlmId);
   535                         CleanupStack::PopAndDestroy(&ntlmId);  
   537                         }
   536                         }
   538                     }
   537                     }
   539                }
   538                }
   540             }
   539  		    }
   541  		
       
   542 		CleanupStack::PopAndDestroy(&name);
   540 		CleanupStack::PopAndDestroy(&name);
   543 		
   541 		
   544 		if( BodyComplete() && !GotTrailers() )	
   542 		if( BodyComplete() && !GotTrailers() )	
   545 			{
   543 			{
   546 			// This was a trailer header - flag that there are trailers.
   544 			// This was a trailer header - flag that there are trailers.
   806 	}
   804 	}
   807 
   805 
   808 TBool CHttpResponseParser::NeedCompletion ()
   806 TBool CHttpResponseParser::NeedCompletion ()
   809 	{
   807 	{
   810 	RHTTPTransaction trans = iProtTrans->Transaction ();
   808 	RHTTPTransaction trans = iProtTrans->Transaction ();
   811 	TInt statusCode = trans.Response().StatusCode();
   809 	if ( HTTPStatus::IsRedirection ( trans.Response().StatusCode() ) )
   812 	if ( HTTPStatus::IsRedirection ( statusCode )|| statusCode == HTTPStatus::EUnauthorized )
       
   813 		{
   810 		{
   814 		// If it is a redirection message then we need to complete the response
   811 		// If it is a redirection message then we need to complete the response
   815 		// for 401 error..we have to continue on the same port..so we need to complete the response immediately
       
   816 		return ETrue;			
   812 		return ETrue;			
   817 		}
   813 		}
   818 	return EFalse;		
   814 	return EFalse;		
   819 	}
   815 	}
   820 
   816