summaryrefslogtreecommitdiffstats
path: root/vespalib/src
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2019-03-25 15:15:59 +0000
committerHåvard Pettersen <havardpe@oath.com>2019-03-26 11:16:27 +0000
commit00ebbf362886b4ac6292b4e1693728829007e751 (patch)
tree10f99e32ceb10bfb23c35c882c11bf691768976d /vespalib/src
parent516af392068b14eaf80624eb32d236767e2311e3 (diff)
include content length in http response
Diffstat (limited to 'vespalib/src')
-rw-r--r--vespalib/src/tests/portal/portal_test.cpp3
-rw-r--r--vespalib/src/vespa/vespalib/portal/http_connection.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/vespalib/src/tests/portal/portal_test.cpp b/vespalib/src/tests/portal/portal_test.cpp
index ee5d10a313a..1baebc69e97 100644
--- a/vespalib/src/tests/portal/portal_test.cpp
+++ b/vespalib/src/tests/portal/portal_test.cpp
@@ -47,8 +47,9 @@ vespalib::string make_expected_response(const vespalib::string &content_type, co
return vespalib::make_string("HTTP/1.1 200 OK\r\n"
"Connection: close\r\n"
"Content-Type: %s\r\n"
+ "Content-Length: %zu\r\n"
"\r\n"
- "%s", content_type.c_str(), content.c_str());
+ "%s", content_type.c_str(), content.size(), content.c_str());
}
vespalib::string make_expected_error(int code, const vespalib::string &message) {
diff --git a/vespalib/src/vespa/vespalib/portal/http_connection.cpp b/vespalib/src/vespa/vespalib/portal/http_connection.cpp
index cfee71e4a7d..97a5f6082c9 100644
--- a/vespalib/src/vespa/vespalib/portal/http_connection.cpp
+++ b/vespalib/src/vespa/vespalib/portal/http_connection.cpp
@@ -222,6 +222,7 @@ HttpConnection::respond_with_content(const vespalib::string &content_type,
dst.printf("HTTP/1.1 200 OK\r\n");
dst.printf("Connection: close\r\n");
dst.printf("Content-Type: %s\r\n", content_type.c_str());
+ dst.printf("Content-Length: %zu\r\n", content.size());
dst.printf("\r\n");
dst.write(content.data(), content.size());
}