aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http
diff options
context:
space:
mode:
authormyltsev <myltsev@yandex-team.ru>2022-02-10 16:46:03 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:03 +0300
commit9166d66c30c23c9e85a7c88185a068987148d23f (patch)
tree421bdcec5755d9e441c485560aab5ab8d74c7475 /library/cpp/http
parent8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3 (diff)
downloadydb-9166d66c30c23c9e85a7c88185a068987148d23f.tar.gz
Restoring authorship annotation for <myltsev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http')
-rw-r--r--library/cpp/http/io/headers.cpp12
-rw-r--r--library/cpp/http/io/headers.h4
-rw-r--r--library/cpp/http/io/stream.cpp8
-rw-r--r--library/cpp/http/io/stream_ut.cpp36
-rw-r--r--library/cpp/http/misc/httpdate.cpp6
-rw-r--r--library/cpp/http/misc/httpdate.h2
-rw-r--r--library/cpp/http/misc/httpdate_ut.cpp4
-rw-r--r--library/cpp/http/server/response.h8
8 files changed, 40 insertions, 40 deletions
diff --git a/library/cpp/http/io/headers.cpp b/library/cpp/http/io/headers.cpp
index 4ec27a29e8..fe82383318 100644
--- a/library/cpp/http/io/headers.cpp
+++ b/library/cpp/http/io/headers.cpp
@@ -75,12 +75,12 @@ const THttpInputHeader* THttpHeaders::FindHeader(const TStringBuf header) const
void THttpHeaders::RemoveHeader(const TStringBuf header) {
for (auto h = Headers_.begin(); h != Headers_.end(); ++h) {
if (AsciiCompareIgnoreCase(h->Name(), header) == 0) {
- Headers_.erase(h);
- return;
- }
- }
-}
-
+ Headers_.erase(h);
+ return;
+ }
+ }
+}
+
void THttpHeaders::AddOrReplaceHeader(const THttpInputHeader& header) {
for (auto& hdr : Headers_) {
if (AsciiCompareIgnoreCase(hdr.Name(), header.Name()) == 0) {
diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h
index a71793d1c6..3b15d60462 100644
--- a/library/cpp/http/io/headers.h
+++ b/library/cpp/http/io/headers.h
@@ -102,9 +102,9 @@ public:
// Проверяет, есть ли такой заголовок
bool HasHeader(TStringBuf header) const;
- /// Удаляет заголовок, если он есть.
+ /// Удаляет заголовок, если он есть.
void RemoveHeader(TStringBuf header);
-
+
/// Ищет заголовок по указанному имени
/// Возвращает nullptr, если не нашел
const THttpInputHeader* FindHeader(TStringBuf header) const;
diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp
index 6689be684f..90d063a4ba 100644
--- a/library/cpp/http/io/stream.cpp
+++ b/library/cpp/http/io/stream.cpp
@@ -776,7 +776,7 @@ private:
TString scheme = Request_->BestCompressionScheme(ComprSchemas_);
if (scheme != "identity") {
AddOrReplaceHeader(THttpInputHeader("Content-Encoding", scheme));
- RemoveHeader("Content-Length");
+ RemoveHeader("Content-Length");
}
}
@@ -851,9 +851,9 @@ private:
}
inline void RemoveHeader(const TString& hdr) {
- Headers_.RemoveHeader(hdr);
- }
-
+ Headers_.RemoveHeader(hdr);
+ }
+
private:
IOutputStream* Slave_;
TState State_;
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp
index 1ea35df675..64b48b4a66 100644
--- a/library/cpp/http/io/stream_ut.cpp
+++ b/library/cpp/http/io/stream_ut.cpp
@@ -420,27 +420,27 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) {
}
Y_UNIT_TEST(ContentLengthRemoval) {
- TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip\r\n\r\n");
- THttpInput i(&request);
+ TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip\r\n\r\n");
+ THttpInput i(&request);
TString result;
- TStringOutput out(result);
- THttpOutput httpOut(&out, &i);
-
- httpOut.EnableKeepAlive(true);
- httpOut.EnableCompression(true);
- httpOut << "HTTP/1.1 200 OK\r\n";
- char answer[] = "Mary had a little lamb.";
+ TStringOutput out(result);
+ THttpOutput httpOut(&out, &i);
+
+ httpOut.EnableKeepAlive(true);
+ httpOut.EnableCompression(true);
+ httpOut << "HTTP/1.1 200 OK\r\n";
+ char answer[] = "Mary had a little lamb.";
httpOut << "Content-Length: " << strlen(answer) << "\r\n"
"\r\n";
- httpOut << answer;
- httpOut.Finish();
-
- Cdbg << result;
- result.to_lower();
- UNIT_ASSERT(result.Contains("content-encoding: gzip"));
- UNIT_ASSERT(!result.Contains("content-length"));
- }
-
+ httpOut << answer;
+ httpOut.Finish();
+
+ Cdbg << result;
+ result.to_lower();
+ UNIT_ASSERT(result.Contains("content-encoding: gzip"));
+ UNIT_ASSERT(!result.Contains("content-length"));
+ }
+
Y_UNIT_TEST(CodecsPriority) {
TMemoryInput request("GET / HTTP/1.1\r\nAccept-Encoding: gzip, br\r\n\r\n");
TVector<TStringBuf> codecs = {"br", "gzip"};
diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp
index 4a3031bbf4..1d6617eeec 100644
--- a/library/cpp/http/misc/httpdate.cpp
+++ b/library/cpp/http/misc/httpdate.cpp
@@ -75,9 +75,9 @@ char* format_http_date(time_t when, char* buf, size_t buflen) {
return buf;
}
-
+
TString FormatHttpDate(time_t when) {
- char str[64] = {0};
+ char str[64] = {0};
format_http_date(str, Y_ARRAY_SIZE(str), when);
return TString(str);
-}
+}
diff --git a/library/cpp/http/misc/httpdate.h b/library/cpp/http/misc/httpdate.h
index 04876f38fe..2a33545a7e 100644
--- a/library/cpp/http/misc/httpdate.h
+++ b/library/cpp/http/misc/httpdate.h
@@ -17,5 +17,5 @@ inline time_t parse_http_date(const TStringBuf& datestring) {
int format_http_date(char buf[], size_t size, time_t when);
char* format_http_date(time_t when, char* buf, size_t len);
-
+
TString FormatHttpDate(time_t when);
diff --git a/library/cpp/http/misc/httpdate_ut.cpp b/library/cpp/http/misc/httpdate_ut.cpp
index c1a0103501..8d700a9593 100644
--- a/library/cpp/http/misc/httpdate_ut.cpp
+++ b/library/cpp/http/misc/httpdate_ut.cpp
@@ -10,6 +10,6 @@ Y_UNIT_TEST_SUITE(TestHttpDate) {
UNIT_ASSERT((int)strlen(format_http_date(0, buf1, sizeof(buf1))) == format_http_date(buf2, sizeof(buf2), 0));
}
Y_UNIT_TEST(Test2) {
- UNIT_ASSERT_STRINGS_EQUAL(FormatHttpDate(1234567890), "Fri, 13 Feb 2009 23:31:30 GMT");
- }
+ UNIT_ASSERT_STRINGS_EQUAL(FormatHttpDate(1234567890), "Fri, 13 Feb 2009 23:31:30 GMT");
+ }
}
diff --git a/library/cpp/http/server/response.h b/library/cpp/http/server/response.h
index a75cb85605..05a4d53caa 100644
--- a/library/cpp/http/server/response.h
+++ b/library/cpp/http/server/response.h
@@ -51,10 +51,10 @@ public:
return *this;
}
- TString GetContent() const {
- return Content;
- }
-
+ TString GetContent() const {
+ return Content;
+ }
+
/**
* @note If @arg content isn't empty its size is automatically added as a
* "Content-Length" header during output to IOutputStream.