Releases: mirage/ocaml-cohttp
Releases · mirage/ocaml-cohttp
Stability improvements and utility functions
- 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 useOr_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
- Lwt 2.4.7 renamed
blit_bytes_string
toblit_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 regenerateopam
file (#229 via
Christophe Troestler).
Compatibility with new base64 and minor interface tweaks
Simplify server interface
Compatibility breaking interface changes:
- Simplify the Lwt server signature, so that manual construction of
acallback
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 externalbase64
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
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 thecmdliner
as a new dependency. - Remove build dependency check on
lwt.ssl
forcohttp.lwt
.
This has been moved to conduit, so onlylwt.unix
is needed here now.
Add JavaScript and StringIO backends, and numerous interface improvements
Compatibility breaking interface changes:
- Rename
Cohttp.Auth.t
toCohttp.Auth.credential
andCohttp.Auth.req
toCohttp.Auth.challenge
. Also expose anOther
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
tostring_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
inCohttp_async
andCohttp_lwt
now always
percent-decode paths (#157) - Remove the
Cohttp_lwt.Server.server
type synonym tot
. - 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.
TheCohttp.Request
andCohttp.Response
interfaces now expose a
reader
andwriter
types to track this safely. - Add
is_empty
function to theCohttp.S.Body
module type. - Add
Strings
representation toCohttp.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 toXMLHTTPRequest
in browsers viajs_of_ocaml
(via Andy Ray). - Add a
Cohttp.String_io
andString_io_lwt
module that uses OCaml
string
orBuffer.t
to read and write HTTP requests and responses
instead of network connections. cohttp_server_lwt
andcohttp_server_async
now return better errors (#158)cohttp_server_lwt
andcohttp_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
andBody.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
andcohttp_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>
withreturn_none
,
return_unit
orreturn_nil
.
Build fixes
- Fix Lwt Unix build by add a missing build-deps in
_oasis
Add Lwt SimpleHTTPServer, and bugfixes
Thread safety and Async/Lwt SSL
- 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
- Interface change: The
Request
andResponse
module types now explictly
signalEof
andInvalid
(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 abody
argument, sinceCohttp_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 aPipe
or astring
, similarly to Lwt. - Install
cohttp-server
binary even if tests are disabled. - Begin an
examples
directory with some simple uses of the library.