ne_set_useragent.3 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. '\" t
  2. .\" Title: ne_set_useragent
  3. .\" Author:
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 11 September 2022
  6. .\" Manual: neon API reference
  7. .\" Source: neon 0.32.4
  8. .\" Language: English
  9. .\"
  10. .TH "NE_SET_USERAGENT" "3" "11 September 2022" "neon 0.32.4" "neon API reference"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. ne_set_useragent, ne_set_read_timeout, ne_set_connect_timeout, ne_get_scheme, ne_get_server_hostport \- common properties for HTTP sessions
  32. .SH "SYNOPSIS"
  33. .sp
  34. .ft B
  35. .nf
  36. #include <ne_session\&.h>
  37. .fi
  38. .ft
  39. .HP \w'void\ ne_set_useragent('u
  40. .BI "void ne_set_useragent(ne_session\ *" "session" ", const\ char\ *" "product" ");"
  41. .HP \w'void\ ne_set_read_timeout('u
  42. .BI "void ne_set_read_timeout(ne_session\ *" "session" ", int\ " "timeout" ");"
  43. .HP \w'void\ ne_set_connect_timeout('u
  44. .BI "void ne_set_connect_timeout(ne_session\ *" "session" ", int\ " "timeout" ");"
  45. .HP \w'const\ char\ *ne_get_scheme('u
  46. .BI "const char *ne_get_scheme(ne_sesssion\ *" "session" ");"
  47. .HP \w'const\ char\ *ne_get_server_hostport('u
  48. .BI "const char *ne_get_server_hostport(ne_sesssion\ *" "session" ");"
  49. .SH "DESCRIPTION"
  50. .PP
  51. The
  52. User\-Agent
  53. request header is used to identify the software which generated the request for statistical or debugging purposes\&. neon does not send a
  54. User\-Agent
  55. header unless a call is made to the
  56. \fBne_set_useragent\fR\&.
  57. \fBne_set_useragent\fR
  58. must be passed a product string conforming to RFC2616\*(Aqs product token grammar; of the form
  59. "Product/Version"\&.
  60. .PP
  61. When neon reads from a socket, by default the read operation will time out after 60 seconds, and the request will fail giving an
  62. \fBNE_TIMEOUT\fR
  63. error\&. To configure this timeout interval, call
  64. \fBne_set_read_timeout\fR
  65. giving the desired number of seconds as the
  66. \fItimeout\fR
  67. parameter\&.
  68. .PP
  69. When a connection is being established to a server, normally only the system\*(Aqs TCP timeout handling will apply\&. To configure a specific (and probably shorter) timeout, the
  70. \fBne_set_connect_timeout\fR
  71. can be used, giving the desired number of seconds as the
  72. \fItimeout\fR
  73. parameter\&. If
  74. 0
  75. is passed, then the default behaviour of using the system TCP timeout will be used\&.
  76. .PP
  77. The scheme used to initially create the session will be returned by
  78. \fBne_get_scheme\fR\&.
  79. .PP
  80. The hostport pair with which the session is associated will be returned by the
  81. \fBne_get_server_hostport\fR; for example
  82. www\&.example\&.com:8080\&. Note that the
  83. :port
  84. will be omitted if the default port for the scheme is used\&.
  85. .SH "EXAMPLES"
  86. .PP
  87. Set a user\-agent string:
  88. .sp
  89. .if n \{\
  90. .RS 4
  91. .\}
  92. .nf
  93. ne_session *sess = ne_session_create(\&.\&.\&.);
  94. ne_set_useragent(sess, "MyApplication/2\&.1");
  95. .fi
  96. .if n \{\
  97. .RE
  98. .\}
  99. .PP
  100. Set a 30 second read timeout:
  101. .sp
  102. .if n \{\
  103. .RS 4
  104. .\}
  105. .nf
  106. ne_session *sess = ne_session_create(\&.\&.\&.);
  107. ne_set_read_timeout(sess, 30);
  108. .fi
  109. .if n \{\
  110. .RE
  111. .\}
  112. .SH "SEE ALSO"
  113. .PP
  114. ne_session_create,
  115. ne_set_session_flag\&.
  116. .SH "AUTHOR"
  117. .PP
  118. \fBJoe Orton\fR <\&[email protected]\&>
  119. .RS 4
  120. Author.
  121. .RE
  122. .SH "COPYRIGHT"
  123. .br