|
| 1 | +\input texinfo |
| 2 | +@setfilename libhttpserver.info |
| 3 | +@include version.texi |
| 4 | +@settitle The libhttpserver Reference Manual |
| 5 | +@c Unify all the indices into concept index. |
| 6 | +@syncodeindex fn cp |
| 7 | +@syncodeindex vr cp |
| 8 | +@syncodeindex ky cp |
| 9 | +@syncodeindex pg cp |
| 10 | +@syncodeindex tp cp |
| 11 | +@copying |
| 12 | +This manual is for libhttpserver |
| 13 | +(version @value{VERSION}, @value{UPDATED}), C++ library for creating an |
| 14 | +embedded Rest HTTP server (and more). |
| 15 | + |
| 16 | +Copyright @copyright{} 2011--2013 Sebastiano Merlino |
| 17 | + |
| 18 | +@quotation |
| 19 | +Permission is granted to copy, distribute and/or modify this document |
| 20 | +under the terms of the GNU Free Documentation License, Version 1.3 |
| 21 | +or any later version published by the Free Software Foundation; |
| 22 | +with no Invariant Sections, no Front-Cover Texts, and no Back-Cover |
| 23 | +Texts. A copy of the license is included in the section entitled "GNU |
| 24 | +Free Documentation License". |
| 25 | +@end quotation |
| 26 | +@end copying |
| 27 | + |
| 28 | +@dircategory Software libraries |
| 29 | +@direntry |
| 30 | +* libhttpserver: (libhttpserver). C++ library for creating an |
| 31 | +embedded Rest HTTP server (and more). |
| 32 | +@end direntry |
| 33 | + |
| 34 | +@c |
| 35 | +@c Titlepage |
| 36 | +@c |
| 37 | +@titlepage |
| 38 | +@title The libhttpserver Reference Manual |
| 39 | +@subtitle Version @value{VERSION} |
| 40 | +@subtitle @value{UPDATED} |
| 41 | +@author Sebastiano Merlino (@email{electrictwister2000@@gmail.com}) |
| 42 | +@page |
| 43 | +@vskip 0pt plus 1filll |
| 44 | +@insertcopying |
| 45 | +@end titlepage |
| 46 | + |
| 47 | +@ifnottex |
| 48 | +@node Top |
| 49 | +@top The libhttpserver Library |
| 50 | +@insertcopying |
| 51 | +@end ifnottex |
| 52 | + |
| 53 | +@c @summarycontents |
| 54 | +@c @contents |
| 55 | + |
| 56 | +@c ------------------------------------------------------------ |
| 57 | +@menu |
| 58 | +* httpserver-intro:: Introduction. |
| 59 | +* httpserver-const:: Constants. |
| 60 | +* httpserver-struct:: Structures and classes type definition. |
| 61 | +* httpserver-cb:: Callback functions definition. |
| 62 | +* httpserver-init:: Create and work with server. |
| 63 | +* httpserver-resources:: Registering resources. |
| 64 | +* httpserver-responses:: Building responses to requests. |
| 65 | +* httpserver-bans:: Whitelists and Blacklists. |
| 66 | +* httpserver-comet:: Simple comet semantics. |
| 67 | +* httpserver-dauth:: Utilizing Authentication. |
| 68 | +* httpserver-info:: Obtaining and modifying status information. |
| 69 | +
|
| 70 | +Appendices |
| 71 | + |
| 72 | +* GNU-LGPL:: The GNU Lesser General Public License says how you |
| 73 | + can copy and share almost all of `libhttpserver'. |
| 74 | +* GNU-FDL:: The GNU Free Documentation License says how you |
| 75 | + can copy and share the documentation of `libhttpserver'. |
| 76 | +
|
| 77 | +Indices |
| 78 | + |
| 79 | +* Concept Index:: Index of concepts and programs. |
| 80 | +* Function and Data Index:: Index of functions, variables and data types. |
| 81 | +* Type Index:: Index of data types. |
| 82 | +@end menu |
| 83 | + |
| 84 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 85 | + |
| 86 | +@c ------------------------------------------------------------ |
| 87 | +@node httpserver-intro |
| 88 | +@chapter Introduction |
| 89 | + |
| 90 | + |
| 91 | +@noindent |
| 92 | +libhttpserver is meant to constitute an easy system to build HTTP |
| 93 | +servers with REST fashion. |
| 94 | +libhttpserver is based on libhttpserver and, like this, it is a |
| 95 | +daemon library. |
| 96 | +The mission of this library is to support all possible HTTP features |
| 97 | +directly and with a simple semantic allowing then the user to concentrate |
| 98 | +only on his application and not in HTTP handling details. |
| 99 | + |
| 100 | +The library is supposed to work transparently for the client Implementing |
| 101 | +the business logic and using the library itself to realize an interface. |
| 102 | +If the user wants it must be able to change every behavior of the library |
| 103 | +itself through the registration of callbacks. |
| 104 | + |
| 105 | +Like the api is based on (libhttpserver), libhttpserver is able to decode |
| 106 | +certain body format a and automatically format them in object oriented |
| 107 | +fashion. This is true for query arguments and for @code{POST} and @code{PUT} |
| 108 | +requests bodies if @code{application/x-www-form-urlencoded} or |
| 109 | +@code{multipart/form-data} header are passed. |
| 110 | + |
| 111 | +The header reproduce all the constants defined by libhttpserver. |
| 112 | +These maps various constant used by the HTTP protocol that are exported |
| 113 | +as a convenience for users of the library. Is is possible for the user |
| 114 | +to define their own extensions of the HTTP standard and use those with |
| 115 | +libhttpserver. |
| 116 | + |
| 117 | +All functions are guaranteed to be completely reentrant and |
| 118 | +thread-safe. |
| 119 | +Additionally, clients can specify resource limits on the overall |
| 120 | +number of connections, number of connections per IP address and memory |
| 121 | +used per connection to avoid resource exhaustion. |
| 122 | + |
| 123 | +@section Compiling libhttpserver |
| 124 | +@cindex compilation |
| 125 | +@cindex embedded systems |
| 126 | +@cindex portability |
| 127 | + |
| 128 | +libhttpserver uses the standard system where the usual build process |
| 129 | +involves running |
| 130 | +@verbatim |
| 131 | +$ ./configure |
| 132 | +$ make |
| 133 | +$ make install |
| 134 | +@end verbatim |
| 135 | + |
| 136 | +@c ------------------------------------------------------------ |
| 137 | +@node httpserver-const |
| 138 | +@chapter Constants |
| 139 | + |
| 140 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 141 | + |
| 142 | +@c ------------------------------------------------------------ |
| 143 | +@node httpserver-struct |
| 144 | +@chapter Structures and classes type definition |
| 145 | + |
| 146 | + |
| 147 | +@deftp {CPP Class} http_resource |
| 148 | +Represents the resource corresponding to a specific endpoint. |
| 149 | +@end deftp |
| 150 | + |
| 151 | +@deftp {CPP Class} http_request |
| 152 | +Represents the request received by the resource that process it. |
| 153 | +@end deftp |
| 154 | + |
| 155 | +@deftp {CPP Class} http_response |
| 156 | +Represents the response sent by the server once the resource |
| 157 | +finished its work. |
| 158 | +@end deftp |
| 159 | + |
| 160 | +@deftp {CPP Class} webserver |
| 161 | +Represents the daemon listening on a socket for HTTP traffic. |
| 162 | +@end deftp |
| 163 | + |
| 164 | + |
| 165 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 166 | + |
| 167 | +@c ------------------------------------------------------------ |
| 168 | +@node httpserver-cb |
| 169 | +@chapter Callback functions definition |
| 170 | + |
| 171 | +Callbacks are functions defined by the client and then used by the library. This way |
| 172 | +it is possible to extend the library itself. |
| 173 | + |
| 174 | +@deftypefn {Function Pointer} void {*log_access_ptr} (const std::string& uri) |
| 175 | +Invoked by the library when a new connection is opened by the client. |
| 176 | + |
| 177 | +@table @var |
| 178 | +@item uri |
| 179 | +A string containing the uri called by the client and the method it used. |
| 180 | +@end table |
| 181 | +@end deftypefn |
| 182 | + |
| 183 | + |
| 184 | +@deftypefn {Function Pointer} void {*log_error_ptr} (const std::string& message) |
| 185 | +Invoked by the library to send error messages. |
| 186 | + |
| 187 | +@table @var |
| 188 | +@item message |
| 189 | +A string containing the message to log. |
| 190 | +@end table |
| 191 | +@end deftypefn |
| 192 | + |
| 193 | +@deftypefn {Function Pointer} void {*unescaper_ptr} (char* uri) |
| 194 | +Invoked by the library to unescape the uri requested by the client. |
| 195 | +If no unescaper_ptr is passed to the webserver it uses the internal defined |
| 196 | +unescaper function. |
| 197 | + |
| 198 | +@table @var |
| 199 | +@item uri |
| 200 | +A c-style string containing the uri to unescape. |
| 201 | +@end table |
| 202 | +@end deftypefn |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 207 | + |
| 208 | +@c ------------------------------------------------------------ |
| 209 | +@node httpserver-init |
| 210 | +@chapter Create and work with server |
| 211 | + |
| 212 | +@deftypemethod {webserver}{} webserver (int port, const http_utils::start_method_T& start_method, int max_threads, int max_connections, int memory_limit, int connection_timeout, int per_IP_connection_limit, log_access_ptr log_access, log_error_ptr log_error, validator_ptr validator, unescaper_ptr unescaper, const struct sockaddr* bind_address, int bind_socket, int max_thread_stack_size, bool use_ssl, bool use_ipv6, bool debug, bool pedantic, const std::string& https_mem_key, const std::string& https_mem_cert, const std::string& https_mem_trust, const std::string& https_mem_priorities, const http_utils::cred_type_T& cred_type, const std::string digest_auth_random, int nonce_nc_size, const http_utils::policy_T& default_policy, bool basic_auth_enabled, bool digest_auth_enabled, bool regex_checking, bool ban_system_enabled, bool post_process_enabled, render_ptr single_resource, render_ptr not_found_resource, render_ptr method_not_allowed_resource, render_ptr method_not_acceptable_resource, render_ptr internal_error_resource) |
| 213 | + |
| 214 | +@end deftypemethod |
| 215 | + |
| 216 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 217 | + |
| 218 | +@c ----------------------------------------------------------- |
| 219 | +@node httpserver-resources |
| 220 | +@chapter Registering resources |
| 221 | + |
| 222 | + |
| 223 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 224 | + |
| 225 | +@c ------------------------------------------------------------ |
| 226 | +@node httpserver-responses |
| 227 | +@chapter Building responses to requests |
| 228 | + |
| 229 | + |
| 230 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 231 | + |
| 232 | +@c ------------------------------------------------------------ |
| 233 | +@c @node httpserver-response create |
| 234 | +@c @section Creating a response object |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 239 | + |
| 240 | +@c ------------------------------------------------------------ |
| 241 | +@c @node httpserver-response headers |
| 242 | +@c @section Adding headers to a response |
| 243 | + |
| 244 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 245 | + |
| 246 | +@c ------------------------------------------------------------ |
| 247 | +@c @node httpserver-response inspect |
| 248 | +@c @section Inspecting a response object |
| 249 | + |
| 250 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 251 | + |
| 252 | +@c ------------------------------------------------------------ |
| 253 | +@node httpserver-dauth |
| 254 | +@chapter Utilizing Authentication |
| 255 | + |
| 256 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 257 | + |
| 258 | +@c ------------------------------------------------------------ |
| 259 | +@node httpserver-info |
| 260 | +@chapter Obtaining and modifying status information. |
| 261 | + |
| 262 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 263 | + |
| 264 | +@c ------------------------------------------------------------ |
| 265 | +@node httpserver-bans |
| 266 | +@chapter AAAA |
| 267 | + |
| 268 | + |
| 269 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 270 | + |
| 271 | +@c ------------------------------------------------------------ |
| 272 | +@node httpserver-comet |
| 273 | +@chapter AAAA |
| 274 | + |
| 275 | + |
| 276 | + |
| 277 | +@c ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 278 | + |
| 279 | + |
| 280 | +@c ********************************************************** |
| 281 | +@c ******************* Appendices ************************* |
| 282 | +@c ********************************************************** |
| 283 | + |
| 284 | +@node GNU-LGPL |
| 285 | +@unnumbered GNU-LGPL |
| 286 | +@cindex license |
| 287 | +@include lgpl.texi |
| 288 | + |
| 289 | +@node GNU-FDL |
| 290 | +@unnumbered GNU-FDL |
| 291 | +@cindex license |
| 292 | +@include fdl-1.3.texi |
| 293 | + |
| 294 | +@node Concept Index |
| 295 | +@unnumbered Concept Index |
| 296 | + |
| 297 | +@printindex cp |
| 298 | + |
| 299 | +@node Function and Data Index |
| 300 | +@unnumbered Function and Data Index |
| 301 | + |
| 302 | +@printindex fn |
| 303 | + |
| 304 | +@node Type Index |
| 305 | +@unnumbered Type Index |
| 306 | + |
| 307 | +@printindex tp |
| 308 | + |
| 309 | +@bye |
0 commit comments