.\" Title: ne_set_useragent
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.72.0
.\" Date: 14 July 2007
.\" Manual: neon API reference
.\" Source: neon 0.26.4
.\"
.TH "NE_SET_USERAGENT" "3" "14 July 2007" "neon 0.26.4" "neon API reference"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
ne_set_useragent, ne_set_persist, ne_set_read_timeout, ne_get_scheme, ne_get_server_hostport \- common properties for HTTP sessions
.SH "SYNOPSIS"
.sp
.ft B
.nf
#include
.fi
.ft
.HP 22
.BI "void ne_set_useragent(ne_session\ *" "session" ", const\ char\ *" "product" ");"
.HP 20
.BI "void ne_set_persist(ne_session\ *" "session" ", int\ " "flag" ");"
.HP 25
.BI "void ne_set_read_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
By default neon will use a persistent connection whenever possible. For specific applications, or for debugging purposes, it is sometimes useful to disable persistent connections. The
\fBne_set_persist\fR
function will disable persistent connections if passed a
\fIflag\fR
parameter of
0, and will enable them otherwise.
.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
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@webdav.org\&>
.sp -1n
.IP "" 4
Author.
.SH "COPYRIGHT"