diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2008-10-09 18:48:31 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2008-10-09 18:48:31 +0000 |
commit | e91fc869186d5654d2370043c57b607f0c85385c (patch) | |
tree | 95eb249035810bc9f68ca60150c0b82356435dea /src/ne_private.h | |
parent | 1687568eb411796bcd784c63c094fa2e1d5b8723 (diff) | |
download | neon-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 'src/ne_private.h')
-rw-r--r-- | src/ne_private.h | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/ne_private.h b/src/ne_private.h index 9ebfa6b..5b67c2a 100644 --- a/src/ne_private.h +++ b/src/ne_private.h @@ -30,12 +30,23 @@ #include "ne_ssl.h" struct host_info { - char *hostname; + /* Type of host represented: */ + enum proxy_type { + PROXY_NONE = 0, + PROXY_HTTP, /* an HTTP proxy */ + PROXY_SOCKS /* a SOCKS proxy */ + } proxy; unsigned int port; - ne_sock_addr *address; /* if non-NULL, result of resolving 'hostname'. */ - /* current network address obtained from 'address' being used. */ + /* If hostname is non-NULL, host is identified by this hostname. */ + char *hostname, *hostport; + /* If address is non-NULL, the result of resolving ->hostname. */ + ne_sock_addr *address; + /* If current non-NULL, current network address used in ->address. */ const ne_inet_addr *current; - char *hostport; /* URI hostport segment */ + /* If override is non-NULL, the host is identified by this network + * address. */ + const ne_inet_addr *network; + struct host_info *next; }; /* Store every registered callback in a generic container, and cast @@ -65,20 +76,25 @@ struct ne_session_s { * HTTP/1.1 compliant. */ char *scheme; - struct host_info server, proxy; - /* application-provided address list */ - const ne_inet_addr **addrlist; - size_t numaddrs, curaddr; + /* Server host details. */ + struct host_info server; + /* Proxy host details, or NULL if not using a proxy. */ + struct host_info *proxies; + /* Most recently used proxy server. */ + struct host_info *prev_proxy; + + /* Pointer to the active .server or .proxies as appropriate: */ + struct host_info *nexthop; /* Local address to which sockets should be bound. */ const ne_inet_addr *local_addr; /* Settings */ - int use_proxy; /* do we have a proxy server? */ int use_ssl; /* whether a secure connection is required */ int in_connect; /* doing a proxy CONNECT */ - + int any_proxy_http; /* whether any configured proxy is an HTTP proxy */ + int flags[NE_SESSFLAG_LAST]; ne_progress progress_cb; |