Changeset 20659 in webkit
- Timestamp:
- Apr 2, 2007 11:22:54 AM (17 years ago)
- Location:
- S60/trunk/WebKit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
S60/trunk/WebKit/BrowserControl/src/BrCtl.cpp
r20584 r20659 82 82 #include <AknsDrawUtils.h> 83 83 #include <EscapeUtils.h> 84 84 #include "LoaderContainer.h" 85 85 #ifdef RD_BROWSER_WIDGETS 86 86 #include "WidgetExtension.h" … … 1438 1438 // 1439 1439 EXPORT_C void CBrCtl::SetParamL( 1440 TBrCtlDefs::TBrCtlParams /*aParam*/, 1441 const TDesC& /*aValue*/ ) 1442 { 1440 TBrCtlDefs::TBrCtlParams aParam, 1441 const TDesC& aValue ) 1442 { 1443 // 1444 if (aParam == TBrCtlDefs::EParamsRequestHeaders) 1445 { 1446 CStaticObjectContainer::Instance().LoaderContainerL(*this).SetClientAcceptHeadersL(aValue); 1447 } 1443 1448 } 1444 1449 -
S60/trunk/WebKit/ChangeLog
r20589 r20659 1 2007-04-02 bujtas <zbujtas@gmail.com> 2 3 Reviewed by Sachin. 4 DESC: implement client side accept header support 5 http://bugs.webkit.org/show_bug.cgi?id=13256 6 7 * BrowserControl/src/BrCtl.cpp: 8 (CBrCtl::SetParamL): 9 * ResourceLoader/inc/LoaderContainer.h: 10 (CLoaderContainer::ClientAcceptHeaders): 11 * ResourceLoader/src/HttpTransaction.cpp: 12 (CHttpTransaction::AddRequestHeadersL): 13 * ResourceLoader/src/LoaderContainer.cpp: 14 (CLoaderContainer::~CLoaderContainer): 15 (CLoaderContainer::SetClientAcceptHeadersL): 16 17 1 18 vbradley, reviewed by yongjun 2 19 DESC: Fix cursor when browser is brought back from background and a -
S60/trunk/WebKit/ResourceLoader/inc/LoaderContainer.h
r17254 r20659 183 183 184 184 /** 185 * Set accept headers set by the client application 186 * @since 3.1 187 * @return 188 */ 189 void SetClientAcceptHeadersL( const TPtrC& aAcceptHeaders ); 190 191 /** 192 * return accept headers set by the client application 193 * @since 3.1 194 * @return 195 */ 196 const RPointerArray<HBufC8>& ClientAcceptHeaders() const { return iClientAcceptHeaders; } 197 198 /** 185 199 * Get load observer 186 200 * @since 3.1 … … 314 328 // 315 329 CHttpCacheManager* iCache; // owned 330 // 331 RPointerArray<HBufC8> iClientAcceptHeaders; 316 332 }; 317 333 -
S60/trunk/WebKit/ResourceLoader/src/HttpTransaction.cpp
r19915 r20659 838 838 iTrans->PropertySet().RemoveProperty( connectionCallbackStr ); 839 839 iTrans->PropertySet().SetPropertyL( connectionCallbackStr, tokenVal ); 840 841 // add client request headers 842 CLoaderContainer* loaderContainer = static_cast<CLoaderContainer*> 843 (TWebCoreLoaderContainer::LoaderContainer()); 844 const RPointerArray<HBufC8>& clientHeaders = loaderContainer->ClientAcceptHeaders(); 845 int i=0; 846 // clientHeaders.Count()-1 for the double i++ to make sure that we 847 // have both the key and the value string 848 while (i < clientHeaders.Count()-1) 849 { 850 TPtrC8 headerName = *(clientHeaders[i++]); 851 TPtrC8 headerValue = *(clientHeaders[i++]); 852 // header name 853 RStringF headerNameStr = stringPool.OpenFStringL(headerName); 854 CleanupClosePushL(headerNameStr); 855 856 // date type 857 if (headerNameStr == stringPool.StringF(HTTP::EIfModifiedSince, RHTTPSession::GetTable()) || 858 headerNameStr == stringPool.StringF(HTTP::EIfUnmodifiedSince, RHTTPSession::GetTable())) 859 { 860 TInternetDate date; 861 date.SetDateL(headerValue); 862 TDateTime modifyTime(date.DateTime()); 863 hdr.SetFieldL(headerNameStr, modifyTime); 864 } 865 // string 866 else 867 { 868 RStringF headerValueStr = stringPool.OpenFStringL( headerValue ); 869 CleanupClosePushL(headerValueStr); 870 871 hdr.SetFieldL( headerNameStr, headerValueStr ); 872 CleanupStack::PopAndDestroy(); // headerNameStr 873 } 874 // 875 CleanupStack::PopAndDestroy(); // headerNameStr 876 } 840 877 } 841 878 -
S60/trunk/WebKit/ResourceLoader/src/LoaderContainer.cpp
r19804 r20659 131 131 delete iDownloadObserver; 132 132 iLoaderArray.Close(); 133 iClientAcceptHeaders.ResetAndDestroy(); 134 iClientAcceptHeaders.Close(); 135 133 136 } 134 137 … … 463 466 } 464 467 468 // ----------------------------------------------------------------------------- 469 // CLoaderContainer::SetClientAcceptHeaders 470 // 471 // ----------------------------------------------------------------------------- 472 // 473 void CLoaderContainer::SetClientAcceptHeadersL( const TPtrC& aAcceptHeaders ) 474 { 475 // cleanup pervious accept headers 476 iClientAcceptHeaders.ResetAndDestroy(); 477 478 TInt startName = 0; 479 TInt endName = 0; 480 TInt startValue = 0; 481 TInt endValue = 0; 482 TInt consumed = 0; 483 TInt len = aAcceptHeaders.Length(); 484 485 HBufC8* acceptHeaders = HBufC8::NewLC(aAcceptHeaders.Length()); 486 acceptHeaders->Des().Copy(aAcceptHeaders); 487 while (consumed < len) 488 { 489 TPtrC8 ptr(acceptHeaders->Ptr() + consumed, len - consumed); 490 // find the headers separator first 491 endValue = ptr.Locate('\r'); 492 if (endValue == 0) 493 { 494 // skip empty headers 495 consumed++; 496 continue; 497 } 498 if (endValue == KErrNotFound) 499 { 500 endValue = ptr.Length(); 501 } 502 TPtrC8 header(ptr.Ptr(), endValue); 503 startName = 0; 504 endName = header.Locate(':'); 505 if (endName <= 0) 506 { 507 // No separator in the header, or it is the first character 508 User::Leave(KErrArgument); 509 } 510 // Skip leading spaces in header value 511 for (startValue = endName + 1; startValue < endValue && header[startValue] == ' '; startValue++) 512 { 513 } 514 // 515 TInt headerPos = startName; 516 TInt valuePos = startValue; 517 // 518 HBufC8* headerBuf = HBufC8::NewLC(endName); 519 HBufC8* valueBuf = HBufC8::NewLC(endValue-startValue); 520 521 headerBuf->Des().Copy(ptr.Left(endName)); 522 valueBuf->Des().Copy(ptr.Mid(startValue, endValue - startValue)); 523 524 User::LeaveIfError(iClientAcceptHeaders.Append(headerBuf)); 525 User::LeaveIfError(iClientAcceptHeaders.Append(valueBuf)); 526 CleanupStack::Pop(2); // headerBuf, valueBuf 527 consumed += (endValue + 1); 528 } 529 CleanupStack::PopAndDestroy(); // acceptHeaders 530 } 531 465 532 // End of File
Note: See TracChangeset
for help on using the changeset viewer.