1NE_SESSION_PROXY(3) neon API reference NE_SESSION_PROXY(3)
2
3
4
6 ne_session_proxy, ne_session_socks_proxy, ne_session_system_proxy,
7 ne_set_addrlist - configure proxy servers
8
10 #include <ne_session.h>
11
12 void ne_session_proxy(ne_session *session, const char *hostname,
13 unsigned int port);
14
15 void ne_session_system_proxy(ne_session *session, unsigned int flags);
16
17 void ne_session_socks_proxy(ne_session *session,
18 enum ne_sock_sversion version,
19 const char *hostname, unsigned int port,
20 const char *username,
21 const char *password);
22
23 void ne_set_addrlist(ne_session *session,
24 const ne_inet_addr **addrlist, size_t count);
25
27 One (and no more than one) of the functions ne_session_proxy,
28 ne_session_system_proxy, ne_session_socks_proxy, ne_set_addrlist can be
29 used to configure a proxy server for a given session object. If more
30 than one function is invoked for any given session object, only the
31 last call has effect. If one of the functions is to be used, it must be
32 used before the creation of any request object for the session.
33
34 HTTP proxy specification
35 The ne_session_proxy function configures use of an HTTP proxy server
36 for the session, the location of which is given by the hostname and
37 port parameters. If the proxy requires authentication,
38 ne_set_proxy_auth should be used.
39
40 System proxy configuration
41 The ne_session_system_proxy function configures the session to use any
42 proxy servers specified by the system configuration. Support for this
43 function is platform-specific; if unsupported, the function has no
44 effect.
45
46 SOCKS proxy configuration
47 The ne_session_socks_proxy function configures the session to use a
48 SOCKS proxy. The version indicates which version of the SOCKS protocol
49 should be used. The hostname and port parameters specify the SOCKS
50 proxy location. Note that a server with only an IPv6 address cannot be
51 used with SOCKS v4 or v4A. The interpretation of the other arguments
52 depends on the version specified:
53
54 NE_SOCK_SOCKSV4 (version 4)
55 The username parameter must be non-NULL; the password parameter is
56 ignored.
57
58 NE_SOCK_SOCKSV4A (version 4A)
59 The username parameter must be non-NULL; the password parameter is
60 ignored.
61
62 NE_SOCK_SOCKSV5 (version 5)
63 The username parameter may be NULL; if it is non-NULL, the password
64 parameter must also be non-NULL; otherwise, it is ignored..
65
66 Origin server address override
67 The ne_set_addrlist function forces use of an address and port the a
68 specified list when establishing a TCP connection, ignoring the "real"
69 hostname and port identifying the origin server for the session (as
70 passed to ne_session_create). The origin server's "real" hostname and
71 port will still be used in the Host header in HTTP requests. When a
72 connection is required, the library will iterate through the addrlist
73 list, attempting to connect to the address addrlist[0] through to
74 addrlist[count-1] in turn, until a connection can be established.
75
77 None of the functions described here has a return value.
78
80 Create and destroy a session:
81
82 ne_session *sess;
83 sess = ne_session_create("http", "host.example.com", 80);
84 ne_session_proxy(sess, "proxy.example.com", 3128);
85 /* ... use sess ... */
86 ne_session_destroy(sess);
87
89 ne_ssl_set_verify, ne_ssl_trust_cert, ne_sock_init, ne_set_session_flag
90
92 Joe Orton
93 Author.
94
96neon 0.32.5 21 January 2023 NE_SESSION_PROXY(3)