16 #include <http/rhttptransaction.h> |
16 #include <http/rhttptransaction.h> |
17 #include <http/rhttpheaders.h> |
17 #include <http/rhttpheaders.h> |
18 #include <http/rhttpresponse.h> |
18 #include <http/rhttpresponse.h> |
19 #include <httperr.h> |
19 #include <httperr.h> |
20 #include <httpstringconstants.h> |
20 #include <httpstringconstants.h> |
|
21 //#include <imcvcodc.h> //for base64 en/decoding |
21 #include <bautils.h> |
22 #include <bautils.h> |
22 #include <e32math.h> |
23 #include <e32math.h> |
23 #include <hash.h> |
24 #include <hash.h> |
24 #include <e32const.h> |
25 #include <e32const.h> |
25 #include <tconvbase64.h> //for base64 en/decoding |
26 #include <tconvbase64.h> |
26 #include "testhttpfilter.h" |
27 #include "testhttpfilter.h" |
27 _LIT8( KTESTHTTPFilterName, "TestHttp"); |
28 _LIT8( KTESTHTTPFilterName, "TestHttp"); |
28 _LIT8( KAuthenticationInfoStr, "Authentication-Info" ); |
29 _LIT8( KAuthenticationInfoStr, "Authentication-Info" ); |
29 _LIT8( KUserAgentProductToken,"3gpp-gba"); |
30 _LIT8( KUserAgentProductToken,"3gpp-gba"); |
|
31 _LIT8( KColon, ":" ); |
30 const TInt KB64KeySize = 64; |
32 const TInt KB64KeySize = 64; |
31 _LIT(KTestHttpFilter, "TEST HTTP FILTER "); |
33 _LIT(KTestHttpFilter, "TEST HTTP FILTER "); |
32 |
34 |
33 void PanicTestHttpFilters(TInt aErr = 0) |
35 void PanicTestHttpFilters(TInt aErr = 0) |
34 { |
36 { |
239 if( status == HTTPStatus::EUnauthorized ) |
241 if( status == HTTPStatus::EUnauthorized ) |
240 { |
242 { |
241 |
243 |
242 TInt headerPart=0; |
244 TInt headerPart=0; |
243 THTTPHdrVal headerVal; |
245 THTTPHdrVal headerVal; |
|
246 TInt cred = KErrNotFound; |
244 RStringF wwwAuthHeader = iStringPool.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable()); |
247 RStringF wwwAuthHeader = iStringPool.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable()); |
245 RHTTPHeaders headers(aTrans.Response().GetHeaderCollection()); |
248 RHTTPHeaders headers(aTrans.Response().GetHeaderCollection()); |
246 |
249 |
247 RString realm; |
250 RString realm; |
248 THTTPHdrVal hdrVal; |
251 THTTPHdrVal hdrVal; |
315 found = rawFieldData.Find(iUserAgent.DesC()) != KErrNotFound; |
318 found = rawFieldData.Find(iUserAgent.DesC()) != KErrNotFound; |
316 |
319 |
317 if(!found) |
320 if(!found) |
318 hdr.SetFieldL(fieldname, iUserAgent); |
321 hdr.SetFieldL(fieldname, iUserAgent); |
319 |
322 |
|
323 TInt cred = KErrNotFound; |
|
324 |
320 if( iHaveCredentials ) |
325 if( iHaveCredentials ) |
321 { |
326 { |
322 TBuf8<KB64KeySize> keyBase64(_L8("Aladdin")); |
327 TBuf8<KB64KeySize> keyBase64(_L8("Aladdin")); |
323 TBuf8<KB64KeySize> keyBase64Username(_L8("open sesame"));; |
328 TBuf8<KB64KeySize> keyBase64Username(_L8("open sesame"));; |
324 RString username = iStringPool.OpenStringL( keyBase64 ); |
329 RString username = iStringPool.OpenStringL( keyBase64 ); |