📄 ne_set_useragent.3
字号:
.\"Generated by db2man.xsl. Don't modify this, modify the source..de Sh \" Subsection.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Ip \" List item.br.ie \\n(.$>=3 .ne \\$3.el .ne 3.IP "\\$1" \\$2...TH "NE_SET_USERAGENT" 3 "5 July 2004" "neon 0.24.7" "neon API reference".SH NAMEne_set_useragent, ne_set_persist, ne_set_read_timeout, ne_set_expect100 \- common settings for HTTP sessions.SH "SYNOPSIS".ad l.hy 0#include <ne_session\&.h>.sp.HP 23void\ \fBne_set_useragent\fR\ (ne_session\ *\fIsession\fR, const\ char\ *\fIproduct\fR);.HP 21void\ \fBne_set_persist\fR\ (ne_session\ *\fIsession\fR, int\ \fIflag\fR);.HP 26void\ \fBne_set_read_timeout\fR\ (ne_session\ *\fIsession\fR, int\ \fItimeout\fR);.HP 23void\ \fBne_set_expect100\fR\ (ne_session\ *\fIsession\fR, int\ \fIflag\fR);.ad.hy.SH "DESCRIPTION".PPThe 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"\&..PPBy 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\&..PPWhen 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\&..PPAn extension introduced in the HTTP/1\&.1 specification was the use of the Expect: 100\-continue header\&. This header allows an HTTP client to be informed of the expected response status before the request message body is sent: a useful optimisation for situations where a large message body is to be sent\&. The \fBne_set_expect100\fR function can be used to enable this feature by passing the \fIflag\fR parameter as any non\-zero integer\&..RS.Sh "Warning".PPUnfortunately, if this header is sent to a server which is not fully compliant with the HTTP/1\&.1 specification, a deadlock occurs resulting in a temporarily "hung" connection\&. neon will recover gracefully from this situation, but only after a 15 second timeout\&. It is highly recommended that this option is not enabled unless it is known that the server in use correctly implements Expect: 100\-continue support\&..RE.SH "EXAMPLES".PPSet a user\-agent string:.nfne_session *sess = ne_session_create(\&.\&.\&.);ne_set_useragent(sess, "MyApplication/2\&.1");.fi.PPDisable use of persistent connections:.nfne_session *sess = ne_session_create(\&.\&.\&.);ne_set_persist(sess, 0);.fi.PPSet a 30 second read timeout:.nfne_session *sess = ne_session_create(\&.\&.\&.);ne_set_read_timeout(sess, 30);.fi.SH AUTHORJoe Orton <neon@webdav\&.org>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -