mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
58 lines
8.7 KiB
HTML
58 lines
8.7 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ne_session_proxy</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="neon HTTP/WebDAV client library"><link rel="up" href="ref.html" title="neon API reference"><link rel="prev" href="refsess.html" title="ne_session_create"><link rel="next" href="refsessflags.html" title="ne_set_session_flag"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ne_session_proxy</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="refsess.html">Prev</a> </td><th width="60%" align="center">neon API reference</th><td width="20%" align="right"> <a accesskey="n" href="refsessflags.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="refproxy"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ne_session_proxy, ne_session_socks_proxy, ne_session_system_proxy, ne_set_addrlist — configure proxy servers</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <ne_session.h></pre><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void <b class="fsfunc">ne_session_proxy</b>(</code>ne_session *<var xmlns="" class="pdparam">session</var>, const char *<var xmlns="" class="pdparam">hostname</var>, unsigned int <var xmlns="" class="pdparam">port</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void <b class="fsfunc">ne_session_system_proxy</b>(</code>ne_session *<var xmlns="" class="pdparam">session</var>, unsigned int <var xmlns="" class="pdparam">flags</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void <b class="fsfunc">ne_session_socks_proxy</b>(</code>ne_session *<var xmlns="" class="pdparam">session</var>, enum ne_sock_sversion <var xmlns="" class="pdparam">version</var>, const char *<var xmlns="" class="pdparam">hostname</var>, unsigned int <var xmlns="" class="pdparam">port</var>, const char *<var xmlns="" class="pdparam">username</var>, const char *<var xmlns="" class="pdparam">password</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void <b class="fsfunc">ne_set_addrlist</b>(</code>ne_session *<var xmlns="" class="pdparam">session</var>, const ne_inet_addr **<var xmlns="" class="pdparam">addrlist</var>, size_t <var xmlns="" class="pdparam">count</var><code xmlns="">)</code>;</code></div></div></div><div class="refsect1"><a name="id3108"></a><h2>Description</h2><p>One (and no more than one) of the functions
|
||
<code class="function">ne_session_proxy</code>,
|
||
<code class="function">ne_session_system_proxy</code>,
|
||
<code class="function">ne_session_socks_proxy</code>,
|
||
<code class="function">ne_set_addrlist</code> 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.</p><p>The <code class="parameter">hostname</code> parameter used with
|
||
<code class="function">ne_session_proxy</code> and
|
||
<code class="function">ne_session_socks_proxy</code> must follow the
|
||
same rules as the <code class="parameter">host</code> for
|
||
<code class="function">ne_session_create</code>; see <a class="xref" href="refsess.html#ne_session_create">ne_session_create</a> for examples.</p><div class="refsect2"><a name="id3122"></a><h3>HTTP proxy specification</h3><p>The <code class="function">ne_session_proxy</code> function
|
||
configures use of an HTTP proxy server for the session, the
|
||
location of which is given by the
|
||
<code class="parameter">hostname</code> and
|
||
<code class="parameter">port</code> parameters. If the proxy
|
||
requires authentication, <a class="xref" href="refauth.html#ne_set_proxy_auth">ne_set_proxy_auth</a>
|
||
should be used.</p></div><div class="refsect2"><a name="id3129"></a><h3>System proxy configuration</h3><p>The <code class="function">ne_session_system_proxy</code>
|
||
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.</p></div><div class="refsect2"><a name="id3133"></a><h3>SOCKS proxy configuration</h3><p>The <code class="function">ne_session_socks_proxy</code>
|
||
function configures the session to use a SOCKS proxy. The
|
||
<code class="parameter">version</code> indicates which version of
|
||
the SOCKS protocol should be used. The
|
||
<code class="parameter">hostname</code> and
|
||
<code class="parameter">port</code> 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:</p><div class="variablelist"><table border="0" class="variablelist"><colgroup><col align="left" valign="top"><col></colgroup><tbody><tr><td><p><span class="term"><code class="constant">NE_SOCK_SOCKSV4</code> (version 4)</span></p></td><td>The <code class="parameter">username</code> parameter
|
||
must be non-<code class="literal">NULL</code>; the <code class="parameter">password</code>
|
||
parameter is ignored.</td></tr><tr><td><p><span class="term"><code class="constant">NE_SOCK_SOCKSV4A</code> (version 4A)</span></p></td><td>The <code class="parameter">username</code> parameter
|
||
must be non-<code class="literal">NULL</code>; the <code class="parameter">password</code>
|
||
parameter is ignored.</td></tr><tr><td><p><span class="term"><code class="constant">NE_SOCK_SOCKSV5</code> (version 5)</span></p></td><td>The <code class="parameter">username</code> parameter
|
||
may be <code class="literal">NULL</code>; if it is non-<code class="literal">NULL</code>,
|
||
the <code class="parameter">password</code> parameter must also
|
||
be non-<code class="literal">NULL</code>; otherwise, it is ignored..</td></tr></tbody></table></div></div><div class="refsect2"><a name="id3167"></a><h3>Origin server address override</h3><p>The <code class="function">ne_set_addrlist</code> 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 <code class="function">ne_session_create</code>). The
|
||
origin server's "real" hostname and port will still be used
|
||
in the <code class="literal">Host</code> header in HTTP requests.
|
||
When a connection is required, the library will iterate
|
||
through the <code class="parameter">addrlist</code> list, attempting
|
||
to connect to the address <code class="parameter">addrlist[0]</code>
|
||
through to <code class="parameter">addrlist[count-1]</code> in turn,
|
||
until a connection can be established.</p></div></div><div class="refsect1"><a name="id3176"></a><h2>Return Values</h2><p>None of the functions described here has a return
|
||
value.</p></div><div class="refsect1"><a name="id3179"></a><h2>Examples</h2><p>Create and destroy a session:</p><pre class="programlisting">ne_session *sess;
|
||
sess = ne_session_create("http", "host.example.com", 80);
|
||
ne_session_proxy(sess, "proxy.example.com", 3128);
|
||
/* ... use sess ... */
|
||
ne_session_destroy(sess);
|
||
</pre></div><div class="refsect1"><a name="id3183"></a><h2>See Also</h2><p><a class="xref" href="refsess.html#ne_session_create">ne_session_create</a>, <a class="xref" href="refauth.html#ne_set_proxy_auth">ne_set_proxy_auth</a></p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="refsess.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ref.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="refsessflags.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ne_session_create </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ne_set_session_flag</td></tr></table></div></body></html>
|