aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/server
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:48 +0300
commit9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/http/server
parent8cbc307de0221f84c80c42dcbe07d40727537e2c (diff)
downloadydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http/server')
-rw-r--r--library/cpp/http/server/conn.cpp2
-rw-r--r--library/cpp/http/server/http.cpp2
-rw-r--r--library/cpp/http/server/http_ut.cpp16
-rw-r--r--library/cpp/http/server/options.cpp2
-rw-r--r--library/cpp/http/server/response.cpp22
-rw-r--r--library/cpp/http/server/response.h12
-rw-r--r--library/cpp/http/server/response_ut.cpp22
7 files changed, 39 insertions, 39 deletions
diff --git a/library/cpp/http/server/conn.cpp b/library/cpp/http/server/conn.cpp
index 801656dc88..38a76c4c30 100644
--- a/library/cpp/http/server/conn.cpp
+++ b/library/cpp/http/server/conn.cpp
@@ -1,7 +1,7 @@
#include "conn.h"
#include <util/network/socket.h>
-#include <util/stream/buffered.h>
+#include <util/stream/buffered.h>
class THttpServerConn::TImpl {
public:
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index b8d634edec..128583bdd7 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -15,7 +15,7 @@
#include <util/system/defaults.h>
#include <util/system/event.h>
#include <util/system/mutex.h>
-#include <util/system/pipe.h>
+#include <util/system/pipe.h>
#include <util/system/thread.h>
#include <util/thread/factory.h>
diff --git a/library/cpp/http/server/http_ut.cpp b/library/cpp/http/server/http_ut.cpp
index e60d67673d..cc62bb988e 100644
--- a/library/cpp/http/server/http_ut.cpp
+++ b/library/cpp/http/server/http_ut.cpp
@@ -5,12 +5,12 @@
#include <library/cpp/testing/unittest/tests_data.h>
#include <util/generic/cast.h>
-#include <util/stream/output.h>
+#include <util/stream/output.h>
#include <util/stream/zlib.h>
#include <util/system/datetime.h>
#include <util/system/sem.h>
-Y_UNIT_TEST_SUITE(THttpServerTest) {
+Y_UNIT_TEST_SUITE(THttpServerTest) {
class TEchoServer: public THttpServer::ICallBack {
class TRequest: public THttpClientRequestEx {
public:
@@ -320,7 +320,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
return res;
}
- Y_UNIT_TEST(TestEchoServer) {
+ Y_UNIT_TEST(TestEchoServer) {
TString res = TestData();
TPortManager pm;
const ui16 port = pm.GetPort();
@@ -368,7 +368,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
}
- Y_UNIT_TEST(TestReusePortEnabled) {
+ Y_UNIT_TEST(TestReusePortEnabled) {
if (!IsReusePortAvailable()) {
return; // skip test
}
@@ -403,7 +403,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
}
}
- Y_UNIT_TEST(TestReusePortDisabled) {
+ Y_UNIT_TEST(TestReusePortDisabled) {
// check that with the ReusePort option disabled it's impossible to start two servers on the same port
// check that ReusePort option is disabled by default (don't set it explicitly in the test)
TPortManager pm;
@@ -422,7 +422,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
UNIT_ASSERT(false == server1.Start());
}
- Y_UNIT_TEST(TestFailServer) {
+ Y_UNIT_TEST(TestFailServer) {
/**
* Emulate request processing failures
* Data should be large enough not to fit into socket buffer
@@ -541,7 +541,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
server.Stop();
};
- Y_UNIT_TEST(TTestReleaseConnection) {
+ Y_UNIT_TEST(TTestReleaseConnection) {
TPortManager pm;
const ui16 port = pm.GetPort();
@@ -685,7 +685,7 @@ Y_UNIT_TEST_SUITE(THttpServerTest) {
};
#if 0
- Y_UNIT_TEST(TestSocketsLeak) {
+ Y_UNIT_TEST(TestSocketsLeak) {
const bool trueFalse[] = {true, false};
TPortManager portManager;
const ui16 port = portManager.GetPort();
diff --git a/library/cpp/http/server/options.cpp b/library/cpp/http/server/options.cpp
index 3aed3757ed..05c954384a 100644
--- a/library/cpp/http/server/options.cpp
+++ b/library/cpp/http/server/options.cpp
@@ -24,7 +24,7 @@ static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) {
void THttpServerOptions::BindAddresses(TBindAddresses& ret) const {
THashSet<TString> check;
- for (auto addr : BindSockaddr) {
+ for (auto addr : BindSockaddr) {
if (!addr.Port) {
addr.Port = Port;
}
diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp
index cbdb29aab7..52d64c91ce 100644
--- a/library/cpp/http/server/response.cpp
+++ b/library/cpp/http/server/response.cpp
@@ -17,7 +17,7 @@ THttpResponse& THttpResponse::SetContentType(const TStringBuf& contentType) {
return *this;
}
-void THttpResponse::OutTo(IOutputStream& os) const {
+void THttpResponse::OutTo(IOutputStream& os) const {
TVector<IOutputStream::TPart> parts;
const size_t FIRST_LINE_PARTS = 3;
const size_t HEADERS_PARTS = Headers.Count() * 4;
@@ -26,15 +26,15 @@ void THttpResponse::OutTo(IOutputStream& os) const {
// first line
parts.push_back(IOutputStream::TPart(TStringBuf("HTTP/1.1 ")));
- parts.push_back(IOutputStream::TPart(HttpCodeStrEx(Code)));
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart(HttpCodeStrEx(Code)));
+ parts.push_back(IOutputStream::TPart::CrLf());
// headers
for (THttpHeaders::TConstIterator i = Headers.Begin(); i != Headers.End(); ++i) {
- parts.push_back(IOutputStream::TPart(i->Name()));
+ parts.push_back(IOutputStream::TPart(i->Name()));
parts.push_back(IOutputStream::TPart(TStringBuf(": ")));
- parts.push_back(IOutputStream::TPart(i->Value()));
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart(i->Value()));
+ parts.push_back(IOutputStream::TPart::CrLf());
}
char buf[50];
@@ -45,21 +45,21 @@ void THttpResponse::OutTo(IOutputStream& os) const {
mo << Content.size();
parts.push_back(IOutputStream::TPart(TStringBuf("Content-Length: ")));
- parts.push_back(IOutputStream::TPart(buf, mo.Buf() - buf));
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart(buf, mo.Buf() - buf));
+ parts.push_back(IOutputStream::TPart::CrLf());
}
// content
- parts.push_back(IOutputStream::TPart::CrLf());
+ parts.push_back(IOutputStream::TPart::CrLf());
if (!Content.empty()) {
- parts.push_back(IOutputStream::TPart(Content));
+ parts.push_back(IOutputStream::TPart(Content));
}
os.Write(parts.data(), parts.size());
}
template <>
-void Out<THttpResponse>(IOutputStream& os, const THttpResponse& resp) {
+void Out<THttpResponse>(IOutputStream& os, const THttpResponse& resp) {
resp.OutTo(os);
}
diff --git a/library/cpp/http/server/response.h b/library/cpp/http/server/response.h
index 2e68d873ac..a75cb85605 100644
--- a/library/cpp/http/server/response.h
+++ b/library/cpp/http/server/response.h
@@ -7,7 +7,7 @@
#include <util/string/cast.h>
class THttpHeaders;
-class IOutputStream;
+class IOutputStream;
class THttpResponse {
public:
@@ -42,8 +42,8 @@ public:
/**
* @note If @arg content isn't empty its size is automatically added as a
- * "Content-Length" header during output to IOutputStream.
- * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
+ * "Content-Length" header during output to IOutputStream.
+ * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
*/
THttpResponse& SetContent(const TString& content) {
Content = content;
@@ -57,8 +57,8 @@ public:
/**
* @note If @arg content isn't empty its size is automatically added as a
- * "Content-Length" header during output to IOutputStream.
- * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
+ * "Content-Length" header during output to IOutputStream.
+ * @see IOutputStream& operator << (IOutputStream&, const THttpResponse&)
*/
THttpResponse& SetContent(const TString& content, const TStringBuf& contentType) {
return SetContent(content).SetContentType(contentType);
@@ -73,7 +73,7 @@ public:
return *this;
}
- void OutTo(IOutputStream& out) const;
+ void OutTo(IOutputStream& out) const;
private:
HttpCodes Code;
diff --git a/library/cpp/http/server/response_ut.cpp b/library/cpp/http/server/response_ut.cpp
index eb40ce6701..73e2112ad3 100644
--- a/library/cpp/http/server/response_ut.cpp
+++ b/library/cpp/http/server/response_ut.cpp
@@ -4,20 +4,20 @@
#include <util/string/cast.h>
-Y_UNIT_TEST_SUITE(TestHttpResponse) {
- Y_UNIT_TEST(TestCodeOnly) {
+Y_UNIT_TEST_SUITE(TestHttpResponse) {
+ Y_UNIT_TEST(TestCodeOnly) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(THttpResponse()), "HTTP/1.1 200 Ok\r\n\r\n");
UNIT_ASSERT_STRINGS_EQUAL(ToString(THttpResponse(HTTP_NOT_FOUND)), "HTTP/1.1 404 Not found\r\n\r\n");
}
- Y_UNIT_TEST(TestRedirect) {
+ Y_UNIT_TEST(TestRedirect) {
THttpResponse resp = THttpResponse(HTTP_FOUND).AddHeader("Location", "yandex.ru");
UNIT_ASSERT_STRINGS_EQUAL(ToString(resp), "HTTP/1.1 302 Moved temporarily\r\n"
"Location: yandex.ru\r\n"
"\r\n");
}
- Y_UNIT_TEST(TestAddHeader) {
+ Y_UNIT_TEST(TestAddHeader) {
THttpResponse resp(HTTP_FORBIDDEN);
resp.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"));
resp.AddHeader("X-Header-2", 10);
@@ -31,7 +31,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(resp), EXPECTED);
}
- Y_UNIT_TEST(TestAddMultipleHeaders) {
+ Y_UNIT_TEST(TestAddMultipleHeaders) {
THttpHeaders headers;
headers.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"));
headers.AddHeader(THttpInputHeader("X-Header-2", "ValueTwo"));
@@ -65,7 +65,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
}
- Y_UNIT_TEST(TestSetContent) {
+ Y_UNIT_TEST(TestSetContent) {
const char* EXPECTED = "HTTP/1.1 200 Ok\r\n"
"Content-Length: 10\r\n"
"\r\n"
@@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
EXPECTED);
}
- Y_UNIT_TEST(TestSetContentWithContentType) {
+ Y_UNIT_TEST(TestSetContentWithContentType) {
const char* EXPECTED = "HTTP/1.1 200 Ok\r\n"
"Content-Type: text/xml\r\n"
"Content-Length: 28\r\n"
@@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(resp), EXPECTED);
}
- Y_UNIT_TEST(TestCopyConstructor) {
+ Y_UNIT_TEST(TestCopyConstructor) {
THttpResponse resp(HTTP_FORBIDDEN);
resp.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"))
.AddHeader("X-Header-2", "ValueTwo")
@@ -97,7 +97,7 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(copy), ToString(resp));
}
- Y_UNIT_TEST(TestAssignment) {
+ Y_UNIT_TEST(TestAssignment) {
THttpResponse resp(HTTP_FORBIDDEN);
resp.AddHeader(THttpInputHeader("X-Header-1", "ValueOne"));
resp.AddHeader(THttpInputHeader("X-Header-2", "ValueTwo"));
@@ -109,11 +109,11 @@ Y_UNIT_TEST_SUITE(TestHttpResponse) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(copy), ToString(resp));
}
- Y_UNIT_TEST(TestEmptyContent) {
+ Y_UNIT_TEST(TestEmptyContent) {
UNIT_ASSERT_STRINGS_EQUAL(ToString(THttpResponse().SetContent("")), "HTTP/1.1 200 Ok\r\n\r\n");
}
- Y_UNIT_TEST(TestReturnReference) {
+ Y_UNIT_TEST(TestReturnReference) {
THttpResponse resp;
UNIT_ASSERT_EQUAL(&resp, &resp.AddHeader("Header1", 1));
UNIT_ASSERT_EQUAL(&resp, &resp.AddHeader(THttpInputHeader("Header2", "2")));