browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp
changeset 10 a359256acfc6
parent 5 10e98eab6f85
child 11 c8a366e56285
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
    58 const TInt   KUrlFixChar = '_';
    58 const TInt   KUrlFixChar = '_';
    59 const TInt KMaxHeaderOfMultipart = 32000;
    59 const TInt KMaxHeaderOfMultipart = 32000;
    60 const TInt KRespSizeForRecognition = 1024;  //for THttpProgressState EHttpContTypeRecognitionAvail
    60 const TInt KRespSizeForRecognition = 1024;  //for THttpProgressState EHttpContTypeRecognitionAvail
    61 const TInt KMinDataSizeToSend = (32*1024);  //for Browser Control to call NewDownloadL     
    61 const TInt KMinDataSizeToSend = (32*1024);  //for Browser Control to call NewDownloadL     
    62 const TInt KErrCodHttpDownloadPaused = -20045;  //Error code set by the CodHandler if the download is paused by the client
    62 const TInt KErrCodHttpDownloadPaused = -20045;  //Error code set by the CodHandler if the download is paused by the client
    63 
    63 const TInt KHttp903LossOfService = 903; //Error code set by the CodHandler if connection is lost
       
    64 const TInt KHttp954LoaderError = 954; //Error code set by the CodHandler if Loader error is found
    64 _LIT8( KHttpScheme, "http" );
    65 _LIT8( KHttpScheme, "http" );
    65 _LIT8( KHttpsScheme, "https" );
    66 _LIT8( KHttpsScheme, "https" );
    66 _LIT8( KDefDestFilename, "content.bin" );
    67 _LIT8( KDefDestFilename, "content.bin" );
    67 _LIT8( KSchemeAddon, "://" );
    68 _LIT8( KSchemeAddon, "://" );
    68 _LIT8( KBoundary, "boundary=" );
    69 _LIT8( KBoundary, "boundary=" );
  3170 	    mediaData->SetTempFilenameL( updatedMediaData->DestFilename() );
  3171 	    mediaData->SetTempFilenameL( updatedMediaData->DestFilename() );
  3171 	    	    
  3172 	    	    
  3172     	mediaData->ResetTypes();
  3173     	mediaData->ResetTypes();
  3173     	for (TInt type = 0; type < updatedMediaData->TypesCount(); ++type)
  3174     	for (TInt type = 0; type < updatedMediaData->TypesCount(); ++type)
  3174         	mediaData->AddTypeL( updatedMediaData->Types().MdcaPoint(type) );
  3175         	mediaData->AddTypeL( updatedMediaData->Types().MdcaPoint(type) );
  3175         
  3176         mediaData->SetStatusCode( updatedMediaData->StatusCode() );
  3176         TInt result = updatedMediaData->Result();
  3177         TInt result = updatedMediaData->Result();
  3177         
  3178         TInt statusCode = updatedMediaData->StatusCode();
       
  3179         TBool pausable = updatedMediaData->Pausable();
  3178         //New track download Begins.Hence make track size as 0
  3180         //New track download Begins.Hence make track size as 0
  3179         //iStorage->SetDownloadedSize ( 0 );
  3181         //iStorage->SetDownloadedSize ( 0 );
  3180         // Active MO completed OR failed. Notify clients.
  3182         // Active MO completed OR failed. Notify clients.
  3181         if (mediaData->Result() == 0)
  3183         if (mediaData->Result() == 0)
  3182             {
  3184             {
  3200 	        	    iLastError = EGeneral;
  3202 	        	    iLastError = EGeneral;
  3201 	           	    }
  3203 	           	    }
  3202                 }
  3204                 }
  3203             
  3205             
  3204             //if the client pauses the download, Codhandler sets error code to KErrCodHttpDownloadPaused. In that case, no need to trigger EHttpDlFailed Event     
  3206             //if the client pauses the download, Codhandler sets error code to KErrCodHttpDownloadPaused. In that case, no need to trigger EHttpDlFailed Event     
  3205             if ( result != KErrCodHttpDownloadPaused )
  3207             if ( !( result == KErrCodHttpDownloadPaused || ( pausable && statusCode == KHttp903LossOfService ) || ( pausable && statusCode == KHttp954LoaderError ) ) )
  3206                 {    
  3208                 {    
  3207     	        TriggerEvent( EHttpDlFailed, EHttpProgNone );
  3209     	        TriggerEvent( EHttpDlFailed, EHttpProgNone );
  3208                 }
  3210                 }
  3209             }
  3211             }
  3210     	}
  3212     	}
  6559         fieldName = (*aHeaders)[i]->FieldName();
  6561         fieldName = (*aHeaders)[i]->FieldName();
  6560         fieldRawData = (*aHeaders)[i]->FieldRawData();
  6562         fieldRawData = (*aHeaders)[i]->FieldRawData();
  6561         
  6563         
  6562         size = size + fieldName->Size() +  fieldRawData->Size();
  6564         size = size + fieldName->Size() +  fieldRawData->Size();
  6563         
  6565         
  6564         CLOG_WRITE8_1( "Size = %S:", size );
  6566         CLOG_WRITE8_1( "Size = %d:", size );
  6565         }
  6567         }
  6566 
  6568 
  6567     return size;
  6569     return size;
  6568     
  6570     
  6569     }
  6571     }