diff options
author | Håvard Pettersen <havardpe@oath.com> | 2019-03-25 15:15:59 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2019-03-25 15:15:59 +0000 |
commit | 522bc0e1e4fa9d1b8cbe2f6f66a35c14d93ae5f3 (patch) | |
tree | d94071b784e97632e370a37004067b0e422e9757 /vespalib/src | |
parent | e957b28c666a6b0d45fc325efc11e894f7d63d94 (diff) |
include content length in http response
Diffstat (limited to 'vespalib/src')
-rw-r--r-- | vespalib/src/tests/portal/portal_test.cpp | 3 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/portal/http_connection.cpp | 1 |
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()); } |