getst.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <refentry id="refgetst">
  2. <refmeta>
  3. <refentrytitle>ne_get_status</refentrytitle>
  4. <manvolnum>3</manvolnum>
  5. </refmeta>
  6. <refnamediv>
  7. <refname id="ne_get_status">ne_get_status</refname>
  8. <refname id="ne_get_response_location">ne_get_response_location</refname>
  9. <refpurpose>retrieve HTTP response properties</refpurpose>
  10. </refnamediv>
  11. <refsynopsisdiv>
  12. <funcsynopsis>
  13. <funcsynopsisinfo>#include &lt;ne_request.h&gt;</funcsynopsisinfo>
  14. <funcprototype>
  15. <funcdef>const ne_status *<function>ne_get_status</function></funcdef>
  16. <paramdef>const ne_request *<parameter>request</parameter></paramdef>
  17. </funcprototype>
  18. <funcprototype>
  19. <funcdef>ne_uri *<function>ne_get_response_location</function></funcdef>
  20. <paramdef>ne_request *<parameter>request</parameter></paramdef>
  21. </funcprototype>
  22. </funcsynopsis>
  23. </refsynopsisdiv>
  24. <refsect1>
  25. <title>Description</title>
  26. <para>The <function>ne_get_status</function> function returns
  27. a pointer to the HTTP status object giving the result of a request.
  28. The object returned only becomes valid once the request has been
  29. <emphasis>successfully</emphasis> dispatched (the return value of
  30. <function>ne_request_dispatch</function> or
  31. <function>ne_begin_request</function> was zero).</para>
  32. <para>If the response includes a <literal>Location</literal> header,
  33. the <function>ne_get_response_location</function> function parses and
  34. resolves the URI-reference relative to the request target. If a
  35. fragment ("#fragment") is applicable to the request target, it can be
  36. passed as an argument to allow appropriate relative resolution.</para>
  37. </refsect1>
  38. <refsect1>
  39. <title>Return value</title>
  40. <para><function>ne_get_status</function> returns a pointer to
  41. the HTTP status object giving the result of a request. This
  42. pointer is valid until the associated request object is
  43. destroyed.</para>
  44. <para><function>ne_get_response_location</function> returns a
  45. malloc-allocated ne_uri object, or NULL if either the URI in
  46. the Location header could not be parsed or the Location header
  47. was not present.</para>
  48. </refsect1>
  49. <refsect1>
  50. <title>Examples</title>
  51. <para>Display the response status code of applying the
  52. <literal>HEAD</literal> method to some resource.</para>
  53. <programlisting>ne_request *req = ne_request_create(sess, "HEAD", "/foo/bar");
  54. if (ne_request_dispatch(req))
  55. /* handle errors... */
  56. else
  57. printf("Response status code was %d\n", ne_get_status(req)->code);
  58. ne_request_destroy(req);</programlisting>
  59. </refsect1>
  60. <refsect1>
  61. <title>History</title>
  62. <para><function>ne_get_response_location</function> is
  63. available in &neon; 0.34.0 and later.</para>
  64. </refsect1>
  65. <refsect1>
  66. <title>See also</title>
  67. <para><xref linkend="ne_status"/>, <xref
  68. linkend="ne_request_create"/></para>
  69. </refsect1>
  70. </refentry>