summaryrefslogtreecommitdiff
path: root/test/request.c
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2008-03-13 19:55:26 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2008-03-13 19:55:26 +0000
commit3c9fb03c5f784ccf6c33a427792dda6f6872f1eb (patch)
tree2f01d96a94767c9d106fbc4017cfde075741d60b /test/request.c
parent9cda21e91c9854307ffaa27732858214fe5a94f9 (diff)
downloadneon-3c9fb03c5f784ccf6c33a427792dda6f6872f1eb.tar.gz
Fix use of NTLM with some borked proxies which require use of a
persistent connection but don't advertise such support in an HTTP-compliant manner: * src/ne_request.c (add_fixed_headers): Add the request header "Proxy-Connection: Keep-Alive" for a non-HTTP/1.1 next-hop, iff a proxy is configured. (ne_begin_request): Where the next-hop is non-HTTP/1.1, a proxy is configured, *and* the conn-auth flag is enabled, enable use of persistent connections if the next-hop sends the response header "Proxy-Connection: Keep-Alive". * test/request.c (test_persist_p): Renamed from test_persist. Take proxy flag and enable proxy and conn-auth if set. (test_persist): New function. (persist_proxy_http10): New test case. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1406 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'test/request.c')
-rw-r--r--test/request.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/test/request.c b/test/request.c
index 9ad84b1..7543a37 100644
--- a/test/request.c
+++ b/test/request.c
@@ -421,14 +421,19 @@ static int serve_twice(ne_socket *sock, void *userdata)
/* Test persistent connection handling: serve 'response' twice on a
* single TCP connection, expecting to get a response body equal to
* 'body' both times. */
-static int test_persist(const char *response, const char *body)
+static int test_persist_p(const char *response, const char *body, int proxy)
{
ne_session *sess = ne_session_create("http", "localhost", 7777);
ne_buffer *buf = ne_buffer_create();
ON(sess == NULL || buf == NULL);
ON(spawn_server(7777, serve_twice, (char *)response));
-
+
+ if (proxy) {
+ ne_session_proxy(sess, "localhost", 7777);
+ ne_set_session_flag(sess, NE_SESSFLAG_CONNAUTH, 1);
+ }
+
CALL(run_request(sess, 200, construct_get, buf));
ONV(strcmp(buf->data, body),
@@ -449,6 +454,11 @@ static int test_persist(const char *response, const char *body)
return OK;
}
+static int test_persist(const char *response, const char *body)
+{
+ return test_persist_p(response, body, 0);
+}
+
static int persist_http11(void)
{
return test_persist(RESP200 "Content-Length: 5\r\n\r\n" "abcde",
@@ -469,6 +479,14 @@ static int persist_http10(void)
"abcde");
}
+static int persist_proxy_http10(void)
+{
+ return test_persist_p("HTTP/1.0 200 OK\r\n"
+ "Proxy-Connection: keep-alive\r\n"
+ "Content-Length: 5\r\n\r\n" "abcde",
+ "abcde", 1);
+}
+
/* Server function for fail_early_eof */
static int serve_eof(ne_socket *sock, void *ud)
{
@@ -2124,6 +2142,7 @@ ne_test tests[] = {
T(persist_http11),
T(persist_chunked),
T(persist_http10),
+ T(persist_proxy_http10),
T(persist_timeout),
T(no_persist_http10),
T(ptimeout_eof),