11#include " http_download.h"
22
33#include < yql/essentials/core/file_storage/proto/file_storage.pb.h>
4- #include < yql/essentials/core/file_storage/http_download/proto/http_download.pb.h>
54#include < yql/essentials/core/file_storage/download/download_stream.h>
65#include < yql/essentials/core/file_storage/download/download_config.h>
76#include < yql/essentials/core/file_storage/defs/downloader.h>
7+ #include < yql/essentials/utils/fetch/proto/fetch_config.pb.h>
88#include < yql/essentials/utils/fetch/fetch.h>
99#include < yql/essentials/utils/log/context.h>
1010#include < yql/essentials/utils/md5_stream.h>
2222
2323namespace NYql {
2424
25- class THttpDownloader : public TDownloadConfig <THttpDownloader, THttpDownloaderConfig >, public NYql::NFS::IDownloader {
25+ class THttpDownloader : public TDownloadConfig <THttpDownloader, TFetchConfig >, public NYql::NFS::IDownloader {
2626public:
2727 THttpDownloader (const TFileStorageConfig& config)
2828 : UseFakeChecksums(GetEnv(" YQL_LOCAL" ) == " 1" )
@@ -31,7 +31,7 @@ class THttpDownloader: public TDownloadConfig<THttpDownloader, THttpDownloaderCo
3131 }
3232 ~THttpDownloader () = default ;
3333
34- void DoConfigure (const THttpDownloaderConfig & cfg) {
34+ void DoConfigure (const TFetchConfig & cfg) {
3535 Policy_ = IRetryPolicy<unsigned >::GetExponentialBackoffPolicy (
3636 DefaultClassifyHttpCode,
3737 TDuration::MilliSeconds (cfg.GetMinDelayMs ()),
@@ -41,7 +41,7 @@ class THttpDownloader: public TDownloadConfig<THttpDownloader, THttpDownloaderCo
4141 TDuration::MilliSeconds (cfg.GetMaxTotalDelayTimeMs ()),
4242 cfg.GetScale ());
4343 Redirects_ = cfg.GetMaxRedirects ();
44- SocketTimeoutMs = cfg.GetSocketTimeoutMs ();
44+ TimeoutMs = cfg.GetTimeoutMs ();
4545 }
4646
4747 bool Accept (const THttpURL& url) final {
@@ -56,7 +56,7 @@ class THttpDownloader: public TDownloadConfig<THttpDownloader, THttpDownloaderCo
5656 }
5757
5858 std::tuple<NYql::NFS::TDataProvider, TString, TString> Download (const THttpURL& url, const TString& token, const TString& oldEtag, const TString& oldLastModified) final {
59- TFetchResultPtr fr1 = FetchWithETagAndLastModified (url, token, oldEtag, oldLastModified, SocketTimeoutMs , Redirects_, Policy_);
59+ TFetchResultPtr fr1 = FetchWithETagAndLastModified (url, token, oldEtag, oldLastModified, TimeoutMs , Redirects_, Policy_);
6060 switch (fr1->GetRetCode ()) {
6161 case HTTP_NOT_MODIFIED:
6262 return std::make_tuple (NYql::NFS::TDataProvider{}, TString{}, TString{});
@@ -76,7 +76,7 @@ class THttpDownloader: public TDownloadConfig<THttpDownloader, THttpDownloaderCo
7676 }
7777
7878private:
79- static TFetchResultPtr FetchWithETagAndLastModified (const THttpURL& url, const TString& token, const TString& oldEtag, const TString& oldLastModified, ui32 socketTimeoutMs , size_t redirects, const IRetryPolicy<unsigned >::TPtr& policy) {
79+ static TFetchResultPtr FetchWithETagAndLastModified (const THttpURL& url, const TString& token, const TString& oldEtag, const TString& oldLastModified, ui32 timeoutMs , size_t redirects, const IRetryPolicy<unsigned >::TPtr& policy) {
8080 // more details about ETag and ModifiedSince: https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26
8181 THttpHeaders headers;
8282 if (!token.empty ()) {
@@ -91,7 +91,7 @@ class THttpDownloader: public TDownloadConfig<THttpDownloader, THttpDownloaderCo
9191 }
9292
9393 try {
94- return Fetch (url, headers, TDuration::MilliSeconds (socketTimeoutMs ), redirects, policy);
94+ return Fetch (url, headers, TDuration::MilliSeconds (timeoutMs ), redirects, policy);
9595 } catch (const std::exception& e) {
9696 // remap exception type to leverage retry logic
9797 throw TDownloadError () << e.what ();
@@ -159,7 +159,7 @@ class THttpDownloader: public TDownloadConfig<THttpDownloader, THttpDownloaderCo
159159private:
160160 const bool UseFakeChecksums = false ;
161161 IRetryPolicy<unsigned >::TPtr Policy_;
162- ui32 SocketTimeoutMs = 300000 ;
162+ ui32 TimeoutMs = 300000 ;
163163 size_t Redirects_ = 10 ;
164164};
165165
0 commit comments