webengine/wmlengine/src/FileLoader/src/fileloader_cfilehandler.cpp
branchRCL_3
changeset 42 a1a5d4e727e8
parent 26 cb62a4f66ebe
equal deleted inserted replaced
41:4bd5176e1bc8 42:a1a5d4e727e8
   279                 //TPtr8 data( iData ); declared up
   279                 //TPtr8 data( iData ); declared up
   280                 //
   280                 //
   281                 TUint contentLength = 0;
   281                 TUint contentLength = 0;
   282 
   282 
   283                 const TUint16* responseUrl = (iRedirectedUrl == NULL) ? iUrl : iRedirectedUrl;
   283                 const TUint16* responseUrl = (iRedirectedUrl == NULL) ? iUrl : iRedirectedUrl;
   284             		
   284                 HBufC* newUrl = NULL;
   285 
   285 
   286                 if (iMethod == NW_URL_METHOD_GET)
   286                 if (iMethod == NW_URL_METHOD_GET)
   287 					{
   287 					{
   288 					TInt urlLen = 0;
   288 					TInt urlLen = 0;
   289 					if(bHasCharset)
   289 					if(bHasCharset)
   294 					{
   294 					{
   295 						urlLen = iData.Length() - position -1;
   295 						urlLen = iData.Length() - position -1;
   296 					}
   296 					}
   297 
   297 
   298 					//R->fake the url
   298 					//R->fake the url
   299 					HBufC* newUrl = HBufC::NewL( urlLen );
   299 					newUrl = HBufC::NewL( urlLen );
   300 					newUrl->Des().Copy(iData.Mid( position + 1, urlLen-1 ));
   300 					newUrl->Des().Copy(iData.Mid( position + 1, urlLen-1 ));
   301 					newUrl->Des().ZeroTerminate();				
   301 					newUrl->Des().ZeroTerminate();				
   302 
   302 
   303 					// Transfer ownership before calling Response
   303 					// Transfer ownership before calling Response
   304 					TUint8* data = new TUint8[position];
   304 					TUint8* data = new TUint8[position];
   311 
   311 
   312 					// Send the response
   312 					// Send the response
   313 					iFileLoader->PartialResponse( (TUint16*)newUrl->Ptr(), dataDes, NULL, contentTypeString, NULL, NW_FALSE, // multipart information is missing.
   313 					iFileLoader->PartialResponse( (TUint16*)newUrl->Ptr(), dataDes, NULL, contentTypeString, NULL, NW_FALSE, // multipart information is missing.
   314 						NULL, NULL, charset, NULL, Success, NW_URL_METHOD_GET, iTransId, 0 /*first chunk*/, NULL, dataDes.Length(),
   314 						NULL, NULL, charset, NULL, Success, NW_URL_METHOD_GET, iTransId, 0 /*first chunk*/, NULL, dataDes.Length(),
   315 						KErrNone, iLoadContext, iLoadCallback);
   315 						KErrNone, iLoadContext, iLoadCallback);
   316 					delete newUrl;
       
   317 					}
   316 					}
   318                 
   317                 
   319                 // Send the close response
   318                 // Send the close response
   320                 iContentType = NULL;
   319                 iContentType = NULL;
   321 				TPtr8 emptyData(NULL,0,0);     
   320 				TPtr8 emptyData(NULL,0,0);     
   322                 contentTypeString = iContentType;
   321                 contentTypeString = iContentType;
   323                 
   322                 
   324 				iFileLoader->PartialResponse( responseUrl, emptyData, NULL, contentTypeString, NULL, NW_FALSE, // multipart information is missing
   323 				iFileLoader->PartialResponse( responseUrl, emptyData, NULL, contentTypeString, NULL, NW_FALSE, // multipart information is missing
   325                   NULL, NULL, charset, NULL, Success, iMethod, iTransId, -1 /*last chunk*/, NULL, contentLength,
   324                   NULL, NULL, charset, NULL, Success, iMethod, iTransId, -1 /*last chunk*/, NULL, contentLength,
   326                   KErrNone, iLoadContext, iLoadCallback);
   325                   KErrNone, iLoadContext, iLoadCallback);
       
   326 
       
   327                 delete newUrl;
   327                 }
   328                 }
   328             else
   329             else
   329 				{
   330 				{
   330                     // No response sent with this content type string,
   331                     // No response sent with this content type string,
   331                     // (so no subsequent delete) delete it here.
   332                     // (so no subsequent delete) delete it here.