equal
deleted
inserted
replaced
12 #include "debug.h" |
12 #include "debug.h" |
13 #include "constants.h" |
13 #include "constants.h" |
14 #include "HttpClient.h" |
14 #include "HttpClient.h" |
15 #include "connectionengine.h" |
15 #include "connectionengine.h" |
16 #include "settingsengine.h" |
16 #include "settingsengine.h" |
|
17 #include "Podcatcher.pan" |
17 |
18 |
18 const TInt KTempBufferSize = 100; |
19 const TInt KTempBufferSize = 100; |
19 |
20 |
20 CHttpClient::~CHttpClient() |
21 CHttpClient::~CHttpClient() |
21 { |
22 { |
157 TBuf8<KTempBufferSize> rangeText; |
158 TBuf8<KTempBufferSize> rangeText; |
158 |
159 |
159 if (iResumeEnabled && iPodcastModel.FsSession().Entry(iCurrentFileName, entry) == KErrNone) { |
160 if (iResumeEnabled && iPodcastModel.FsSession().Entry(iCurrentFileName, entry) == KErrNone) { |
160 DP1("Found file, with size=%d", entry.iSize); |
161 DP1("Found file, with size=%d", entry.iSize); |
161 // file exists, so we should probably resume |
162 // file exists, so we should probably resume |
162 rangeText.Format(_L8("bytes=%d-"), entry.iSize-KByteOverlap); |
163 rangeText.Format(_L8("bytes=%d-"), (entry.iSize-KByteOverlap > 0 ? entry.iSize-KByteOverlap : 0)); |
163 iHandler->SetSaveFileName(iCurrentFileName, ETrue); |
164 iHandler->SetSaveFileName(iCurrentFileName, ETrue); |
164 } else { |
165 } else { |
165 // otherwise just make sure the directory exists |
166 // otherwise just make sure the directory exists |
166 BaflUtils::EnsurePathExistsL(iPodcastModel.FsSession(),iCurrentFileName); |
167 BaflUtils::EnsurePathExistsL(iPodcastModel.FsSession(),iCurrentFileName); |
167 iHandler->SetSaveFileName(iCurrentFileName); |
168 iHandler->SetSaveFileName(iCurrentFileName); |
190 } |
191 } |
191 |
192 |
192 TBool CHttpClient::GetL(const TDesC& aUrl, const TDesC& aFileName, TBool aSilent) { |
193 TBool CHttpClient::GetL(const TDesC& aUrl, const TDesC& aFileName, TBool aSilent) { |
193 DP("CHttpClient::Get START"); |
194 DP("CHttpClient::Get START"); |
194 DP2("Getting '%S' to '%S'", &aUrl, &aFileName); |
195 DP2("Getting '%S' to '%S'", &aUrl, &aFileName); |
195 __ASSERT_DEBUG((iIsActive==EFalse), User::Panic(_L("Already active"), -2)); |
196 __ASSERT_DEBUG((iIsActive==EFalse), Panic(EPodcatcherPanicAlreadyActive)); |
196 iCurrentURL.Copy(aUrl); |
197 iCurrentURL.Copy(aUrl); |
197 |
198 |
198 TInt urlError = iUriParser.Parse(iCurrentURL); |
199 TInt urlError = iUriParser.Parse(iCurrentURL); |
199 |
200 |
200 if(urlError != KErrNone ||!iUriParser.IsSchemeValid()) |
201 if(urlError != KErrNone ||!iUriParser.IsSchemeValid()) |