ne_session_proxy, ne_session_socks_proxy, ne_session_system_proxy, ne_set_addrlist — configure proxy servers
#include <ne_session.h>
void ne_session_proxy( | ne_session *session, |
const char *hostname, | |
unsigned int port) ; |
void ne_session_system_proxy( | ne_session *session, |
unsigned int flags) ; |
void ne_session_socks_proxy( | ne_session *session, |
enum ne_sock_sversion version, | |
const char *hostname, | |
unsigned int port, | |
const char *username, | |
const char *password) ; |
void ne_set_addrlist( | ne_session *session, |
const ne_inet_addr **addrlist, | |
size_t count) ; |
One (and no more than one) of the functions
ne_session_proxy
,
ne_session_system_proxy
,
ne_session_socks_proxy
,
ne_set_addrlist
can be used to configure
a proxy server for a given session object. If more than one
function is invoked for any given session object, only the
last call has effect. If one of the functions is to be used,
it must be used before the creation of any request object for
the session.
The ne_session_proxy
function
configures use of an HTTP proxy server for the session, the
location of which is given by the
hostname
and
port
paramters. If the proxy
requires authentication, ne_set_proxy_auth
should be used.
The ne_session_system_proxy
function configures the session to use any proxy servers
specified by the system configuration. Support for this
function is platform-specific; if unsupported, the function
has no effect.
The ne_session_socks_proxy
function configures the session to use a SOCKS proxy. The
version
indicates which version of
the SOCKS protocol should be used. The
hostname
and
port
parameters specify the SOCKS
proxy location. Note that a server with only an IPv6
address cannot be used with SOCKS v4 or v4A. The
interpretation of the other arguments depends on the version
specified:
| The username parameter
must be non-NULL ; the password
parameter is ignored. |
| The username parameter
must be non-NULL ; the password
parameter is ignored. |
| The username parameter
may be NULL ; if it is non-NULL ,
the password parameter must also
be non-NULL ; otherwise, it is ignored.. |
The ne_set_addrlist
function
forces use of an address and port the a specified list when
establishing a TCP connection, ignoring the "real" hostname
and port identifying the origin server for the session (as
passed to ne_session_create
). The
origin server's "real" hostname and port will still be used
in the Host
header in HTTP requests.
When a connection is required, the library will iterate
through the addrlist
list, attempting
to connect to the address addrlist[0]
through to addrlist[count-1]
in turn,
until a connection can be established.