http-server.h revision 47fee1a942e4797548b1232354f6676b8ff809f4
919N/A /* maximum number of pipelined requests per connection (default = 1) */ 70N/A Configuring this is mainly useful for the test suite. The kernel 493N/A defaults are used when these settings are 0. */ 947N/A /* Handle the server request. All requests must be sent back a response. 947N/A The response is sent either with http_server_request_fail*() or 969N/A http_server_response_submit*(). For simple requests you can send the 40N/A response back immediately. If you can't do that, you'll need to 40N/A reference the request. Then the code flow usually goes like this: 40N/A - http_server_request_set_destroy_callback(destroy_callback) 920N/A - http_server_request_ref() 920N/A - <do whatever is needed to handle the request> 40N/A - http_server_response_create() 70N/A - http_server_response_set_payload() can be used especially with 70N/A istream-callback to create a large response without temp files. 40N/A - http_server_response_submit() triggers the destroy_callback 970N/A after it has finished sending the response and its payload. 970N/A - In destroy_callback: http_server_request_unref() and any other 970N/A necessary cleanup - the request handling is now fully finished. /* shut down the server; accept no new requests and drop connections once /* Returns FALSE if unrefing destroyed the connection entirely */ /* Returns the response created for the request with http_server_response_create(), or NULL if none. */ /* Returns TRUE if request is finished either because a response was sent or because the request was aborted. */ /* Return input stream for the request's payload. Optionally, this stream can be made blocking. Do *NOT* meddle with the FD of the http_request payload to achieve the same, because protocol violations will result. /* Get the authentication credentials provided in this request. Returns 0 if the Authorization header is absent, returns -1 when that header cannot be parsed, and returns 1 otherwise */ /* Send a failure response to the request with given status/reason. */ /* Send a failure response to the request with given status/reason and close the connection. */ /* Send an authentication failure response to the request with given reason. The provided challenge is set in the WWW-Authenticate header of the /* Send a authentication failure response to the request with given reason. The provided realm is used to construct an Basic challenge in the WWW-Authenticate header of the response. */ /* Call the specified callback when HTTP request is destroyed. This happens after one of the following: a) Response and its payload is fully sent b) Response was submitted, but it couldn't be sent due to disconnection. c) http_server_deinit() was called and the request was aborted Note client disconnection before response is submitted isn't visible to this. The request payload reading is the responsibility of the caller, which also must handle the read errors by submitting a failure response. */ /* Reference a server request */ /* Unreference a server request. Returns TRUE if there are still more references, FALSE if not. */ /* Start creating the response for the request. This function can be called only once for each request. */ /* Change the response code and text, cannot be used after submission */ /* get some information about response */ /* Submit response and close the connection. */ /* submits response and blocks until provided payload is sent. Multiple calls are allowed; payload transmission is finished with http_server_response_finish_payload(). If the sending fails, returns -1 and sets resp=NULL to indicate that the response was freed, otherwise returns 0 and resp is unchanged. */ /* Finish sending the payload. Always frees resp and sets it to NULL. Returns 0 on success, -1 on error. */ /* abort response payload transmission prematurely. this closes the associated