This module implements a simple HTTP server.
It can be used to handle individual HTTP requests (http_serve_fetch/2) or for implementing a simple HTTP server (see http_bind/1, http_loop/1, http_shutdown/1).
Clients of this module must use the http_server_hooks package and implement the multifile httpserv.handle/3 (see http_loop/1 for details).
Usage:http_serve_fetch(Stream,Serve)
Read a HTTP request from Stream, obtain the response calling Serve predicate, and write the response to the socket stream.
Usage:http_loop(ExitCode)
Listen and handle HTTP requests in a loop. You can terminate this loop by http_shutdown/1 predicate. Requests are handled by multifile httpserv.handle/3 and httpserv.file_path/2 predicates (declared in http_server_hooks file).
Usage:http_shutdown(ExitCode)
ExitCode mark that we are not going to process further requests
Usage:http_protect(Handler,ErrHandler,Request,Response)
Execute Handler on Request to obtain Response. If Handler fails or raises some exception E, a response is obtained calling ErrHandler on E. This is useful, for example, to produce an HTML page informing about the incident