webengine/osswebengine/WebCore/platform/network/symbian/HttpRequestHeaderManager.cpp
changeset 10 a359256acfc6
parent 5 10e98eab6f85
child 25 0ed94ceaa377
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
   145     const ResourceRequest& aRequest )
   145     const ResourceRequest& aRequest )
   146 {
   146 {
   147     const TStringTable& stringTable = m_Session.GetTable();
   147     const TStringTable& stringTable = m_Session.GetTable();
   148     TPtrC8 acceptMimeTypes;
   148     TPtrC8 acceptMimeTypes;
   149     HBufC8* tmpBuf = NULL;
   149     HBufC8* tmpBuf = NULL;
   150     CleanupStack::PushL(tmpBuf);
   150 	TInt pushCounter( 0 );
   151     //
   151 
   152     if(aRequest.mainLoad()) {
   152     if(aRequest.mainLoad()) {
   153         acceptMimeTypes.Set(*TopLevelAcceptStringL(aRequest));
   153         acceptMimeTypes.Set(*TopLevelAcceptStringL(aRequest));
   154     } else {
   154     } else {
   155         // for requests that are not top-level, WebCore may or may not
   155         // for requests that are not top-level, WebCore may or may not
   156         // set accept MIME types.  If it does, we will send that string
   156         // set accept MIME types.  If it does, we will send that string
   157         // as it, if not - we will add * / *
   157         // as it, if not - we will add * / *
   158         TPtrC reqMimeTypes(aRequest.httpAccept().des());
   158         TPtrC reqMimeTypes(aRequest.httpAccept().des());
   159         if(reqMimeTypes.Length() > 0) {
   159         if(reqMimeTypes.Length() > 0) {
   160             // WebCore has set accept MIME type - leave alone
   160             // WebCore has set accept MIME type - leave alone
   161             tmpBuf = HBufC8::NewL(reqMimeTypes.Length());
   161             tmpBuf = HBufC8::NewL(reqMimeTypes.Length());
       
   162 			CleanupStack::PushL(tmpBuf);
       
   163 			++pushCounter;
   162             tmpBuf->Des().Copy(reqMimeTypes);
   164             tmpBuf->Des().Copy(reqMimeTypes);
   163             acceptMimeTypes.Set(*tmpBuf);
   165             acceptMimeTypes.Set(*tmpBuf);
   164         } else {
   166         } else {
   165             // no MIME type - add * / *
   167             // no MIME type - add * / *
   166             acceptMimeTypes.Set(KStarSlashStar8);
   168             acceptMimeTypes.Set(KStarSlashStar8);
   167         }
   169         }
   168     }
   170     }
   169     //
       
   170     RStringF str = m_StringPool.OpenFStringL(acceptMimeTypes);
   171     RStringF str = m_StringPool.OpenFStringL(acceptMimeTypes);
   171     CleanupClosePushL(str);
   172     CleanupClosePushL(str);
       
   173 	++pushCounter;
   172     aHeaders.SetFieldL(m_StringPool.StringF(HTTP::EAccept, stringTable), str);
   174     aHeaders.SetFieldL(m_StringPool.StringF(HTTP::EAccept, stringTable), str);
   173     CleanupStack::PopAndDestroy(2); // str, tmpBuf
   175     CleanupStack::PopAndDestroy(pushCounter);
   174 }
   176 }
   175 
   177 
   176 // -----------------------------------------------------------------------------
   178 // -----------------------------------------------------------------------------
   177 // HttpRequestHeaderManager::SetAcceptHeaderL()
   179 // HttpRequestHeaderManager::SetAcceptHeaderL()
   178 // -----------------------------------------------------------------------------
   180 // -----------------------------------------------------------------------------