webengine/osswebengine/WebCore/platform/network/symbian/HttpConnection.cpp
changeset 5 10e98eab6f85
parent 0 dd21522fd290
child 25 0ed94ceaa377
equal deleted inserted replaced
1:7c90e6132015 5:10e98eab6f85
   104     Cancel();
   104     Cancel();
   105 }
   105 }
   106 
   106 
   107 void ReceivedFinished::RunL()
   107 void ReceivedFinished::RunL()
   108 {
   108 {
       
   109     m_done = true;    
       
   110     /*
       
   111      * this callback will call deRef on HttpConnection which
       
   112      * will delete ReceivedFinished object since it's a 
       
   113      * member of HttpConnection. Therefore this call has to 
       
   114      * the last one.
       
   115      */
   109     m_callback(m_ctx, m_error);
   116     m_callback(m_ctx, m_error);
   110     m_done = true;
       
   111 }
   117 }
   112 
   118 
   113 TInt ReceivedFinished::RunError(TInt aError)
   119 TInt ReceivedFinished::RunError(TInt aError)
   114 {
   120 {
   115     return KErrNone;
   121     return KErrNone;
   424                 }
   430                 }
   425                 // content type
   431                 // content type
   426                 THTTPHdrVal hdrVal;
   432                 THTTPHdrVal hdrVal;
   427                 RHTTPHeaders httpHeaders = m_transaction->Response().GetHeaderCollection();
   433                 RHTTPHeaders httpHeaders = m_transaction->Response().GetHeaderCollection();
   428                 RStringPool stringPool = m_transaction->Session().StringPool();
   434                 RStringPool stringPool = m_transaction->Session().StringPool();
       
   435                 
       
   436                 THTTPHdrFieldIter it = httpHeaders.Fields();  
       
   437                 
       
   438                 HBufC8* headerStr;  
       
   439                 TBool isRefresh = EFalse;
       
   440                 TPtrC8 headerValue;   ;
       
   441                 while( it.AtEnd() == EFalse )
       
   442                 {
       
   443                 // Get name of next header field
       
   444                 RStringTokenF fieldName = it();
       
   445                 RStringF fieldNameStr = stringPool.StringF( fieldName );
       
   446                 httpHeaders.GetRawField( fieldNameStr, headerValue );
       
   447                 headerStr = HBufC8::NewLC( fieldNameStr.DesC().Length() );
       
   448                 TPtr8 headerPtr( headerStr->Des() );
       
   449                 headerPtr.Copy( fieldNameStr.DesC() );
       
   450                 if (equalIgnoringCase(headerPtr, "refresh"))
       
   451                 {
       
   452                   isRefresh = ETrue;
       
   453                 	CleanupStack::PopAndDestroy(); // headerStr
       
   454                 	break;
       
   455                 }
       
   456 
       
   457                 CleanupStack::PopAndDestroy(); // headerStr
       
   458                 ++it;
       
   459                 }            
       
   460          
   429                 const TStringTable& stringTable = RHTTPSession::GetTable();
   461                 const TStringTable& stringTable = RHTTPSession::GetTable();
   430                 if( httpHeaders.GetField( stringPool.StringF( HTTP::EContentType, stringTable ), 0,
   462                 if( httpHeaders.GetField( stringPool.StringF( HTTP::EContentType, stringTable ), 0,
   431                     hdrVal) == KErrNone ) {
   463                     hdrVal) == KErrNone ) {
   432                     m_contentType = hdrVal.StrF().DesC().AllocL();
   464                     m_contentType = hdrVal.StrF().DesC().AllocL();
   433                 }
   465                 }
   454                 ResourceResponse response(m_urlResponse->Des(), m_contentType->Des(), m_maxSize, encoding, String() );
   486                 ResourceResponse response(m_urlResponse->Des(), m_contentType->Des(), m_maxSize, encoding, String() );
   455                 response.setHTTPStatusCode(m_transaction->Response().StatusCode());
   487                 response.setHTTPStatusCode(m_transaction->Response().StatusCode());
   456                 //HTTP status text
   488                 //HTTP status text
   457                 response.setHTTPStatusText(((m_transaction->Response()).StatusText().DesC()));
   489                 response.setHTTPStatusText(((m_transaction->Response()).StatusText().DesC()));
   458                 
   490                 
       
   491                 
       
   492 
   459                 if (m_contentType && m_contentType->Length()) {
   493                 if (m_contentType && m_contentType->Length()) {
   460                     response.setHTTPHeaderField("Content-Type", *m_contentType);
   494                     response.setHTTPHeaderField("Content-Type", *m_contentType);
   461                 }
   495                 }
   462 		
   496                 
   463 				TPtrC8 result;
   497                 // Add Refresh field only when Refresh existed in recieved header. 
       
   498                 if (isRefresh)
       
   499                     {
       
   500                         response.setHTTPHeaderField("Refresh",headerValue);
       
   501                     }
       
   502 				
       
   503                 TPtrC8 result;
   464 
   504 
   465                 if( httpHeaders.GetRawField( stringPool.StringF( HTTP::EContentDisposition, stringTable ), result) == KErrNone )
   505                 if( httpHeaders.GetRawField( stringPool.StringF( HTTP::EContentDisposition, stringTable ), result) == KErrNone )
   466                 	response.setHTTPHeaderField("Content-Disposition", result);
   506                 	response.setHTTPHeaderField("Content-Disposition", result);
   467 
   507 
   468                 if (m_handle->request().mainLoad()) {
   508                 if (m_handle->request().mainLoad()) {