aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/utils/fetch/fetch.h
blob: d9e1c3c1a579382bccab26d8515cbc51e7957e8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <library/cpp/uri/http_url.h>
#include <library/cpp/http/io/headers.h>
#include <library/cpp/http/io/stream.h>

#include <util/datetime/base.h>
#include <util/generic/string.h>
#include <util/generic/ptr.h>

namespace NYql {

struct IFetchResult: public TThrRefBase {
    virtual THttpInput& GetStream() = 0;
    virtual unsigned GetRetCode() = 0;
    virtual THttpURL GetRedirectURL(const THttpURL& baseUrl) = 0;
};

using TFetchResultPtr = TIntrusivePtr<IFetchResult>;

THttpURL ParseURL(const TStringBuf addr);
TFetchResultPtr Fetch(const THttpURL& url, const THttpHeaders& additionalHeaders = {}, const TDuration& timeout = TDuration::Max(), size_t retries = 3, size_t redirects = 10);

} // NYql