1NE_GET_RESPONSE_H(3) neon API reference NE_GET_RESPONSE_H(3)
2
3
4
6 ne_get_response_header, ne_response_header_iterate - functions to
7 access response headers
8
10 #include <ne_request.h>
11
12
13 const char *ne_get_response_header (ne_request *request,
14 const char *name);
15
16 void *ne_response_header_iterate (ne_request *request, void *cursor,
17 const char **name,
18 const char **value);
19
20
22 To retrieve the value of a response header field, the ne_get_re‐
23 sponse_header function can be used, and is given the name of the header
24 to return.
25
26
27 To iterate over all the response headers returned, the ne_re‐
28 sponse_header_iterate function can be used. This function takes a cur‐
29 sor parameter which should be NULL to retrieve the first header. The
30 function stores the name and value of the next header header in the
31 name and value parameters, and returns a new cursor pointer which can
32 be passed to ne_response_header_iterate to retrieve the next header.
33
34
36 ne_get_response_header returns a string, or NULL if no header with that
37 name was given. If used during request processing, the return value
38 pointer is valid only until the next call to ne_begin_request, or else,
39 until the request object is destroyed.
40
41
42 Likewise, the cursor, names, and values returned by ne_response_head‐
43 er_iterate are only valid until the next call to ne_begin_request or
44 until the request object is destroyed.
45
46
48 The following code will output the value of the Last-Modified header
49 for a resource:
50
51 ne_request *req = ne_request_create(sess, "GET", "/foo.txt");
52 if (ne_request_dispatch(req) == NE_OK) {
53 const char *mtime = ne_get_response_header(req, "Last-Modified");
54 if (mtime) {
55 printf("/foo.txt has last-modified value %s\n", mtime);
56 }
57 }
58 ne_request_destroy(req);
59
60
62 ne_request_create(3), ne_request_destroy(3).
63
64
66 Joe Orton <neon@webdav.org>.
67
68
69
70neon 0.25.5 20 January 2006 NE_GET_RESPONSE_H(3)