author | larspson |
Thu, 14 Oct 2010 09:49:09 +0200 | |
branch | podcatcher_qt_symbian4 |
changeset 237 | c85b889b0d4b |
parent 228 | c553fa9dcbe5 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB |
|
3 |
* |
|
4 |
* All rights reserved. |
|
5 |
* This component and the accompanying materials are made available |
|
6 |
* under the terms of the License "Eclipse Public License v1.0" |
|
7 |
* which accompanies this distribution, and is available |
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 |
* |
|
10 |
* Initial Contributors: |
|
11 |
* EmbedDev AB - initial contribution. |
|
12 |
* |
|
13 |
* Contributors: |
|
14 |
* |
|
15 |
* Description: |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
// HttpEventHandler.cpp |
|
20 |
#include <e32debug.h> |
|
21 |
#include <httperr.h> |
|
22 |
#include "HttpEventHandler.h" |
|
23 |
#include "bautils.h" |
|
24 |
#include "Httpclient.h" |
|
228 | 25 |
#include "podcatcher_debug.h" |
2 | 26 |
|
27 |
void CHttpEventHandler::ConstructL() |
|
28 |
{ |
|
29 |
//iVerbose = ETrue; |
|
30 |
} |
|
31 |
||
32 |
||
33 |
CHttpEventHandler::CHttpEventHandler(CHttpClient* aClient, MHttpClientObserver &aCallbacks, RFs& aFs): |
|
34 |
iFileServ(aFs), iHttpClient(aClient), iCallbacks(aCallbacks) |
|
35 |
{ |
|
36 |
} |
|
37 |
||
38 |
||
39 |
CHttpEventHandler::~CHttpEventHandler() |
|
40 |
{ |
|
41 |
} |
|
42 |
||
43 |
||
44 |
CHttpEventHandler* CHttpEventHandler::NewLC(CHttpClient* aClient, MHttpClientObserver &aCallbacks, RFs& aFs) |
|
45 |
{ |
|
46 |
CHttpEventHandler* me = new(ELeave)CHttpEventHandler(aClient, aCallbacks, aFs); |
|
47 |
CleanupStack::PushL(me); |
|
48 |
me->ConstructL(); |
|
49 |
return me; |
|
50 |
} |
|
51 |
||
52 |
||
53 |
CHttpEventHandler* CHttpEventHandler::NewL(CHttpClient* aClient, MHttpClientObserver &aCallbacks, RFs& aFs) |
|
54 |
{ |
|
55 |
CHttpEventHandler* me = NewLC(aClient, aCallbacks, aFs); |
|
56 |
CleanupStack::Pop(me); |
|
57 |
return me; |
|
58 |
} |
|
59 |
||
60 |
void CHttpEventHandler::MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent) |
|
61 |
{ |
|
62 |
switch (aEvent.iStatus) |
|
63 |
{ |
|
64 |
case THTTPEvent::EGotResponseHeaders: |
|
65 |
{ |
|
66 |
// HTTP response headers have been received. We can determine now if there is |
|
67 |
// going to be a response body to save. |
|
68 |
RHTTPResponse resp = aTransaction.Response(); |
|
69 |
iLastStatusCode = resp.StatusCode(); |
|
119
a2933afe16a7
Fix for bug 2488: RHTTPResponse::StatusText returns KNullDesc for 404 for FeedBurner, but this text was only used in debug output.
teknolog
parents:
117
diff
changeset
|
70 |
DP1("Status: %d", iLastStatusCode); |
2 | 71 |
|
72 |
// Dump the headers if we're being verbose |
|
73 |
//DumpRespHeadersL(aTransaction); |
|
74 |
||
75 |
if (resp.HasBody() && (iLastStatusCode >= 200) && (iLastStatusCode < 300) && (iLastStatusCode != 204)) |
|
76 |
{ |
|
77 |
TInt dataSize = resp.Body()->OverallDataSize(); |
|
78 |
if (dataSize >= 0) { |
|
79 |
DP1("Response body size is %d", dataSize); |
|
80 |
iBytesTotal = dataSize; |
|
81 |
} else { |
|
82 |
DP("Response body size is unknown"); |
|
83 |
iBytesTotal = -1; |
|
84 |
} |
|
85 |
iCallbacks.DownloadInfo(iHttpClient, dataSize); |
|
86 |
||
87 |
} |
|
88 |
||
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
89 |
DP1("iFileOpen=%d", iFileOpen); |
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
90 |
if (!iFileOpen) |
2 | 91 |
{ |
92 |
iFileServ.Parse(iFileName, iParsedFileName); |
|
93 |
TInt valid = iFileServ.IsValidName(iFileName); |
|
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
94 |
|
2 | 95 |
if (!valid) |
96 |
{ |
|
97 |
DP("The specified filename is not valid!."); |
|
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
98 |
iHttpClient->ClientRequestCompleteL(KErrBadName); |
2 | 99 |
} |
100 |
else |
|
101 |
{ |
|
102 |
if (iContinue) { |
|
103 |
TInt err = iRespBodyFile.Open(iFileServ, iParsedFileName.FullName(),EFileWrite); |
|
104 |
if (err) |
|
105 |
{ |
|
163
f94dbd678dda
Fix for bug 3183; merging minor differences with symbian1 branch
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
106 |
DP2("There was an error=%d opening file '%S'", err, &iParsedFileName.FullName()); |
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
107 |
iHttpClient->ClientRequestCompleteL(KErrInUse); |
2 | 108 |
User::Leave(err); |
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
109 |
} |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
110 |
else |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
111 |
{ |
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
112 |
iFileOpen = ETrue; |
2 | 113 |
int pos = -KByteOverlap; |
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
114 |
if((err=iRespBodyFile.Seek(ESeekEnd, pos)) != KErrNone) |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
115 |
{ |
2 | 116 |
DP("Failed to set position!"); |
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
117 |
iHttpClient->ClientRequestCompleteL(KErrWrite); |
2 | 118 |
User::Leave(err); |
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
119 |
} |
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
120 |
iBytesDownloaded = (pos > 0) ? pos : 0; |
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
121 |
iBytesTotal += iBytesDownloaded; |
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
122 |
DP1("Total bytes is now %u", iBytesTotal); |
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
123 |
DP1("Seeking end: %d", pos); |
2 | 124 |
} |
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
125 |
} |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
126 |
else |
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
127 |
{ |
2 | 128 |
TInt err = iRespBodyFile.Replace(iFileServ, |
129 |
iParsedFileName.FullName(), |
|
130 |
EFileWrite); |
|
131 |
if (err) |
|
132 |
{ |
|
133 |
DP("There was an error replacing file"); |
|
134 |
User::Leave(err); |
|
135 |
} |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
136 |
else |
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
137 |
{ |
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
138 |
iFileOpen = ETrue; |
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
139 |
} |
2 | 140 |
} |
141 |
} |
|
142 |
} |
|
143 |
} break; |
|
144 |
case THTTPEvent::EGotResponseBodyData: |
|
145 |
{ |
|
146 |
// Get the body data supplier |
|
147 |
iRespBody = aTransaction.Response().Body(); |
|
148 |
||
149 |
// Some (more) body data has been received (in the HTTP response) |
|
150 |
//DumpRespBody(aTransaction); |
|
151 |
//DP1("Saving: %d", iSavingResponseBody); |
|
152 |
// Append to the output file if we're saving responses |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
153 |
if (iFileOpen) |
2 | 154 |
{ |
155 |
TPtrC8 bodyData; |
|
156 |
iRespBody->GetNextDataPart(bodyData); |
|
157 |
iBytesDownloaded += bodyData.Length(); |
|
158 |
TInt error = iRespBodyFile.Write(bodyData); |
|
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
159 |
|
2 | 160 |
// on writing error we close connection |
161 |
if (error != KErrNone) { |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
162 |
iFileOpen = EFalse; |
115
d87e984bd8b8
Even more robustness improvements for HTTP client - specifically disk full problems
teknolog
parents:
2
diff
changeset
|
163 |
iRespBodyFile.Close(); |
2 | 164 |
iCallbacks.FileError(error); |
165 |
iHttpClient->ClientRequestCompleteL(error); |
|
166 |
return; |
|
167 |
} |
|
168 |
||
169 |
if (!iSilent) { |
|
170 |
iCallbacks.Progress(iHttpClient, iBytesDownloaded, iBytesTotal); |
|
171 |
} |
|
172 |
} |
|
173 |
||
174 |
// Done with that bit of body data |
|
175 |
iRespBody->ReleaseData(); |
|
176 |
} break; |
|
177 |
case THTTPEvent::EResponseComplete: |
|
178 |
{ |
|
179 |
// The transaction's response is complete |
|
180 |
DP("Transaction Complete"); |
|
181 |
DP("Closing file"); |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
182 |
iFileOpen = EFalse; |
2 | 183 |
iRespBodyFile.Close(); |
184 |
} break; |
|
185 |
case THTTPEvent::ESucceeded: |
|
186 |
{ |
|
187 |
DP("Transaction Successful"); |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
188 |
iFileOpen = EFalse; |
126 | 189 |
iRespBodyFile.Close(); |
2 | 190 |
aTransaction.Close(); |
191 |
iHttpClient->ClientRequestCompleteL(KErrNone); |
|
192 |
} break; |
|
193 |
case THTTPEvent::EFailed: |
|
194 |
{ |
|
195 |
DP("Transaction Failed"); |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
196 |
iFileOpen = EFalse; |
126 | 197 |
iRespBodyFile.Close(); |
2 | 198 |
aTransaction.Close(); |
199 |
||
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
200 |
if(iLastStatusCode == HTTPStatus::EOk || iLastStatusCode == HTTPStatus::ECreated || iLastStatusCode == HTTPStatus::EAccepted) |
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
201 |
{ |
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
202 |
iLastStatusCode = KErrNone; |
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
203 |
} |
2 | 204 |
|
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
205 |
iHttpClient->ClientRequestCompleteL(iLastStatusCode); |
2 | 206 |
} break; |
207 |
case THTTPEvent::ERedirectedPermanently: |
|
208 |
{ |
|
209 |
DP("Permanent Redirection"); |
|
210 |
} break; |
|
211 |
case THTTPEvent::ERedirectedTemporarily: |
|
212 |
{ |
|
213 |
DP("Temporary Redirection"); |
|
214 |
} break; |
|
215 |
default: |
|
216 |
{ |
|
217 |
DP1("<unrecognised event: %d>", aEvent.iStatus); |
|
218 |
// close off the transaction if it's an error |
|
219 |
if (aEvent.iStatus < 0) |
|
220 |
{ |
|
172
c2a99fe1afd0
Proposed fix for bug 2931
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
163
diff
changeset
|
221 |
iFileOpen = EFalse; |
126 | 222 |
iRespBodyFile.Close(); |
2 | 223 |
aTransaction.Close(); |
224 |
iHttpClient->ClientRequestCompleteL(aEvent.iStatus); |
|
225 |
} |
|
226 |
} break; |
|
227 |
} |
|
228 |
} |
|
229 |
||
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
230 |
TInt CHttpEventHandler::MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& /*aEvent*/) |
2 | 231 |
{ |
232 |
DP1("MHFRunError fired with error code %d", aError); |
|
117
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
233 |
aTransaction.Close(); |
3b59b88b089e
Fixed Code Scanner L-issues; Further improvements to HTTP robustness
teknolog
parents:
116
diff
changeset
|
234 |
TRAP_IGNORE(iHttpClient->ClientRequestCompleteL(aError)); |
2 | 235 |
return KErrNone; |
236 |
} |
|
237 |
||
238 |
void CHttpEventHandler::SetSaveFileName(const TDesC &fName, TBool aContinue) |
|
239 |
{ |
|
163
f94dbd678dda
Fix for bug 3183; merging minor differences with symbian1 branch
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
126
diff
changeset
|
240 |
DP1("CHttpEventHandler::SetSaveFileName, aContinue=%d", aContinue); |
2 | 241 |
iFileName.Copy(fName); |
242 |
iContinue = aContinue; |
|
243 |
} |
|
244 |
||
245 |
void CHttpEventHandler::DumpRespHeadersL(RHTTPTransaction& aTrans) |
|
246 |
{ |
|
247 |
RHTTPResponse resp = aTrans.Response(); |
|
248 |
RStringPool strP = aTrans.Session().StringPool(); |
|
249 |
RHTTPHeaders hdr = resp.GetHeaderCollection(); |
|
250 |
THTTPHdrFieldIter it = hdr.Fields(); |
|
251 |
||
252 |
TBuf<KMaxHeaderNameLen> fieldName16; |
|
253 |
TBuf<KMaxHeaderValueLen> fieldVal16; |
|
254 |
||
255 |
while (it.AtEnd() == EFalse) |
|
256 |
{ |
|
257 |
RStringTokenF fieldName = it(); |
|
258 |
RStringF fieldNameStr = strP.StringF(fieldName); |
|
259 |
THTTPHdrVal fieldVal; |
|
260 |
if (hdr.GetField(fieldNameStr,0,fieldVal) == KErrNone) |
|
261 |
{ |
|
262 |
const TDesC8& fieldNameDesC = fieldNameStr.DesC(); |
|
263 |
fieldName16.Copy(fieldNameDesC.Left(KMaxHeaderNameLen)); |
|
264 |
switch (fieldVal.Type()) |
|
265 |
{ |
|
266 |
case THTTPHdrVal::KTIntVal: |
|
267 |
DP2("%S: %d", &fieldName16, fieldVal.Int()); |
|
268 |
break; |
|
269 |
case THTTPHdrVal::KStrFVal: |
|
270 |
{ |
|
271 |
RStringF fieldValStr = strP.StringF(fieldVal.StrF()); |
|
272 |
const TDesC8& fieldValDesC = fieldValStr.DesC(); |
|
273 |
fieldVal16.Copy(fieldValDesC.Left(KMaxHeaderValueLen)); |
|
274 |
DP2("%S: %S", &fieldName16, &fieldVal16); |
|
275 |
} |
|
276 |
break; |
|
277 |
case THTTPHdrVal::KStrVal: |
|
278 |
{ |
|
279 |
RString fieldValStr = strP.String(fieldVal.Str()); |
|
280 |
const TDesC8& fieldValDesC = fieldValStr.DesC(); |
|
281 |
fieldVal16.Copy(fieldValDesC.Left(KMaxHeaderValueLen)); |
|
282 |
DP2("%S: %S", &fieldName16, &fieldVal16); |
|
283 |
} |
|
284 |
break; |
|
285 |
case THTTPHdrVal::KDateVal: |
|
286 |
{ |
|
287 |
TDateTime date = fieldVal.DateTime(); |
|
288 |
} |
|
289 |
break; |
|
290 |
default: |
|
291 |
DP1("%S: <unrecognised value type>", &fieldName16); |
|
292 |
break; |
|
293 |
} |
|
294 |
||
295 |
// Display realm for WWW-Authenticate header |
|
296 |
RStringF wwwAuth = strP.StringF(HTTP::EWWWAuthenticate,RHTTPSession::GetTable()); |
|
297 |
if (fieldNameStr == wwwAuth) |
|
298 |
{ |
|
299 |
// check the auth scheme is 'basic' |
|
300 |
RStringF basic = strP.StringF(HTTP::EBasic,RHTTPSession::GetTable()); |
|
301 |
RStringF realm = strP.StringF(HTTP::ERealm,RHTTPSession::GetTable()); |
|
302 |
THTTPHdrVal realmVal; |
|
303 |
if ((fieldVal.StrF() == basic) && |
|
304 |
(!hdr.GetParam(wwwAuth, realm, realmVal))) |
|
305 |
{ |
|
306 |
RStringF realmValStr = strP.StringF(realmVal.StrF()); |
|
307 |
fieldVal16.Copy(realmValStr.DesC()); |
|
308 |
DP1("Realm is: %S", &fieldVal16); |
|
309 |
} |
|
310 |
} |
|
311 |
} |
|
312 |
++it; |
|
313 |
} |
|
314 |
} |
|
315 |
||
316 |
void CHttpEventHandler::DumpRespBody(RHTTPTransaction& aTrans) |
|
317 |
{ |
|
318 |
MHTTPDataSupplier* body = aTrans.Response().Body(); |
|
319 |
TPtrC8 dataChunk; |
|
320 |
TBool isLast = body->GetNextDataPart(dataChunk); |
|
321 |
DumpIt(dataChunk); |
|
322 |
if (isLast) |
|
323 |
DP("Got last data chunk."); |
|
324 |
} |
|
325 |
||
326 |
||
327 |
void CHttpEventHandler::DumpIt(const TDesC8& aData) |
|
328 |
//Do a formatted dump of binary data |
|
329 |
{ |
|
330 |
// Iterate the supplied block of data in blocks of cols=80 bytes |
|
331 |
const TInt cols=16; |
|
332 |
TInt pos = 0; |
|
333 |
TBuf<KMaxFileName - 2> logLine; |
|
334 |
TBuf<KMaxFileName - 2> anEntry; |
|
335 |
const TInt dataLength = aData.Length(); |
|
336 |
||
337 |
while (pos < dataLength) |
|
338 |
{ |
|
339 |
//start-line hexadecimal( a 4 digit number) |
|
340 |
anEntry.Format(TRefByValue<const TDesC>_L("%04x : "), pos); |
|
341 |
logLine.Append(anEntry); |
|
342 |
||
343 |
// Hex output |
|
344 |
TInt offset; |
|
345 |
for (offset = 0; offset < cols; ++offset) |
|
346 |
{ |
|
347 |
if (pos + offset < aData.Length()) |
|
348 |
{ |
|
349 |
TInt nextByte = aData[pos + offset]; |
|
350 |
anEntry.Format(TRefByValue<const TDesC>_L("%02x "), nextByte); |
|
351 |
logLine.Append(anEntry); |
|
352 |
} |
|
353 |
else |
|
354 |
{ |
|
355 |
//fill the remaining spaces with blanks untill the cols-th Hex number |
|
356 |
anEntry.Format(TRefByValue<const TDesC>_L(" ")); |
|
357 |
logLine.Append(anEntry); |
|
358 |
} |
|
359 |
} |
|
360 |
anEntry.Format(TRefByValue<const TDesC>_L(": ")); |
|
361 |
logLine.Append(anEntry); |
|
362 |
||
363 |
// Char output |
|
364 |
for (offset = 0; offset < cols; ++offset) |
|
365 |
{ |
|
366 |
if (pos + offset < aData.Length()) |
|
367 |
{ |
|
368 |
TInt nextByte = aData[pos + offset]; |
|
369 |
if ((nextByte >= ' ') && (nextByte <= '~')) |
|
370 |
{ |
|
371 |
anEntry.Format(TRefByValue<const TDesC>_L("%c"), nextByte); |
|
372 |
logLine.Append(anEntry); |
|
373 |
} |
|
374 |
else |
|
375 |
{ |
|
376 |
anEntry.Format(TRefByValue<const TDesC>_L(".")); |
|
377 |
logLine.Append(anEntry); |
|
378 |
} |
|
379 |
} |
|
380 |
else |
|
381 |
{ |
|
382 |
anEntry.Format(TRefByValue<const TDesC>_L(" ")); |
|
383 |
logLine.Append(anEntry); |
|
384 |
} |
|
385 |
} |
|
386 |
logLine.Zero(); |
|
387 |
||
388 |
// Advance to next byte segment (1 seg= cols) |
|
389 |
pos += cols; |
|
390 |
} |
|
391 |
} |
|
392 |
||
393 |
void CHttpEventHandler::SetSilent(TBool aSilent) |
|
394 |
{ |
|
395 |
iSilent = aSilent; |
|
396 |
} |
|
397 |
||
398 |
void CHttpEventHandler::CloseSaveFile() |
|
399 |
{ |
|
400 |
if(iRespBody != NULL) |
|
401 |
{ |
|
402 |
if(iRespBodyFile.SubSessionHandle() != 0) |
|
403 |
{ |
|
404 |
TInt size; |
|
405 |
iRespBodyFile.Size(size); |
|
406 |
DP2("Closing file at size %d, bytes downloaded %d", size, iBytesDownloaded); |
|
407 |
iRespBodyFile.Close(); |
|
408 |
} |
|
409 |
} |
|
410 |
} |
|
411 |