1NE_SET_USERAGENT(3) neon API reference NE_SET_USERAGENT(3)
2
3
4
6 ne_set_useragent, ne_set_persist, ne_set_read_timeout, ne_get_scheme,
7 ne_get_server_hostport - common properties for HTTP sessions
8
10 #include <ne_session.h>
11
12
13 void ne_set_useragent (ne_session *session, const char *product);
14
15 void ne_set_persist (ne_session *session, int flag);
16
17 void ne_set_read_timeout (ne_session *session, int timeout);
18
19 const char *ne_get_scheme (ne_sesssion *session);
20
21 const char *ne_get_server_hostport (ne_sesssion *session);
22
23
25 The User-Agent request header is used to identify the software which
26 generated the request for statistical or debugging purposes. neon does
27 not send a User-Agent header unless a call is made to the ne_set_usera‐
28 gent. ne_set_useragent must be passed a product string conforming to
29 RFC2616's product token grammar; of the form "Product/Version".
30
31
32 By default neon will use a persistent connection whenever possible. For
33 specific applications, or for debugging purposes, it is sometimes use‐
34 ful to disable persistent connections. The ne_set_persist function will
35 disable persistent connections if passed a flag parameter of 0, and
36 will enable them otherwise.
37
38
39 When neon reads from a socket, by default the read operation will time
40 out after 60 seconds, and the request will fail giving an NE_TIMEOUT
41 error. To configure this timeout interval, call ne_set_read_timeout
42 giving the desired number of seconds as the timeout parameter.
43
44
45 The scheme used to initially create the session will be returned by
46 ne_get_scheme.
47
48
49 The hostport pair with which the session is associated will be returned
50 by the ne_get_server_hostport; for example www.example.com:8080. Note
51 that the :port will be omitted if the default port for the scheme is
52 used.
53
54
56 Set a user-agent string:
57
58 ne_session *sess = ne_session_create(...);
59 ne_set_useragent(sess, "MyApplication/2.1");
60
61
62 Disable use of persistent connections:
63
64 ne_session *sess = ne_session_create(...);
65 ne_set_persist(sess, 0);
66
67
68 Set a 30 second read timeout:
69
70 ne_session *sess = ne_session_create(...);
71 ne_set_read_timeout(sess, 30);
72
73
75 Joe Orton <neon@webdav.org>.
76
77
78
79neon 0.25.5 20 January 2006 NE_SET_USERAGENT(3)