.\"     Title: ne_set_useragent
.\"    Author: 
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
.\"      Date: 20 August 2008
.\"    Manual: neon API reference
.\"    Source: neon 0.28.3
.\"
.TH "NE_SET_USERAGENT" "3" "20 August 2008" "neon 0.28.3" "neon API reference"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
ne_set_useragent, ne_set_read_timeout, ne_set_connect_timeout, ne_get_scheme, ne_get_server_hostport - common properties for HTTP sessions
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include <ne_session\.h>
.fi
.ft
.HP 22
.BI "void ne_set_useragent(ne_session\ *" "session" ", const\ char\ *" "product" ");"
.HP 25
.BI "void ne_set_read_timeout(ne_session\ *" "session" ", int\ " "timeout" ");"
.HP 28
.BI "void ne_set_connect_timeout(ne_session\ *" "session" ", int\ " "timeout" ");"
.HP 26
.BI "const char *ne_get_scheme(ne_sesssion\ *" "session" ");"
.HP 35
.BI "const char *ne_get_server_hostport(ne_sesssion\ *" "session" ");"
.SH "DESCRIPTION"
.PP
The
User\-Agent
request header is used to identify the software which generated the request for statistical or debugging purposes\. neon does not send a
User\-Agent
header unless a call is made to the
\fBne_set_useragent\fR\.
\fBne_set_useragent\fR
must be passed a product string conforming to RFC2616\'s product token grammar; of the form
"Product/Version"\.
.PP
When neon reads from a socket, by default the read operation will time out after 60 seconds, and the request will fail giving an
\fBNE_TIMEOUT\fR
error\. To configure this timeout interval, call
\fBne_set_read_timeout\fR
giving the desired number of seconds as the
\fItimeout\fR
parameter\.
.PP
When a connection is being established to a server, normally only the system\'s TCP timeout handling will apply\. To configure a specific (and probably shorter) timeout, the
\fBne_set_connect_timeout\fR
can be used, giving the desired number of seconds as the
\fItimeout\fR
parameter\. If
0
is passed, then the default behaviour of using the system TCP timeout will be used\.
.PP
The scheme used to initially create the session will be returned by
\fBne_get_scheme\fR\.
.PP
The hostport pair with which the session is associated will be returned by the
\fBne_get_server_hostport\fR; for example
www\.example\.com:8080\. Note that the
:port
will be omitted if the default port for the scheme is used\.
.SH "EXAMPLES"
.PP
Set a user\-agent string:
.sp
.RS 4
.nf
ne_session *sess = ne_session_create(\.\.\.);
ne_set_useragent(sess, "MyApplication/2\.1");
.fi
.RE
.PP
Disable use of persistent connections:
.sp
.RS 4
.nf
ne_session *sess = ne_session_create(\.\.\.);
ne_set_persist(sess, 0);
.fi
.RE
.PP
Set a 30 second read timeout:
.sp
.RS 4
.nf
ne_session *sess = ne_session_create(\.\.\.);
ne_set_read_timeout(sess, 30);
.fi
.RE
.SH "AUTHOR"
.PP
\fBJoe Orton\fR <\&neon@lists.manyfish.co.uk\&>
.sp -1n
.IP "" 4
Author.
.SH "COPYRIGHT"
