aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/http/server/response.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /library/cpp/http/server/response.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 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 52d64c91ce..3c7a3e6a93 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);
}