Skip to content
This repository

Very lightweight HTTP server using Lwt or Async

Octocat-spinner-32 async Adapt to latest Conduit API
Octocat-spinner-32 bin Bugfixes to cohttp-async-server, and add index file detection
Octocat-spinner-32 cohttp bump the conduit branch to 0.11.0
Octocat-spinner-32 examples correct filename in example
Octocat-spinner-32 lib_test Add an SSL Lwt server test case alongside the TCP one
Octocat-spinner-32 lwt correct port type in Lt
Octocat-spinner-32 scripts update type generator to use sexp
Octocat-spinner-32 .gitignore ignore dist/ as generated by obuild
Octocat-spinner-32 .merlin update .merlin
Octocat-spinner-32 .ocp-indent ocp-indent config file for lwt
Octocat-spinner-32 .travis-ci.sh Merge branch 'master' of git://github.com/cgaebel/ocaml-cohttp into c…
Octocat-spinner-32 .travis.yml Travis: remove opam 1.0.0 from the tests
Octocat-spinner-32 CHANGES mention conduit in CHANGES
Octocat-spinner-32 LICENSE Replace LICENSE with the ISC, which has been true of the individual
Octocat-spinner-32 Makefile disable Nettests by default
Octocat-spinner-32 README.md correct mirage ref in readme
Octocat-spinner-32 TODO.md remove Async SSL todo
Octocat-spinner-32 _oasis Fix @rgrinberg's name in the authors list. Sorry!
Octocat-spinner-32 _tags Async: Adapt to external Conduit library API (less Uri-specific now)
Octocat-spinner-32 myocamlbuild.ml Async: Adapt to external Conduit library API (less Uri-specific now)
Octocat-spinner-32 opam Add a local opam file for easier pinning
Octocat-spinner-32 setup.ml Fix @rgrinberg's name in the authors list. Sorry!
README.md

CoHTTP is an OCaml library for creating HTTP daemons. It has a portable HTTP parser, and implementations using various asynchronous programming libraries:

  • Cohttp_lwt_unix uses the Lwt library, and specifically the UNIX bindings.
  • Cohttp_async uses the Async library.
  • Cohttp_lwt exposes an OS-independent Lwt interface, which is used by the the Mirage interface to generate standalone microkernels (see the mirage-http repository).

You can implement other targets using the parser very easily. Look at the lib/IO.mli signature and implement that in the desired backend.

You can activate some runtime debugging by setting COHTTP_DEBUG to any value, and all requests and responses will be written to stderr.

For build requirements, please see the _oasis file, or use OPAM to install it from http://github.com/ocaml/opam.

Simple HTTP server

If you install the Async dependency, then a cohttp-server binary will also be built and installed that acts in a similar fashion to the Python SimpleHTTPServer. Just run cohttp-server in a directory and it will open up a local port and serve the files over HTTP.

Something went wrong with that request. Please try again.