Files
interactive/gms/KT/sdkfreebsd64/libs/neon-0.25.4/doc/html/refopts.html
2026-08-07 17:38:18 +09:00

29 lines
5.7 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ne_set_useragent</title><link rel="stylesheet" href="../manual.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="neon HTTP/WebDAV client library"><link rel="up" href="ref.html" title="neon API reference"><link rel="prev" href="refresphdr.html" title="ne_get_response_header"><link rel="next" href="refreqopts.html" title="ne_set_request_expect100"></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_set_useragent</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="refresphdr.html">Prev</a> </td><th width="60%" align="center">neon API reference</th><td width="20%" align="right"> <a accesskey="n" href="refreqopts.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="refopts"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ne_set_useragent, ne_set_persist, ne_set_read_timeout, ne_get_scheme, ne_get_server_hostport — common properties for HTTP sessions</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;ne_session.h&gt;</pre><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">void <b class="fsfunc">ne_set_useragent</b>(</code>ne_session *<var xmlns="" class="pdparam">session</var>, const char *<var xmlns="" class="pdparam">product</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_persist</b>(</code>ne_session *<var xmlns="" class="pdparam">session</var>, int <var xmlns="" class="pdparam">flag</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_read_timeout</b>(</code>ne_session *<var xmlns="" class="pdparam">session</var>, int <var xmlns="" class="pdparam">timeout</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">const char *<b class="fsfunc">ne_get_scheme</b>(</code>ne_sesssion *<var xmlns="" class="pdparam">session</var><code xmlns="">)</code>;</code></div><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="funcprototype"><code><code xmlns="" class="funcdef">const char *<b class="fsfunc">ne_get_server_hostport</b>(</code>ne_sesssion *<var xmlns="" class="pdparam">session</var><code xmlns="">)</code>;</code></div></div></div><div class="refsect1" lang="en"><a name="id2938401"></a><h2>Description</h2><p>The <code class="literal">User-Agent</code> request header is used
to identify the software which generated the request for statistical
or debugging purposes. neon does not send a
<code class="literal">User-Agent</code> header unless a call is made to the
<code class="function">ne_set_useragent</code>.
<code class="function">ne_set_useragent</code> must be passed a product string
conforming to RFC2616's product token grammar; of the form
<code class="literal">"Product/Version"</code>.</p><p>By default neon will use a persistent connection
whenever possible. For specific applications, or for debugging
purposes, it is sometimes useful to disable persistent connections.
The <code class="function">ne_set_persist</code> function will disable
persistent connections if passed a <code class="parameter">flag</code>
parameter of <code class="literal">0</code>, and will enable them
otherwise.</p><p>When neon reads from a socket, by default the read
operation will time out after 60 seconds, and the request will fail
giving an <span class="errorcode">NE_TIMEOUT</span> error. To configure this
timeout interval, call <code class="function">ne_set_read_timeout</code> giving
the desired number of seconds as the <code class="parameter">timeout</code>
parameter.</p><p>The scheme used to initially create the session will be
returned by <code class="function">ne_get_scheme</code>.</p><p>The hostport pair with which the session is associated
will be returned by the
<code class="function">ne_get_server_hostport</code>; for example
<code class="literal">www.example.com:8080</code>. Note that the
<code class="literal">:port</code> will be omitted if the default port
for the scheme is used.</p></div><div class="refsect1" lang="en"><a name="id2938531"></a><h2>Examples</h2><p>Set a user-agent string:</p><pre class="programlisting">ne_session *sess = ne_session_create(...);
ne_set_useragent(sess, "MyApplication/2.1");</pre><p>Disable use of persistent connections:</p><pre class="programlisting">ne_session *sess = ne_session_create(...);
ne_set_persist(sess, 0);</pre><p>Set a 30 second read timeout:</p><pre class="programlisting">ne_session *sess = ne_session_create(...);
ne_set_read_timeout(sess, 30);</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="refresphdr.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="refreqopts.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ne_get_response_header </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ne_set_request_expect100</td></tr></table></div></body></html>