summaryrefslogtreecommitdiffstats
path: root/library/cpp/http/client/fetch/fetch_request.cpp
diff options
context:
space:
mode:
authorqrort <[email protected]>2022-12-02 11:31:25 +0300
committerqrort <[email protected]>2022-12-02 11:31:25 +0300
commitb1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806 (patch)
tree2a23209faf0fea5586a6d4b9cee60d1b318d29fe /library/cpp/http/client/fetch/fetch_request.cpp
parent559174a9144de40d6bb3997ea4073c82289b4974 (diff)
remove kikimr/driver DEPENDS
Diffstat (limited to 'library/cpp/http/client/fetch/fetch_request.cpp')
-rw-r--r--library/cpp/http/client/fetch/fetch_request.cpp114
1 files changed, 0 insertions, 114 deletions
diff --git a/library/cpp/http/client/fetch/fetch_request.cpp b/library/cpp/http/client/fetch/fetch_request.cpp
deleted file mode 100644
index 2f8453fc457..00000000000
--- a/library/cpp/http/client/fetch/fetch_request.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-#include "fetch_request.h"
-
-#include <library/cpp/deprecated/atomic/atomic.h>
-
-// TRequest
-namespace NHttpFetcher {
- const TString DEFAULT_ACCEPT_ENCODING = "gzip, deflate";
- const size_t DEFAULT_MAX_HEADER_SIZE = 100 << 10;
- const size_t DEFAULT_MAX_BODY_SIZE = 1 << 29;
-
- TRequest::TRequest(const TString& url, TCallBack onFetch)
- : Url(url)
- , Deadline(TInstant::Now() + DEFAULT_REQUEST_TIMEOUT)
- , Freshness(DEFAULT_REQUEST_FRESHNESS)
- , Priority(40)
- , IgnoreRobotsTxt(false)
- , LangRegion(ELR_RU)
- , OnFetch(onFetch)
- , AcceptEncoding(DEFAULT_ACCEPT_ENCODING)
- , OnlyHeaders(false)
- , MaxHeaderSize(DEFAULT_MAX_HEADER_SIZE)
- , MaxBodySize(DEFAULT_MAX_BODY_SIZE)
- {
- GenerateSequence();
- }
-
- TRequest::TRequest(const TString& url, bool ignoreRobotsTxt, TDuration timeout, TDuration freshness, TCallBack onFetch)
- : Url(url)
- , Deadline(Now() + timeout)
- , Freshness(freshness)
- , Priority(40)
- , IgnoreRobotsTxt(ignoreRobotsTxt)
- , LangRegion(ELR_RU)
- , OnFetch(onFetch)
- , AcceptEncoding(DEFAULT_ACCEPT_ENCODING)
- , OnlyHeaders(false)
- , MaxHeaderSize(DEFAULT_MAX_HEADER_SIZE)
- , MaxBodySize(DEFAULT_MAX_BODY_SIZE)
- {
- GenerateSequence();
- }
-
- TRequest::TRequest(const TString& url, TDuration timeout, TDuration freshness, bool ignoreRobots,
- size_t priority, const TMaybe<TString>& login, const TMaybe<TString>& password,
- ELangRegion langRegion, TCallBack onFetch)
- : Url(url)
- , Deadline(Now() + timeout)
- , Freshness(freshness)
- , Priority(priority)
- , Login(login)
- , Password(password)
- , IgnoreRobotsTxt(ignoreRobots)
- , LangRegion(langRegion)
- , OnFetch(onFetch)
- , AcceptEncoding(DEFAULT_ACCEPT_ENCODING)
- , OnlyHeaders(false)
- , MaxHeaderSize(DEFAULT_MAX_HEADER_SIZE)
- , MaxBodySize(DEFAULT_MAX_BODY_SIZE)
- {
- GenerateSequence();
- }
-
- void TRequest::GenerateSequence() {
- static TAtomic nextSeq = 0;
- Sequence = AtomicIncrement(nextSeq);
- }
-
- TRequestRef TRequest::Clone() {
- THolder<TRequest> request = THolder<TRequest>(new TRequest(*this));
- request->GenerateSequence();
- return request.Release();
- }
-
- void TRequest::Dump(IOutputStream& out) {
- out << "url: " << Url << "\n";
- out << "timeout: " << (Deadline - Now()).MilliSeconds() << " ms\n";
- out << "freshness: " << Freshness.Seconds() << "\n";
- out << "priority: " << Priority << "\n";
- if (!!Login) {
- out << "login: " << *Login << "\n";
- }
- if (!!Password) {
- out << "password: " << *Password << "\n";
- }
- if (!!OAuthToken) {
- out << "oauth token: " << *OAuthToken << "\n";
- }
- if (IgnoreRobotsTxt) {
- out << "ignore robots: " << IgnoreRobotsTxt << "\n";
- }
- out << "lang reg: " << LangRegion2Str(LangRegion) << "\n";
- if (!!CustomHost) {
- out << "custom host: " << *CustomHost << "\n";
- }
- if (!!UserAgent) {
- out << "user agent: " << *UserAgent << "\n";
- }
- if (!!AcceptEncoding) {
- out << "accept enc: " << *AcceptEncoding << "\n";
- }
- if (OnlyHeaders) {
- out << "only headers: " << OnlyHeaders << "\n";
- }
- out << "max header sz: " << MaxHeaderSize << "\n";
- out << "max body sz: " << MaxBodySize << "\n";
- if (!!PostData) {
- out << "post data: " << *PostData << "\n";
- }
- if (!!ContentType) {
- out << "content type: " << *ContentType << "\n";
- }
- }
-
-}