1NE_SET_USERAGENT(3) neon API reference NE_SET_USERAGENT(3)
2
3
4
6 ne_set_useragent, ne_set_read_timeout, ne_set_connect_timeout,
7 ne_get_scheme, ne_get_server_hostport - common properties for HTTP
8 sessions
9
11 #include <ne_session.h>
12
13 void ne_set_useragent(ne_session *session, const char *product);
14
15 void ne_set_read_timeout(ne_session *session, int timeout);
16
17 void ne_set_connect_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
24 The User-Agent request header is used to identify the software which
25 generated the request for statistical or debugging purposes. neon does
26 not send a User-Agent header unless a call is made to the
27 ne_set_useragent. ne_set_useragent must be passed a product string
28 conforming to RFC2616's product token grammar; of the form
29 "Product/Version".
30
31 When neon reads from a socket, by default the read operation will time
32 out after 60 seconds, and the request will fail giving an NE_TIMEOUT
33 error. To configure this timeout interval, call ne_set_read_timeout
34 giving the desired number of seconds as the timeout parameter.
35
36 When a connection is being established to a server, normally only the
37 system's TCP timeout handling will apply. To configure a specific (and
38 probably shorter) timeout, the ne_set_connect_timeout can be used,
39 giving the desired number of seconds as the timeout parameter. If 0 is
40 passed, then the default behaviour of using the system TCP timeout will
41 be used.
42
43 The scheme used to initially create the session will be returned by
44 ne_get_scheme.
45
46 The hostport pair with which the session is associated will be returned
47 by the ne_get_server_hostport; for example www.example.com:8080. Note
48 that the :port will be omitted if the default port for the scheme is
49 used.
50
52 Set a user-agent string:
53
54 ne_session *sess = ne_session_create(...);
55 ne_set_useragent(sess, "MyApplication/2.1");
56
57 Set a 30 second read timeout:
58
59 ne_session *sess = ne_session_create(...);
60 ne_set_read_timeout(sess, 30);
61
63 ne_session_create, ne_set_session_flag.
64
66 Joe Orton
67 Author.
68
70neon 0.32.5 21 January 2023 NE_SET_USERAGENT(3)