| 1 |
<refentry id="refgetst"> |
| 2 |
|
| 3 |
<refmeta> |
| 4 |
<refentrytitle>ne_get_status</refentrytitle> |
| 5 |
<manvolnum>3</manvolnum> |
| 6 |
</refmeta> |
| 7 |
|
| 8 |
<refnamediv> |
| 9 |
<refname id="ne_get_status">ne_get_status</refname> |
| 10 |
<refpurpose>retrieve HTTP response status for request</refpurpose> |
| 11 |
</refnamediv> |
| 12 |
|
| 13 |
<refsynopsisdiv> |
| 14 |
|
| 15 |
<funcsynopsis> |
| 16 |
|
| 17 |
<funcsynopsisinfo>#include <ne_request.h></funcsynopsisinfo> |
| 18 |
|
| 19 |
<funcprototype> |
| 20 |
<funcdef>const ne_status *<function>ne_get_status</function></funcdef> |
| 21 |
<paramdef>const ne_request *<parameter>request</parameter></paramdef> |
| 22 |
</funcprototype> |
| 23 |
|
| 24 |
</funcsynopsis> |
| 25 |
|
| 26 |
</refsynopsisdiv> |
| 27 |
|
| 28 |
<refsect1> |
| 29 |
<title>Description</title> |
| 30 |
|
| 31 |
<para>The <function>ne_get_status</function> function returns |
| 32 |
a pointer to the HTTP status object giving the result of a request. |
| 33 |
The object returned only becomes valid once the request has been |
| 34 |
<emphasis>successfully</emphasis> dispatched (the return value of |
| 35 |
<function>ne_request_dispatch</function> or |
| 36 |
<function>ne_begin_request</function> was zero). The object remains |
| 37 |
valid until the associated request object is destroyed.</para> |
| 38 |
|
| 39 |
</refsect1> |
| 40 |
|
| 41 |
<refsect1> |
| 42 |
<title>See also</title> |
| 43 |
|
| 44 |
<para><xref linkend="ne_status"/>, <xref |
| 45 |
linkend="ne_request_create"/></para> |
| 46 |
|
| 47 |
</refsect1> |
| 48 |
|
| 49 |
<refsect1> |
| 50 |
<title>Example</title> |
| 51 |
|
| 52 |
<para>Display the response status code of applying the |
| 53 |
<literal>HEAD</literal> method to some resource.</para> |
| 54 |
|
| 55 |
<programlisting>ne_request *req = ne_request_create(sess, "HEAD", "/foo/bar"); |
| 56 |
if (ne_request_dispatch(req)) |
| 57 |
/* handle errors... */ |
| 58 |
else |
| 59 |
printf("Response status code was %d\n", ne_get_status(req)->code); |
| 60 |
ne_request_destroy(req);</programlisting> |
| 61 |
</refsect1> |
| 62 |
|
| 63 |
</refentry> |