refgetst.html 5.5 KB

123456789101112131415161718192021222324252627282930
  1. <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>ne_get_status</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="referr.html" title="ne_get_error"><link rel="next" href="reffeat.html" title="ne_has_support"></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_get_status</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="referr.html">Prev</a> </td><th width="60%" align="center">neon API reference</th><td width="20%" align="right"> <a accesskey="n" href="reffeat.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="refgetst"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>ne_get_status, ne_get_response_location, ne_get_response_retry_after — retrieve HTTP response properties</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;ne_request.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">const ne_status *<b class="fsfunc">ne_get_status</b>(</code></td><td>const ne_request *<var class="pdparam">request</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">ne_uri *<b class="fsfunc">ne_get_response_location</b>(</code></td><td>ne_request *<var class="pdparam">request</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">time_t <b class="fsfunc">ne_get_response_retry_after</b>(</code></td><td>ne_request *<var class="pdparam">request</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id2454"></a><h2>Description</h2><p>The <code class="function">ne_get_status</code> function returns
  2. a pointer to the HTTP status object giving the result of a request.
  3. The object returned only becomes valid once the request has been
  4. <span class="emphasis"><em>successfully</em></span> dispatched (the return value of
  5. <code class="function">ne_request_dispatch</code> or
  6. <code class="function">ne_begin_request</code> was zero).</p><p>If the response includes a <code class="literal">Location</code> header,
  7. the <code class="function">ne_get_response_location</code> function parses and
  8. resolves the URI-reference relative to the request target. If a
  9. fragment ("#fragment") is applicable to the request target, it can be
  10. passed as an argument to allow appropriate relative resolution.</p><p>The <code class="function">ne_get_response_retry_after</code> function
  11. parses any <code class="literal">Retry-After</code> header included in the
  12. response. If the header value uses a relative time, it is interpreted
  13. relative to the time the function was invoked, rather than the time
  14. the response was received, so the function should be used directly
  15. after dispatching the request.</p></div><div class="refsect1"><a name="id2467"></a><h2>Return value</h2><p><code class="function">ne_get_status</code> returns a pointer to
  16. the HTTP status object giving the result of a request. This
  17. pointer is valid until the associated request object is
  18. destroyed.</p><p><code class="function">ne_get_response_location</code> returns a
  19. malloc-allocated ne_uri object, or NULL if either the URI in
  20. the Location header could not be parsed or the Location header
  21. was not present.</p><p><code class="function">ne_get_response_retry_after</code> returns
  22. a time_t value, or zero if either no Retry-After header was
  23. included or the header value could not be parsed.</p></div><div class="refsect1"><a name="id2475"></a><h2>Examples</h2><p>Display the response status code of applying the
  24. <code class="literal">HEAD</code> method to some resource.</p><pre class="programlisting">ne_request *req = ne_request_create(sess, "HEAD", "/foo/bar");
  25. if (ne_request_dispatch(req))
  26. /* handle errors... */
  27. else
  28. printf("Response status code was %d\n", ne_get_status(req)-&gt;code);
  29. ne_request_destroy(req);</pre></div><div class="refsect1"><a name="id2480"></a><h2>History</h2><p><code class="function">ne_get_response_location</code> is
  30. available in neon 0.34.0 and later.</p></div><div class="refsect1"><a name="id2484"></a><h2>See also</h2><p><a class="xref" href="refstatus.html#ne_status">ne_status</a>, <a class="xref" href="refreq.html#ne_request_create">ne_request_create</a></p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="referr.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="reffeat.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ne_get_error </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ne_has_support</td></tr></table></div></body></html>