Skip to content

Releases: mirage/ocaml-cohttp

Stability improvements and utility functions

15 Feb 18:26
Compare
Choose a tag to compare
  • When transfer encoding is unknown, read until EOF when body size is unknown. (#241)
  • Add some missing documentation to Cohttp.S.IO signature. (#233)
  • Add Cohttp.Header.mem to check if a header exists.
  • Add Cohttp.Conf module to expose the library version number. (#259)
  • Add Cohttp.Header.add_unless_exists to update a key if it doesn't already exist. (#244)
  • Add Cohttp.Header.get_location to retrieve redirection information. (#254)
  • [async] Clean up the Net.lookup function to use Or_error.t instead of raising. (#247)
  • [tests] Add more tests for content-range handling. (#249)

Improved command-line tools and Lwt 2.4.7 support

11 Jan 12:07
Compare
Choose a tag to compare
  • Lwt 2.4.7 renamed blit_bytes_string to blit_to_bytes, so depend
    on the newer API now. (#230)
  • Use cmdliner in all of the Lwt client and server binaries. This gives
    cohttp-lwt-server a nice Unix-like command-line interface now that
    can be viewed with the --help option. (#218 via Runhang Li)
  • Improve oasis constraints and regenerate opam file (#229 via
    Christophe Troestler).

Compatibility with new base64 and minor interface tweaks

25 Dec 07:50
Compare
Choose a tag to compare

Compatibility breaking interface changes:

  • Change Cohttp_lwt_body.map to use a non-labelled type to fit the Lwt
    style better (#200).
  • Depend on Base64 version 2, which uses B64 as the toplevel module name (#220).

New features and bug fixes:

  • Remove use of deprecated Lwt_unix.run and replace it with Lwt_main.run.
    Should be no observable external change (#217).
  • Improve ocamldoc of Cohttp.S signature (#221).

Simplify server interface

19 Dec 00:02
Compare
Choose a tag to compare

Compatibility breaking interface changes:

  • Simplify the Lwt server signature, so that manual construction of
    a callback is no longer required (#210).
    Code that previous looked like:
   let conn_closed (_,conn_id) () = <...>
   let config = { Server.callback; conn_closed } in

should now be:

   let conn_closed (_,conn_id) = <...>
   let config = Server.make ~callback ~conn_closed () in
  • Remove the Cohttp.Base64 module in favour of the external base64
    library (which is now a new dependency).

New features and bug fixes:

  • Lwt respond_error now defaults to an internal server error if no
    status code is specified (#212).
  • Modernise the opam file using the OPAM 1.2 workflow (#211).
  • Flush the response body to the network by default, rather than
    buffering by default. The ?flush optional parameter can still
    be explicitly set to false if flushing is not desired (#205).

Support for the pure OCaml TLS stack in HTTP clients and servers

05 Dec 16:01
Compare
Choose a tag to compare

Compatibility breaking interface changes:

  • Add sexp converters for Conduit contexts and Lwt client and server
    modules and module types.

New Features and bug fixes:

  • Can use the Conduit 0.7+ CONDUIT_TLS=native environment variable to
    make HTTPS requests using the pure OCaml TLS stack instead of depending
    on OpenSSL bindings. All of the installed binaries (client and server)
    can work in this mode.
  • Add Cohttp_lwt_unix_debug which lets libraries control the debugging
    output from Cohttp. Previously the only way to do this was to set the
    COHTTP_DEBUG environment variable at the program start.
  • Add cohttp-curl-lwt as a lightweight URI fetcher from the command-line.
    It uses the cmdliner as a new dependency.
  • Remove build dependency check on lwt.ssl for cohttp.lwt.
    This has been moved to conduit, so only lwt.unix is needed here now.

Add JavaScript and StringIO backends, and numerous interface improvements

07 Nov 16:58
Compare
Choose a tag to compare

Compatibility breaking interface changes:

  • Rename Cohttp.Auth.t to Cohttp.Auth.credential and Cohttp.Auth.req
    to Cohttp.Auth.challenge. Also expose an Other variant
    to make it more extensible for unknown authentication types. The
    Cohttp.Auth functions using these types have also been renamed accordingly.
  • Rename Cohttp.Transfer.encoding_to_string to string_of_encoding
    for consistency with the rest of Cohttp's APIs.
  • The has_body function in the Request and Response modules now
    explicitly signals when the body size is unknown.
  • Move all the module type signatures into Cohttp.S.
  • If users have percent-encoded file names, their resolution is changed:
    resolve_local_file in Cohttp_async and Cohttp_lwt now always
    percent-decode paths (#157)
  • Remove the Cohttp_lwt.Server.server type synonym to t.
  • When reading data from a HTTP body stream using the Fixed encoding,
    we need to maintain state (bytes remaining) so we know when to finish.
    The Cohttp.Request and Cohttp.Response interfaces now expose a
    reader and writer types to track this safely.
  • Add is_empty function to the Cohttp.S.Body module type.
  • Add Strings representation to Cohttp.Body to efficiently hold a
    list of body chunks.
  • Move flushing logic for HTTP bodies into the portable Request and
    Response modules instead of individual Lwt and Async backends.
  • Port module interfaces to the latest Conduit (0.6.0+) API.
  • Cohttp requires OCaml 4.01.0 or higher now.

New features and bugfixes:

  • Add a Cohttp_lwt_xhr JavaScript backend that enables Cohttp logic to be
    mapped to XMLHTTPRequest in browsers via js_of_ocaml (via Andy Ray).
  • Add a Cohttp.String_io and String_io_lwt module that uses OCaml
    string or Buffer.t to read and write HTTP requests and responses
    instead of network connections.
  • cohttp_server_lwt and cohttp_server_async now return better errors (#158)
  • cohttp_server_lwt and cohttp_server_async now serve indexes directly (#162)
  • [lwt] Add stop thread to terminate a running server if it finishes (#147).
  • Add Cohttp.Connection.compare to make ordering of connections possible.
  • Add Body.map and Body.as_pipe to work with HTTP bodies more easily.
  • Remove link-time dependency on camlp4 via META fixes (#127).
  • Support HTTP methods and versions other than the standard ones. (#142).
  • Improve cohttp_server_lwt and cohttp_server_async directory listings (#158)
  • Fix Cohttp_async.resolve_local_file directory traversal vulnerability (#158)
  • [async] In the Async server, do not close the Reader too early.
  • [async] Close file descriptors more eagerly in the HTTP client (#167).
  • Reduce thread allocation by replacing return <const> with return_none,
    return_unit or return_nil.

Build fixes

22 Apr 13:17
Compare
Choose a tag to compare
  • Fix Lwt Unix build by add a missing build-deps in _oasis

Add Lwt SimpleHTTPServer, and bugfixes

17 Apr 21:31
Compare
Choose a tag to compare
Pre-release
  • Remove an errant async_ssl reference left in the _oasis file that is
    now handled by the Conduit library (#116).
  • Add an Lwt-based SimpleHTTPServer equivalent as cohttp-server-lwt (#108).
  • Cohttp.Connection.t now exposes sexp accessor functions (#117).

Thread safety and Async/Lwt SSL

13 Apr 09:12
Compare
Choose a tag to compare
Pre-release
  • Remove dependency on ocaml-re in order to make library POSIX thread-safe.
  • Shift most of the connection handling logic out to a Conduit library that
    worries about which SSL library to use, and fails if SSL is not available.
  • Add Async-SSL support for both client and server (#102).
  • Add Lwt-SSL support for the server side (the client side existed before).
  • Fix buggy Async chunked POST handling.

Interface cleanups before a 1.0 release

13 Apr 09:12
Compare
Choose a tag to compare
  • Interface change: The Request and Response module types now explictly
    signal Eof and Invalid (for errors), to help the backend distinguish them.
  • Interface change: Unify HTTP body handling across backends into a Cohttp.Body
    module. This is extended by Async/Lwt implementations with their specific
    ways of handling bodies (Pipes for Async, or Lwt_stream for Lwt).
  • [lwt] Interface change: HTTP client calls now raise Lwt exceptions rather
    than return an option type. This permits better error handling in Lwt.
  • [lwt] Interface change: The Server callback now always provides a body
    argument, since Cohttp_lwt_body now explicitly supports empty bodys.
  • Add Cohttp.Header.is_keep_alive to test if a connection should be reused.
  • [lwt] Respect the keep-alive header in the server request handling.
  • [async] Add a Body that takes a Pipe or a string, similarly to Lwt.
  • Install cohttp-server binary even if tests are disabled.
  • Begin an examples directory with some simple uses of the library.