do it yourself (OCaml) HTTP daemonOCaml HTTP is an OCaml library freely inspired from Perl's HTTP::Daemon module that permits you to write simple HTTP daemons in OCaml. The main API let you define a HTTP daemon
specification, which contains, among other parameters, a
callback function that is invoked each time a
request is received. The callback function will be invoked with an
instance of an object representing the received HTTP request and an
Then you can start your HTTP daemon invoking the
You can use a lot of facility functions in your
callback that permits you to send easily headers, error responses,
file, or abstract HTTP response objects. Otherwise you can also
choose the 'hard way' and send data directly to the
Daemon specifications are used also to specify other parameters governing daemon behaviour like: TCP port and address to bind, way of handling incoming requests (handle all of them in a single process, fork a new process or spawn a new thread for each incoming request), timeout, authentication requirements (username and password for HTTP basic authentication). OCaml HTTP contains also a tiny implementation of a HTTP client which can be used to retrieve resources via GET HTTP method and to iter on them (useful for huge resources which can't be kept in memory). OCaml HTTP is freely distributed under the GNU Library General Public License (GPL) and is available here for download:
To build OCaml HTTP from sources you will need: |
