21 |
21 |
22 _LIT(KMethod, "Method"); |
22 _LIT(KMethod, "Method"); |
23 _LIT(KUri, "Uri"); |
23 _LIT(KUri, "Uri"); |
24 _LIT(KRawRequest, "RawRequest"); |
24 _LIT(KRawRequest, "RawRequest"); |
25 _LIT(KRawResponse, "RawResponse"); |
25 _LIT(KRawResponse, "RawResponse"); |
|
26 _LIT(KRawEncodedAuthenticationRequest, "RawEncodedAuthenticationRequest"); |
|
27 _LIT(KRawFinalResponse, "RawFinalResponse"); |
26 _LIT(KResponseBody, "ResponseBody"); |
28 _LIT(KResponseBody, "ResponseBody"); |
27 _LIT(KStatusCode, "StatusCode"); |
29 _LIT(KStatusCode, "StatusCode"); |
28 _LIT(KResponseFieldCount, "ResponseFieldCount"); |
30 _LIT(KResponseFieldCount, "ResponseFieldCount"); |
29 _LIT(KHeader, "ResponseHeader%d"); |
31 _LIT(KHeader, "ResponseHeader%d"); |
30 _LIT(KHeaderValue, "ResponseHeader%d.Value%d"); |
32 _LIT(KHeaderValue, "ResponseHeader%d.Value%d"); |
56 _LIT(KResponseDynamicAndStatic, "ResponseDynamicAndStatic"); |
58 _LIT(KResponseDynamicAndStatic, "ResponseDynamicAndStatic"); |
57 _LIT(KOnlineTest, "OnlineTest"); |
59 _LIT(KOnlineTest, "OnlineTest"); |
58 _LIT(KProxyAddress, "ProxyAddress"); |
60 _LIT(KProxyAddress, "ProxyAddress"); |
59 _LIT(KResponseTimeout, "ResponseTimeout"); |
61 _LIT(KResponseTimeout, "ResponseTimeout"); |
60 _LIT(KRedirection, "Redirection"); |
62 _LIT(KRedirection, "Redirection"); |
61 _LIT(KNotifyTransferProgress, "NotifyTransferProgress"); |
63 _LIT(KNotifyTransferProgress, "NotifyTransferProgress"); |
|
64 _LIT(KSetAuthentication, "SetAuthentication"); |
62 |
65 |
63 _LIT8(KScriptLF8, "\\n"); |
66 _LIT8(KScriptLF8, "\\n"); |
64 _LIT8(KReplaceLF8, "\n"); |
67 _LIT8(KReplaceLF8, "\n"); |
65 _LIT8(KScriptCR8, "\\r"); |
68 _LIT8(KScriptCR8, "\\r"); |
66 _LIT8(KReplaceCR8, "\r"); |
69 _LIT8(KReplaceCR8, "\r"); |
105 { |
108 { |
106 TPtrC method; |
109 TPtrC method; |
107 TPtrC uri; |
110 TPtrC uri; |
108 TPtrC rawRequest; |
111 TPtrC rawRequest; |
109 TPtrC rawResponse; |
112 TPtrC rawResponse; |
|
113 TPtrC rawEncodedAuthenticationRequest; |
|
114 TPtrC rawFinalResponse; |
110 if(!aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KMethod(), method) || |
115 if(!aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KMethod(), method) || |
111 !aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KUri(), uri) || |
116 !aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KUri(), uri) || |
112 !aTestCase.GetIntFromConfig(aTestCase.ConfigSection(), KStatusCode(), iStatusCode)) |
117 !aTestCase.GetIntFromConfig(aTestCase.ConfigSection(), KStatusCode(), iStatusCode)) |
113 { |
118 { |
114 User::Leave(KErrCorrupt); |
119 User::Leave(KErrCorrupt); |
115 } |
120 } |
116 aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KRawRequest(), rawRequest); |
121 aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KRawRequest(), rawRequest); |
117 aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KRawResponse(), rawResponse); |
122 aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KRawResponse(), rawResponse); |
|
123 aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KRawEncodedAuthenticationRequest(), rawEncodedAuthenticationRequest); |
|
124 aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KRawFinalResponse(), rawFinalResponse); |
118 |
125 |
119 iMethod = EscapeUtils::ConvertFromUnicodeToUtf8L(method); |
126 iMethod = EscapeUtils::ConvertFromUnicodeToUtf8L(method); |
120 iUri = EscapeUtils::ConvertFromUnicodeToUtf8L(uri); |
127 iUri = EscapeUtils::ConvertFromUnicodeToUtf8L(uri); |
121 iRawRequest = EscapeUtils::ConvertFromUnicodeToUtf8L(rawRequest); |
128 iRawRequest = EscapeUtils::ConvertFromUnicodeToUtf8L(rawRequest); |
122 iRawResponse = EscapeUtils::ConvertFromUnicodeToUtf8L(rawResponse); |
129 iRawResponse = EscapeUtils::ConvertFromUnicodeToUtf8L(rawResponse); |
|
130 iEncodedAuthenticationRequest = EscapeUtils::ConvertFromUnicodeToUtf8L(rawEncodedAuthenticationRequest); |
|
131 iFinalResponse = EscapeUtils::ConvertFromUnicodeToUtf8L(rawFinalResponse); |
|
132 |
123 ParseAndReplaceCRLF(iRawRequest); |
133 ParseAndReplaceCRLF(iRawRequest); |
124 ParseAndReplaceCRLF(iRawResponse); |
134 ParseAndReplaceCRLF(iRawResponse); |
|
135 ParseAndReplaceCRLF(iEncodedAuthenticationRequest); |
|
136 ParseAndReplaceCRLF(iFinalResponse); |
|
137 |
125 |
138 |
126 |
139 |
127 TPtrC responseBody; |
140 TPtrC responseBody; |
128 if(aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KResponseBody(), responseBody)) |
141 if(aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KResponseBody(), responseBody)) |
129 { |
142 { |
319 aTestCase.GetBoolFromConfig(aTestCase.ConfigSection(), KResponseTimeout(), iResponseTimeout); |
332 aTestCase.GetBoolFromConfig(aTestCase.ConfigSection(), KResponseTimeout(), iResponseTimeout); |
320 |
333 |
321 iNotifyTransferProgress = EFalse; |
334 iNotifyTransferProgress = EFalse; |
322 aTestCase.GetBoolFromConfig(aTestCase.ConfigSection(), KNotifyTransferProgress(), iNotifyTransferProgress); |
335 aTestCase.GetBoolFromConfig(aTestCase.ConfigSection(), KNotifyTransferProgress(), iNotifyTransferProgress); |
323 |
336 |
|
337 iSetAuthentication = EFalse; |
|
338 aTestCase.GetBoolFromConfig(aTestCase.ConfigSection(), KSetAuthentication(), iSetAuthentication); |
|
339 |
324 TPtrC proxyAddress; |
340 TPtrC proxyAddress; |
325 if(aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KProxyAddress, proxyAddress)) |
341 if(aTestCase.GetStringFromConfig(aTestCase.ConfigSection(), KProxyAddress, proxyAddress)) |
326 { |
342 { |
327 iProxyAddress = EscapeUtils::ConvertFromUnicodeToUtf8L(proxyAddress); |
343 iProxyAddress = EscapeUtils::ConvertFromUnicodeToUtf8L(proxyAddress); |
328 } |
344 } |
363 const TDesC8& CHttpClientTestParams::RawResponse() const |
381 const TDesC8& CHttpClientTestParams::RawResponse() const |
364 { |
382 { |
365 return *iRawResponse; |
383 return *iRawResponse; |
366 } |
384 } |
367 |
385 |
|
386 const TDesC8& CHttpClientTestParams::EncodedAuthenticationRequest() const |
|
387 { |
|
388 return *iEncodedAuthenticationRequest; |
|
389 } |
|
390 |
|
391 void CHttpClientTestParams::SetAuthReqRes() |
|
392 { |
|
393 if (iRawRequest) |
|
394 { |
|
395 delete iRawRequest; |
|
396 iRawRequest = NULL; |
|
397 } |
|
398 if (iRawResponse) |
|
399 { |
|
400 delete iRawResponse; |
|
401 iRawResponse = NULL; |
|
402 } |
|
403 iRawRequest = iEncodedAuthenticationRequest; |
|
404 iRawResponse = iFinalResponse; |
|
405 |
|
406 iEncodedAuthenticationRequest = NULL; |
|
407 iFinalResponse = NULL; |
|
408 } |
|
409 |
368 const TDesC8& CHttpClientTestParams::ResponseBody() const |
410 const TDesC8& CHttpClientTestParams::ResponseBody() const |
369 { |
411 { |
370 if(iResponseBody) |
412 if(iResponseBody) |
371 return *iResponseBody; |
413 return *iResponseBody; |
372 return KNullDesC8(); |
414 return KNullDesC8(); |