summaryrefslogtreecommitdiff
path: root/test/request.c
diff options
context:
space:
mode:
authorjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2008-10-09 18:48:31 +0000
committerjoe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845>2008-10-09 18:48:31 +0000
commite91fc869186d5654d2370043c57b607f0c85385c (patch)
tree95eb249035810bc9f68ca60150c0b82356435dea /test/request.c
parent1687568eb411796bcd784c63c094fa2e1d5b8723 (diff)
downloadneon-e91fc869186d5654d2370043c57b607f0c85385c.tar.gz
Add support for multiple proxies and differentiate between a SOCKS and
HTTP proxy (though the former cannot yet be configured or used). Reimplement addrlist support as a "direct" proxy type. * src/ne_private.h (struct host_info): Add proxy enum, network field, next pointer. (struct ne_session_s): Remove addrlist, numaddr, curaddr. Remove proxy field, add proxies, prev_proxy, nexthop fields. Remove use_proxy, add any_proxy_http flag. * src/ne_session.c (free_hostinfo, free_proxies): New functions. (ne_session_destroy): Use the above. (set_hostinfo): Take type argument, set in structure. (ne_session_create): Pass PROXY_NONE to set_hostinfo. (ne_session_proxy): Call free_proxies, set sess->any_proxy_http flag, and adjust for new sess->proxies structure. (ne_set_addrlist): Adjust to set up a "direct" proxy. (ne_fill_proxy_uri): Adjust for proxies structure. (ne_close_connection): Use nexthop hostname for disconnect notifier. * src/ne_session.h (ne_session_proxy, ne_set_addrlist, ne_fill_proxy_uri): Adjust for multi-proxy semantics. * src/ne_request.c (aborted): Use sess->nexthop. (add_fixed_headers): Use new any_proxy_http flag. Reflow code. Set Host header here. (ne_request_create): Use any_proxy_http flag. (build_request): Don't add Host header here. (lookup_host): Don't check addrlist. (ne_begin_request): Use sess->nexthop in place of proxy flag. (resolve_first, resolve_next): Use ->network in place of addrlist; drop session paramater. (do_connect): Do DNS lookup here; adjust for resolve_*; set error message appropriately based on host type, drop error parameter. (open_connection): Support multiple proxies; adjust to use sess->nexthop. * test/request.c (addrlist): New test case. git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1557 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'test/request.c')
-rw-r--r--test/request.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/request.c b/test/request.c
index 184ce9b..247e738 100644
--- a/test/request.c
+++ b/test/request.c
@@ -2154,6 +2154,28 @@ static int dereg_progress(void)
return await_server();
}
+static int addrlist(void)
+{
+ ne_session *sess;
+ ne_inet_addr *ia = ne_iaddr_make(ne_iaddr_ipv4, raw_127);
+ const ne_inet_addr *ial[1];
+
+ sess = ne_session_create("http", "www.example.com", 7777);
+
+ CALL(spawn_server(7777, single_serve_string, EMPTY_RESP));
+
+ ial[0] = ia;
+
+ ne_set_addrlist(sess, ial, 1);
+
+ CALL(any_2xx_request(sess, "/blah"));
+
+ ne_session_destroy(sess);
+ ne_iaddr_free(ia);
+
+ return await_server();
+}
+
/* TODO: test that ne_set_notifier(, NULL, NULL) DTRT too. */
ne_test tests[] = {
@@ -2244,5 +2266,6 @@ ne_test tests[] = {
T(status_chunked),
T(local_addr),
T(dereg_progress),
+ T(addrlist),
T(NULL)
};