proxy.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <refentry id="refproxy">
  2. <refmeta>
  3. <refentrytitle>ne_session_proxy</refentrytitle>
  4. <manvolnum>3</manvolnum>
  5. </refmeta>
  6. <refnamediv>
  7. <refname id="ne_session_proxy">ne_session_proxy</refname>
  8. <refname id="ne_session_socks_proxy">ne_session_socks_proxy</refname>
  9. <refname id="ne_session_system_proxy">ne_session_system_proxy</refname>
  10. <refname id="ne_set_addrlist">ne_set_addrlist</refname>
  11. <refpurpose>configure proxy servers</refpurpose>
  12. </refnamediv>
  13. <refsynopsisdiv>
  14. <funcsynopsis>
  15. <funcsynopsisinfo>#include &lt;ne_session.h&gt;</funcsynopsisinfo>
  16. <funcprototype>
  17. <funcdef>void <function>ne_session_proxy</function></funcdef>
  18. <paramdef>ne_session *<parameter>session</parameter></paramdef>
  19. <paramdef>const char *<parameter>hostname</parameter></paramdef>
  20. <paramdef>unsigned int <parameter>port</parameter></paramdef>
  21. </funcprototype>
  22. <funcprototype>
  23. <funcdef>void <function>ne_session_system_proxy</function></funcdef>
  24. <paramdef>ne_session *<parameter>session</parameter></paramdef>
  25. <paramdef>unsigned int <parameter>flags</parameter></paramdef>
  26. </funcprototype>
  27. <funcprototype>
  28. <funcdef>void <function>ne_session_socks_proxy</function></funcdef>
  29. <paramdef>ne_session *<parameter>session</parameter></paramdef>
  30. <paramdef>enum ne_sock_sversion <parameter>version</parameter></paramdef>
  31. <paramdef>const char *<parameter>hostname</parameter></paramdef>
  32. <paramdef>unsigned int <parameter>port</parameter></paramdef>
  33. <paramdef>const char *<parameter>username</parameter></paramdef>
  34. <paramdef>const char *<parameter>password</parameter></paramdef>
  35. </funcprototype>
  36. <funcprototype>
  37. <funcdef>void <function>ne_set_addrlist</function></funcdef>
  38. <paramdef>ne_session *<parameter>session</parameter></paramdef>
  39. <paramdef>const ne_inet_addr **<parameter>addrlist</parameter></paramdef>
  40. <paramdef>size_t <parameter>count</parameter></paramdef>
  41. </funcprototype>
  42. </funcsynopsis>
  43. </refsynopsisdiv>
  44. <refsect1>
  45. <title>Description</title>
  46. <para>One (and no more than one) of the functions
  47. <function>ne_session_proxy</function>,
  48. <function>ne_session_system_proxy</function>,
  49. <function>ne_session_socks_proxy</function>,
  50. <function>ne_set_addrlist</function> can be used to configure
  51. a proxy server for a given session object. If more than one
  52. function is invoked for any given session object, only the
  53. last call has effect. If one of the functions is to be used,
  54. it must be used before the creation of any request object for
  55. the session.</para>
  56. <refsect2>
  57. <title>HTTP proxy specification</title>
  58. <para>The <function>ne_session_proxy</function> function
  59. configures use of an HTTP proxy server for the session, the
  60. location of which is given by the
  61. <parameter>hostname</parameter> and
  62. <parameter>port</parameter> parameters. If the proxy
  63. requires authentication, <xref linkend="ne_set_proxy_auth"/>
  64. should be used.</para>
  65. </refsect2>
  66. <refsect2>
  67. <title>System proxy configuration</title>
  68. <para>The <function>ne_session_system_proxy</function>
  69. function configures the session to use any proxy servers
  70. specified by the system configuration. Support for this
  71. function is platform-specific; if unsupported, the function
  72. has no effect.</para>
  73. </refsect2>
  74. <refsect2>
  75. <title>SOCKS proxy configuration</title>
  76. <para>The <function>ne_session_socks_proxy</function>
  77. function configures the session to use a SOCKS proxy. The
  78. <parameter>version</parameter> indicates which version of
  79. the SOCKS protocol should be used. The
  80. <parameter>hostname</parameter> and
  81. <parameter>port</parameter> parameters specify the SOCKS
  82. proxy location. Note that a server with only an IPv6
  83. address cannot be used with SOCKS v4 or v4A. The
  84. interpretation of the other arguments depends on the version
  85. specified:</para>
  86. <variablelist>
  87. <varlistentry><term><constant>NE_SOCK_SOCKSV4</constant> (version 4)</term>
  88. <listitem>
  89. <simpara>The <parameter>username</parameter> parameter
  90. must be non-&null;; the <parameter>password</parameter>
  91. parameter is ignored.</simpara>
  92. </listitem>
  93. </varlistentry>
  94. <varlistentry><term><constant>NE_SOCK_SOCKSV4A</constant> (version 4A)</term>
  95. <listitem>
  96. <simpara>The <parameter>username</parameter> parameter
  97. must be non-&null;; the <parameter>password</parameter>
  98. parameter is ignored.</simpara>
  99. </listitem>
  100. </varlistentry>
  101. <varlistentry><term><constant>NE_SOCK_SOCKSV5</constant> (version 5)</term>
  102. <listitem>
  103. <simpara>The <parameter>username</parameter> parameter
  104. may be &null;; if it is non-&null;,
  105. the <parameter>password</parameter> parameter must also
  106. be non-&null;; otherwise, it is ignored..</simpara>
  107. </listitem>
  108. </varlistentry>
  109. </variablelist>
  110. </refsect2>
  111. <refsect2>
  112. <title>Origin server address override</title>
  113. <para>The <function>ne_set_addrlist</function> function
  114. forces use of an address and port the a specified list when
  115. establishing a TCP connection, ignoring the "real" hostname
  116. and port identifying the origin server for the session (as
  117. passed to <function>ne_session_create</function>). The
  118. origin server's "real" hostname and port will still be used
  119. in the <literal>Host</literal> header in HTTP requests.
  120. When a connection is required, the library will iterate
  121. through the <parameter>addrlist</parameter> list, attempting
  122. to connect to the address <parameter>addrlist[0]</parameter>
  123. through to <parameter>addrlist[count-1]</parameter> in turn,
  124. until a connection can be established.</para>
  125. </refsect2>
  126. </refsect1>
  127. <refsect1>
  128. <title>Return Values</title>
  129. <para>None of the functions described here has a return
  130. value.</para>
  131. </refsect1>
  132. <refsect1>
  133. <title>Examples</title>
  134. <para>Create and destroy a session:</para>
  135. <programlisting>ne_session *sess;
  136. sess = ne_session_create("http", "host.example.com", 80);
  137. ne_session_proxy(sess, "proxy.example.com", 3128);
  138. /* ... use sess ... */
  139. ne_session_destroy(sess);
  140. </programlisting>
  141. </refsect1>
  142. <refsect1>
  143. <title>See Also</title>
  144. <para><xref linkend="ne_ssl_set_verify"/>, <xref linkend="ne_ssl_trust_cert"/>, <xref linkend="ne_sock_init"/>, <xref linkend="ne_set_session_flag"/></para>
  145. </refsect1>
  146. </refentry>