aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/server/response.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/http/server/response.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http/server/response.cpp')
-rw-r--r--library/cpp/http/server/response.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp
index 3c7a3e6a93..52d64c91ce 100644
--- a/library/cpp/http/server/response.cpp
+++ b/library/cpp/http/server/response.cpp
@@ -1,7 +1,7 @@
#include "response.h"
-
+
#include <util/stream/output.h>
-#include <util/stream/mem.h>
+#include <util/stream/mem.h>
#include <util/string/cast.h>
THttpResponse& THttpResponse::AddMultipleHeaders(const THttpHeaders& headers) {
@@ -11,16 +11,16 @@ THttpResponse& THttpResponse::AddMultipleHeaders(const THttpHeaders& headers) {
return *this;
}
-THttpResponse& THttpResponse::SetContentType(const TStringBuf& contentType) {
+THttpResponse& THttpResponse::SetContentType(const TStringBuf& contentType) {
Headers.AddOrReplaceHeader(THttpInputHeader("Content-Type", ToString(contentType)));
-
- return *this;
+
+ return *this;
}
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;
+ const size_t HEADERS_PARTS = Headers.Count() * 4;
const size_t CONTENT_PARTS = 5;
parts.reserve(FIRST_LINE_PARTS + HEADERS_PARTS + CONTENT_PARTS);
@@ -30,20 +30,20 @@ void THttpResponse::OutTo(IOutputStream& os) const {
parts.push_back(IOutputStream::TPart::CrLf());
// headers
- for (THttpHeaders::TConstIterator i = Headers.Begin(); i != Headers.End(); ++i) {
+ for (THttpHeaders::TConstIterator i = Headers.Begin(); i != Headers.End(); ++i) {
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());
}
- char buf[50];
-
+ char buf[50];
+
if (!Content.empty()) {
- TMemoryOutput mo(buf, sizeof(buf));
+ TMemoryOutput mo(buf, sizeof(buf));
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());
@@ -51,15 +51,15 @@ void THttpResponse::OutTo(IOutputStream& os) const {
// content
parts.push_back(IOutputStream::TPart::CrLf());
-
+
if (!Content.empty()) {
parts.push_back(IOutputStream::TPart(Content));
}
os.Write(parts.data(), parts.size());
-}
-
-template <>
+}
+
+template <>
void Out<THttpResponse>(IOutputStream& os, const THttpResponse& resp) {
- resp.OutTo(os);
+ resp.OutTo(os);
}