diff options
author | Bjørn Christian Seime <bjorn.christian@seime.no> | 2019-03-25 16:20:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-25 16:20:31 +0100 |
commit | 8533c200eaba6f2573228509e5eae5eb036b282f (patch) | |
tree | 2c37a9143a63e504959f40f39d858e036de9ab55 | |
parent | 02579732c1a0b40dcfc25113f977da49d133b5fa (diff) | |
parent | 522bc0e1e4fa9d1b8cbe2f6f66a35c14d93ae5f3 (diff) |
Merge pull request #8894 from vespa-engine/havardpe/add-content-length
include content length in http response
4 files changed, 7 insertions, 1 deletions
diff --git a/staging_vespalib/src/tests/state_server/state_server_test.cpp b/staging_vespalib/src/tests/state_server/state_server_test.cpp index d4f665029cc..d4071526a79 100644 --- a/staging_vespalib/src/tests/state_server/state_server_test.cpp +++ b/staging_vespalib/src/tests/state_server/state_server_test.cpp @@ -81,6 +81,7 @@ TEST_FF("require that non-empty known url returns expected headers", DummyHandle vespalib::string expect("HTTP/1.1 200 OK\r\n" "Connection: close\r\n" "Content-Type: application/json\r\n" + "Content-Length: 5\r\n" "\r\n" "[123]"); std::string actual = getFull(f2.port(), my_path); diff --git a/storage/src/tests/frameworkimpl/status/statustest.cpp b/storage/src/tests/frameworkimpl/status/statustest.cpp index b047a4000cf..9e5a87e8783 100644 --- a/storage/src/tests/frameworkimpl/status/statustest.cpp +++ b/storage/src/tests/frameworkimpl/status/statustest.cpp @@ -130,6 +130,7 @@ StatusTest::testIndexStatusPage() "HTTP\\/1.1 200 OK\r\n" "Connection: close\r\n" "Content-Type: text\\/html\r\n" + "Content-Length: 206\r\n" "\r\n" "<html>\n" "<head>\n" @@ -160,6 +161,7 @@ StatusTest::testHtmlStatus() "HTTP/1.1 200 OK\r\n" "Connection: close\r\n" "Content-Type: text/html\r\n" + "Content-Length: 117\r\n" "\r\n" "<html>\n" "<head>\n" @@ -187,6 +189,7 @@ StatusTest::testXmlStatus() "HTTP/1.1 200 OK\r\n" "Connection: close\r\n" "Content-Type: application/xml\r\n" + "Content-Length: 100\r\n" "\r\n" "<?xml version=\"1.0\"?>\n" "<status id=\"fooid\" name=\"Foo impl\">\n" 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()); } |