equal
deleted
inserted
replaced
17 */ |
17 */ |
18 |
18 |
19 // HttpEventHandler.cpp |
19 // HttpEventHandler.cpp |
20 #include <e32debug.h> |
20 #include <e32debug.h> |
21 #include <httperr.h> |
21 #include <httperr.h> |
|
22 #include <sysutil.h> |
22 #include "HttpEventHandler.h" |
23 #include "HttpEventHandler.h" |
23 #include "bautils.h" |
24 #include "bautils.h" |
24 #include "Httpclient.h" |
25 #include "Httpclient.h" |
|
26 |
|
27 const TInt64 KMinDiskSpace = 1024 * 1024; // at least 1 MB must remain |
25 |
28 |
26 void CHttpEventHandler::ConstructL() |
29 void CHttpEventHandler::ConstructL() |
27 { |
30 { |
28 //iVerbose = ETrue; |
31 //iVerbose = ETrue; |
29 } |
32 } |
146 iRespBody = aTransaction.Response().Body(); |
149 iRespBody = aTransaction.Response().Body(); |
147 |
150 |
148 // Some (more) body data has been received (in the HTTP response) |
151 // Some (more) body data has been received (in the HTTP response) |
149 //DumpRespBody(aTransaction); |
152 //DumpRespBody(aTransaction); |
150 //DP1("Saving: %d", iSavingResponseBody); |
153 //DP1("Saving: %d", iSavingResponseBody); |
|
154 |
|
155 // check if we have enough disk space |
|
156 if (iDriveNo != -1 && SysUtil::DiskSpaceBelowCriticalLevelL( &iFileServ, KMinDiskSpace, iDriveNo )) |
|
157 { |
|
158 TInt error = KErrDiskFull; |
|
159 iFileOpen = EFalse; |
|
160 iRespBodyFile.Close(); |
|
161 iCallbacks.FileError(error); |
|
162 iHttpClient->ClientRequestCompleteL(error); |
|
163 return; |
|
164 } |
|
165 |
151 // Append to the output file if we're saving responses |
166 // Append to the output file if we're saving responses |
152 if (iFileOpen) |
167 if (iFileOpen) |
153 { |
168 { |
154 TPtrC8 bodyData; |
169 TPtrC8 bodyData; |
155 iRespBody->GetNextDataPart(bodyData); |
170 iRespBody->GetNextDataPart(bodyData); |
237 void CHttpEventHandler::SetSaveFileName(const TDesC &fName, TBool aContinue) |
252 void CHttpEventHandler::SetSaveFileName(const TDesC &fName, TBool aContinue) |
238 { |
253 { |
239 DP1("CHttpEventHandler::SetSaveFileName, aContinue=%d", aContinue); |
254 DP1("CHttpEventHandler::SetSaveFileName, aContinue=%d", aContinue); |
240 iFileName.Copy(fName); |
255 iFileName.Copy(fName); |
241 iContinue = aContinue; |
256 iContinue = aContinue; |
|
257 |
|
258 switch(fName[0]) |
|
259 { |
|
260 case 'C': |
|
261 iDriveNo = EDriveC; |
|
262 break; |
|
263 case 'E': |
|
264 iDriveNo = EDriveE; |
|
265 break; |
|
266 case 'F': |
|
267 iDriveNo = EDriveF; |
|
268 break; |
|
269 case 'G': |
|
270 iDriveNo = EDriveG; |
|
271 break; |
|
272 default: |
|
273 iDriveNo = -1; |
|
274 break; |
|
275 } |
|
276 DP1("iDriveNo set to %d", iDriveNo); |
242 } |
277 } |
243 |
278 |
244 void CHttpEventHandler::DumpRespHeadersL(RHTTPTransaction& aTrans) |
279 void CHttpEventHandler::DumpRespHeadersL(RHTTPTransaction& aTrans) |
245 { |
280 { |
246 RHTTPResponse resp = aTrans.Response(); |
281 RHTTPResponse resp = aTrans.Response(); |