diff options
author | Paul van Tilburg <paul.van.tilburg@leftclick.eu> | 2016-09-12 13:36:51 +0200 |
---|---|---|
committer | Paul van Tilburg <paul.van.tilburg@leftclick.eu> | 2016-09-19 15:10:22 +0200 |
commit | ea2e9c12b6e8c4a1a2fe46d36a59106e01a80bb5 (patch) | |
tree | 14766e77795462337e476f2ce50459a860887a26 | |
parent | f8d37660f8a29ecf2c1cfda6fbfebf3acdd9c08a (diff) | |
download | libproxy-git-ea2e9c12b6e8c4a1a2fe46d36a59106e01a80bb5.tar.gz |
Add test for a PAC get without content length
-rw-r--r-- | libproxy/test/get-pac-test.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libproxy/test/get-pac-test.cpp b/libproxy/test/get-pac-test.cpp index c7d49d9..a20690b 100644 --- a/libproxy/test/get-pac-test.cpp +++ b/libproxy/test/get-pac-test.cpp @@ -143,6 +143,8 @@ class TestServer { sendOverflow(csock); } else if (strstr(buffer, "chunked")) { sendChunked(csock); + } else if (strstr(buffer, "without_content_length")) { + sendWithoutContentLength(csock); } else { assert(!"Unsupported request"); } @@ -224,6 +226,20 @@ done: close(ret); } + void sendWithoutContentLength(int csock) + { + int ret; + const char *basic = + "HTTP/1.1 200 OK\n" \ + "Content-Type: text/plain\n" \ + "\n" \ + "0123456789"; + ret = send(csock, (void*)basic, strlen(basic), 0); + assert(ret == strlen(basic)); + shutdown(csock, SHUT_RDWR); + close(ret); + } + in_port_t m_port; int m_sock; int m_pipe[2]; @@ -241,6 +257,7 @@ int main() url truncated("http://localhost:1983/truncated.js"); url overflow("http://localhost:1983/overflow.js"); url chunked("http://localhost:1983/chunked.js"); + url without_content_length("http://localhost:1983/without_content_length.js"); server.start(); @@ -260,6 +277,10 @@ int main() pac = chunked.get_pac(); if (!(pac != NULL && strlen(pac) == 10 && !strcmp("0123456789", pac))) return 4; // Test failed, exit with error code + + pac = without_content_length.get_pac(); + if (!(pac != NULL && strlen(pac) == 10 && !strcmp("0123456789", pac))) + return 5; // Test failed, exit with error code delete[] pac; server.stop(); |