package cohttp
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=42b26ee6126ce0c607345e285a926641f5a9aa48b2854319b1d42c3782a704e0
    
    
  md5=756f590576d4a60ce2382ef89274b44b
    
    
  doc/CHANGES.html
v1.0.0 (2017-11-16)
- opam: rename 
mirage-httptocohttp-mirage` (#572) - cohttp-lwt{,-unix}: wrap the libraries in top-level modules (#568)
 - opam: improve dependencies (#574, #566, #575)
 - cohttp: add the convenience function 
Header.is_empty(#576) - fix compatibility with OCaml 4.06 and 
-safe-string(#580, #581) 
v0.99.0 (2017-07-12)
Port build to jbuilder, and break up OPAM packages into multiple independent packages instead of being optional dependencies against the main cohttp package. This makes it significantly easier to depend on precisely the libraries you need, but requires porting applications to use the new ocamlfind and opam scheme.
The new package layout is:
cohttp: the mainCohttpmodulecohttp-lwt: the portable Lwt implementationcohttp-lwt-unix: the Lwt/Unix implementationcohttp-lwt-jsoo: the js-of-ocaml JavaScript implementationcohttp-async: the Jane Street Async implementationmirage-http: the MirageOS compatible implementationcohttp-top: a toplevel printer for the Cohttp types.
In each of these packages, the opam and ocamlfind package names are now the same, so you will need to rename the former subpackages such as cohttp.async to cohttp-async. The implementation is otherwise the same, so no other code changes should be required.
In return for these breaking changes to the packaging, it is now significantly easier to depend on a particular backend, also for us to rev the interfaces towards a stable 1.0 release. Jbuilder also builds the source tree around 4x faster than it did previously.
A number of deprecation warnings have been added to the source tree as well to mark the interfaces that will be removed in 1.0. These are Cohttp_lwt.{Client,Server,Net}, and a Cohttp_lwt.Body alias was added to deprecate the direct use of Cohttp_lwt_body. This will let us unify the namespaces of all the packages to use a single top-level module for each package in the future.
Most of the release and packaging work here was done by @rgrinberg and @avsm.
0.22.0 (2017-03-09)
- Lwt: ensure conn_closed is cosed once client goes away (#528)
 - Use the Logs library for logging. (#532)
 
0.21.1 (2017-02-18)
- Remove -principal from type checking temporarily, to workaround a bug in the OCaml 4.03 type checker that causes compilation hangs (http://caml.inria.fr/mantis/view.php?id=7305).
 - Improve documentation in the 
test_xhr.mljs_of_ocaml test. - XHR: Allow setting withCredentials
 - Async: pass along ?ssl_config when connecting to Uri's (#510)
 - Lwt: Add on ?on_exn to Server.create (#518)
 - Add Header.to_frames
 
0.21.0 (2016-05-22)
- Allow to request paths as strings (#470, #478)
 
0.20.2 (2016-04-04)
- Update META version (#473)
 - uri.services is only required by cohttp.async
 
0.20.1 (2016-04-01)
- Switch cohttp to use ppx (#457)
 - Lwt: Fix leak on HEAD client requests (#467)
 
0.20.0 (2016-03-25)
- Switch to pa_fields_conv and pa_sexp_conv for camlp4 extensions (#465)
 - Compatibility with latest async (#468)
 - Async: Add support for SSL parameters in client (#466)
 - Lwt: ignore Sig.sigpipe under Windows (#456)
 - Lwt: Fix FD leak (#447)
 - Lwt: Log uncaught user exceptions
 - Async: Close non-persistent async connections (#442)
 
0.19.3 (2015-09-28):
- Support Async 113.00 by explicitly using the blocking Core 
printf(#431) - cohttp_curl_async: add 
-data-binaryto send POST data. (#425) 
0.19.2 (2015-08-20):
- Improve Cohttp_async.Client error handling. When a Uri.t fails to resolve it is now included in the error. (#420)
 
0.19.1 (2015-08-08):
- Bring make_body_writer and write_header in Cohttp.S.Http_io. Needed by ocaml-git
 
0.19.0 (2015-08-05): Compatibility breaking interface changes:
- Remove 
read_formfrom theRequest/Response/Headerinterfaces as this should be done inBodyhandling instead (#401). 
New features and bug fixes:
- Remove 
IO.write_lineas it was unused in any interfaces. - Do not use the 
lwtcamlp4 extension. No observable external difference. - Do not return a code stacktrace in the default 500 handler.
 - Add 
Cohttp.Header.compare(#411) - Fix typos in CLI documentation (#413 via @moonlightdrive)
 - Use the Lwt 2.5.0 buffer API.
 Cohttp_lwt.read_responsenow has a non-optionalclosefnparameter (#400).- Add a 
Cohttp_lwt_smodule that contains all the Lwt module types in one convenient place (#397). 
0.18.3 (2015-07-12):
- Allow 
DELETErequests to have request bodies (#383). - Improve the Lwt client 
callvfor HTTP/1.1 pipelined requests (#379 via Török Edwin). 
0.18.2 (2015-06-19):
- Do not add content encoding for 204's (#375)
 
0.18.1 (2015-06-05):
- Remove trailing whitespace from headers (#372)
 - Don't reverse order of list valued headers (#372)
 
0.18.0 (2015-06-02):
- Add Cohttp_async.Client.callv. Allows for making requests while reusing an HTTP connection (#344)
 - Responses of status 1xx/204/304 have no bodies and cohttp should not attempt to read them (#355)
 - Add top level printers. See cohttp.top findlib package (#363)
 - Add 
Header.to_string(#362) - Fix chunk truncation in chunked transfer encoding (#360)
 
Compatibility breaking interface changes:
- Remove 
Request/Responsemodules outside of Cohttp pack (#349) 
0.17.2 (2015-05-24):
- Remove dependency on the Lwt Camlp4 syntax extension (#334).
 - Add 
make githubtarget to push documentation to GitHub Pages (#338 from Jyotsna Prakash). - Add Async integration tests and consolidate Lwt tests using the new framework (#337).
 - Fix allocation of massive buffer when handling fixed size http bodies (#345)
 
0.17.1 (2015-04-24):
- [async] Limit buffer size to a maximum of 32K in the Async backend (#330 from Stanislav Artemkin).
 - Add 
Cohttp.Conf.versionwith the library version number included. - Remove debug output from 
cohttp-curl-async. - Add the beginning of a 
DESIGN.mddocument to explain the library structure. 
0.17.0 (2015-04-17):
Compatibility breaking interface changes:
CONNECTandTRACEmethods added toCode.Exhaustive matches will need updating.
New features and bug fixes:
Linkheader parsing has been added asCohttp.Link,Header.get_linksandHeader.add_linkscohttp_server_*now obeysHEADrequests and responds 405 to unknown methodsCohttp_async.Server.responsetype is now exposed as aresponse * bodypair- Failure to read a body in a pipelined response no longer terminates the stream
 - Fix 
cohttp_curl_lwt -X HEADsending empty chunked body (#313) - Fix a bug which left extra 
\r\nin buffer at end of chunked reads - Fix handling of request URI for query strings and 
CONNECTproxies (#308, #318) - Fix precedence of 
Hostheader when request-URI is absolute URI - Fix request URI path to be non-empty except for * requests (e.g. 
OPTIONS *) 
0.16.1 (2015-04-09): New features and bug fixes:
- Fix handling of request paths starting with multiple slashes (#308)
 
0.16.0 (2015-03-23):
Compatibility breaking interface changes:
- Response.t and Request.t fields are no longer mutable
 - [lwt] Fix types in 
post_formto be astring * string listinstead of aHeader.t(#257) - Simplify the 
Netsignature which needs to be provided for Lwt servers to not be required. Only the Lwt client needs aNetfunctor argument to make outgoing connections. (#274) - The 
RequestandResponserecords are no longer mutable, so use functional updates instead viaFieldslib.Field.fset Request.Fields.<field>. (#296) Request.has_bodydoes not permit a body to be set for methods that RFC7231 forbids from having one (HEAD,GETandDELETE).
New features and bug fixes:
- Fix linking problem caused by sub-libraries using cohttp modules outside the cohttp pack.
 - Added async client for S3. (#304)
 - Fix String_io.read_line to trim '\r' from end of string (#300)
 - Fix 
cohttp-server-lwtto correctly bind to a specific interface (#298). - Add 
Cohttp_async.requestto send raw, unmodified requests. - Supplying a 
content-rangeorcontent-rangeheader in any client request will always override any other encoding preference (#281). - Add a 
cohttp-lwt-proxyto act as an HTTP proxy. (#248) - Extend 
cohttp-server-asyncfile server to work with HTTPS (#277). - Copy basic auth from 
Uri.userinfointo the Authorization header for HTTP requests. (#255) - Install binaries via an OPAM 
.installfile to ensure that they are reliably uninstalled. (#252) - Use the 
magic-mimelibrary to add a MIME type by probing filename during static serving in the Lwt/Async backends. (#260) - Add 
Cohttp.Header.add_opt_unless_existsto set a header only if an override wasn't supplied, and to initialise a fresh Header value if none is present. - Do not override user-supplied headers in 
post_formorredirect. Request.makedoes not inject atransfer-encodingheader if there is no body present in the request (#246).Server.respondno longer overrides user-supplied headers that specify thecontent-lengthortransfer-encodingheaders (#268).cohttp_server_lwtandcohttp_server_asyncnow include sizes in directory listing titles- Add 
Header.add_multito initialise a header structure with multiple fields more efficiently (#272). - Expose 
IO.icandIO.octypes forCohttp_async(#271). - Skip empty body chunks in 
Transfer_io.write(#270). - With the Lwt backend, 
readhangs if trying to fetch more thanSys.max_string_length(which can be triggered on 32-bit platforms). Read only a maximum that fits into a string (#282). cohttp-curl-lwtnow takes http method as parameter (#288)- Fix installation of server binaries in OPAM metadata. (#295)
 
0.15.2 (2015-02-15):
- When transfer encoding is unknown, read until EOF when body size is unknown. (#241)
 - Add some missing documentation to 
Cohttp.S.IOsignature. (#233) - Add 
Cohttp.Header.memto check if a header exists. - Add 
Cohttp.Confmodule to expose the library version number. (#259) - Add 
Cohttp.Header.add_unless_existsto update a key if it doesn't already exist. (#244) - Add 
Cohttp.Header.get_locationto retrieve redirection information. (#254) - [async] Clean up the 
Net.lookupfunction to useOr_error.tinstead of raising. (#247) - [tests] Add more tests for 
content-rangehandling. (#249) 
0.15.1 (2015-01-10):
- Lwt 2.4.7 renamed 
blit_bytes_stringtoblit_to_bytes, so depend on the newer API now. (#230) - Use 
cmdlinerin all of the Lwt client and server binaries. This givescohttp-lwt-servera nice Unix-like command-line interface now that can be viewed with the--helpoption. (#218 via Runhang Li) - Improve 
oasisconstraints and regenerateopamfile (#229 via Christophe Troestler). 
0.15.0 (2014-12-24):
Compatibility breaking interface changes:
- Change 
Cohttp_lwt_body.mapto use a non-labelled type to fit the Lwt style better (#200). - Depend on Base64 version 2, which uses 
B64as the toplevel module name (#220). 
New features and bug fixes:
- Remove use of deprecated 
Lwt_unix.runand replace it withLwt_main.run. Should be no observable external change (#217). - Improve ocamldoc of 
Cohttp.Ssignature (#221). 
0.14.0 (2014-12-18):
Compatibility breaking interface changes:
- Simplify the Lwt server signature, so that manual construction of a 
callbackis no longer required (#210). Code that previous looked like: 
   let conn_closed (_,conn_id) () = <...>
   let config = { Server.callback; conn_closed } inshould now be:
   let conn_closed (_,conn_id) = <...>
   let config = Server.make ~callback ~conn_closed () in- Remove the 
Cohttp.Base64module in favour of the externalbase64library (which is now a new dependency). 
New features and bug fixes:
- Lwt 
respond_errornow defaults to an internal server error if no status code is specified (#212). - Modernise the 
opamfile using the OPAM 1.2 workflow (#211). - Flush the response body to the network by default, rather than buffering by default. The 
?flushoptional parameter can still be explicitly set to false if flushing is not desired (#205). 
0.13.0 (2014-12-05):
Compatibility breaking interface changes:
- Add sexp converters for Conduit contexts and 
Lwtclient and server modules and module types. 
New features and bug fixes:
- Can use the Conduit 0.7+ 
CONDUIT_TLS=nativeenvironment 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_debugwhich lets libraries control the debugging output from Cohttp. Previously the only way to do this was to set theCOHTTP_DEBUGenvironment variable at the program start. - Add 
cohttp-curl-lwtas a lightweight URI fetcher from the command-line. It uses thecmdlineras a new dependency. - Remove build dependency check on 
lwt.sslforcohttp.lwt. This has been moved to conduit, so onlylwt.unixis needed here now. 
0.12.0 (2014-11-07):
Compatibility breaking interface changes:
- Rename 
Cohttp.Auth.ttoCohttp.Auth.credentialandCohttp.Auth.reqtoCohttp.Auth.challenge. Also expose anOthervariant to make it more extensible for unknown authentication types. TheCohttp.Authfunctions using these types have also been renamed accordingly. - Rename 
Cohttp.Transfer.encoding_to_stringtostring_of_encodingfor consistency with the rest of Cohttp's APIs. - The 
has_bodyfunction 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_fileinCohttp_asyncandCohttp_lwtnow always percent-decode paths (#157) - Remove the 
Cohttp_lwt.Server.servertype synonym tot. - When reading data from a HTTP body stream using the 
Fixedencoding, we need to maintain state (bytes remaining) so we know when to finish. TheCohttp.RequestandCohttp.Responseinterfaces now expose areaderandwritertypes to track this safely. - Add 
is_emptyfunction to theCohttp.S.Bodymodule type. - Add 
Stringsrepresentation toCohttp.Bodyto efficiently hold a list of body chunks. - Move flushing logic for HTTP bodies into the portable 
RequestandResponsemodules 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_xhrJavaScript backend that enables Cohttp logic to be mapped toXMLHTTPRequestin browsers viajs_of_ocaml(via Andy Ray). - Add a 
Cohttp.String_ioandString_io_lwtmodule that uses OCamlstringorBuffer.tto read and write HTTP requests and responses instead of network connections. cohttp_server_lwtandcohttp_server_asyncnow return better errors (#158)cohttp_server_lwtandcohttp_server_asyncnow serve indexes directly (#162)- [lwt] Add 
stopthread to terminate a running server if it finishes (#147). - Add 
Cohttp.Connection.compareto make ordering of connections possible. - Add 
Body.mapandBody.as_pipeto 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_lwtandcohttp_server_asyncdirectory listings (#158) - Fix 
Cohttp_async.resolve_local_filedirectory 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_unitorreturn_nil. 
0.11.2 (2014-04-21)
- Fix build by add a missing build-deps in _oasis.
 
0.11.1 (2014-04-17):
- 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.tnow exposes sexp accessor functions (#117).
0.11.0 (2014-04-01):
- Remove dependency on 
ocaml-rein 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.
 
0.10.0 (2014-03-02):
- Interface change: The 
RequestandResponsemodule types now explicitly signalEofandInvalid(for errors), to help the backend distinguish them. - Interface change: Unify HTTP body handling across backends into a 
Cohttp.Bodymodule. 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 
Servercallback now always provides abodyargument, sinceCohttp_lwt_bodynow explicitly supports empty bodys. - Add 
Cohttp.Header.is_keep_aliveto test if a connection should be reused. - [lwt] Respect the 
keep-aliveheader in the server request handling. - [async] Add a 
Bodythat takes aPipeor astring, similarly to Lwt. - Install 
cohttp-serverbinary even if tests are disabled. - Begin an 
examplesdirectory with some simple uses of the library. 
0.9.16 (2014-01-30):
- Add some module type equalities in 
Cohttp_lwt_unixso thatCohttp_lwt_unix.Server.Request.IO.iccan be equivalen toLwt_io.input_channel. - Add sexp converters to most Cohttp types (#83).
 - Improve Travis tests to cover more upstream users of Cohttp.
 - Refactor build flags to let the portable Lwt-core be built independently of Lwt.unix.
 
0.9.15 (2014-01-11):
- Remove 
Cohttp_miragelibraries, which have now moved tomirage/mirage-http-*on GitHub. - Add an "HTTP only" 
Cookieattribute (#69). - Fix parsing of cookies with 
=in the values (#71). - Add 
Max-agesupport for cookies (#70). - Make the 
Responserecord fields mutable to match theRequest(#67). - Fix compilation with Async 109.58.00 (#77).
 - Make Header handling case-insensitive (by forcing lowercase) (#75).
 - Remove the 
>>operator as it was unused and had incorrect precedence (#79). 
0.9.14 (2013-12-15):
- Install a 
cohttp-serverbinary that serves local directory contents via a web server (#54). - Add a 
flushfunction to theIOmodule type and implement in Lwt/Async/Mirage. - Add option 
flushsupport in the Async and Lwt responders (#52). - Autogenerate HTTP codes from @citricsquid's JSON representation of the HTTP RFCs.
 - Always set 
TCP_NODELAYfor Lwt/Unix server sockets for low-latency responses (#58). - Added a Server-Side Events test-case from the HTML5 Doctor. See 
lib_test/README.md. - Async.Server response now takes an optional 
bodyrather than a mandatorybody option(#62). - Regenerate build system using OASIS 0.4.0.
 
0.9.13 (2013-12-10):
- The 
cohttp.lwt-coreis now installed as an OS-independent Lwt library. - Add support for Mirage 1.0, via 
cohttp.mirage-unixandcohttp.mirage-xen. - Add a new 
Cohttp.Connectionmodule to manage server's connections identifiers. - Share the same configuration type for the different server implementations.
 - Add 
Accept_typesmodule to theCohttppack. 
0.9.12 (2013-11-28):
- Improve documentation for 
Cohttp.Header. - Expose Fieldslib setters and getters for most of the 
Cohttptypes (#38). Cohttp.Set_cookie.tis no longer an abstract type to make it easier to update (#38).- [Lwt] ignore SIGPIPE unconditionally if using the Lwt/Unix module (#37).
 - Rename 
Cookiecreation parameters for consistency (interface breaking, see #44). - Fix transfer-length detection (regression from 0.9.11 in #42).
 - Add Merin editor file (#41).
 
0.9.11 (2013-10-27):
- Request module: When sending a request, add the port information in the host header field if available.
 - Request module: When parsing a request, add scheme, host and port information in the uri.
 - TCP server: When creating the socket for the server, do not force PF_INET6 but take the sockaddr value.
 - Add HTTP OPTIONS method.
 - Use getaddrinfo instead of gethostbyname for DNS resolution.
 - Async: improve HTTP/1.0 support (#35).
 - Build with debug symbols, binary annotations by default.
 - Add Travis CI test scripts.
 
0.9.10 (2013-06-21):
- Add 
set-cookieheader extraction functions for clients that read cookies. - Explicitly flush the debug output when the 
COHTTP_DEBUGenv variable is set. - [async] Add client head/post/patch/delete methods.
 - [lwt] Client.head no longer returns a response body, just the metadata.
 - [lwt] Do not send chunked encoding headers with GET/DELETE requests that have no body.
 
0.9.9 (2013-06-12):
- Disable the mirage executable test as it was building too aggressively and breaking builds.
 
0.9.8 (2013-05-24):
- Lwt interface change: Rewrite Lwt backends to share code, and remove duplicate function calls from Uri.
 - Depend on 
Uri1.3.8+ as it exposes the parameter query functions now removed fromRequest. - Do not depend on Cstruct in core library, as only Mirage needs it.
 - Remove 
Cohttp_async.bodytype alias and just usestring Pipe.Reader.tfor more explicit types. 
0.9.7 (2013-05-10):
- Attach a GC finaliser to the Lwt client to ensure that even an HTTP body isn't consumed, the socket will eventually be closed (#11).
 - Add an Async.Server interface, and revise the Client interface to be more in line with Core standards.
 - Add 422 Unprocessable Entity code.
 - Refactor modules better across Lwt/Async, but incompatible with earlier releases for Async (Lwt is unchanged at present).
 - Add user agent string and User-Agent header helper function
 - The git history of this release is full of adventures in parameterised monads and refactoring, but this isn't in the actual release. Yet.
 
0.9.6 (2013-03-18):
- Depend on Async (>= 109.12.00), which has an incompatible API with earlier versions.
 - Rearrange core library files for 
obuildsupport. 
0.9.5 (2012-12-29):
- Fix cookie parsing to retrieve the correct header.
 - Update to 
mirage-net0.5.0 API (based on cstruct 0.6.0). 
0.9.4 (2012-12-19):
- Add Lwt 
respond_redirectandrespond_need_authhelpers. - Add enough Basic authorization support to serve a password-protected website.
 - Fix Lwt file serving to not throw exception on trying to serve a directory.
 - Port Async interface to 108.07.00 or higher (incompatible with earlier versions).
 
0.9.3 (2012-10-27):
- Add basic cookie support back to the portable library.
 Cohttp_lwt.Client.post_formnow uses non-chunked encoding for the POST instead of chunked.- Various improvements and tests for the pipelined Lwt Client.callv
 - If an Lwt callback does not consume a body, ensure it has been drained by the API to prevent future pipelines from stalls.
 - Fix handling of Lwt server non-empty POST bodies.
 - Map the 
putfunctions to HTTP PUT instead of POST. 
0.9.2 (2012-09-20):
- Add Request.get_param to extract a singleton key from queries.
 - Fix chunked encoding handling when short reads occur.
 - Install HTML documentation for all enabled drivers.
 - Use ocaml-uri-1.3.2 interface for query parsing.
 - Lwt: Add Server.respond_file and resolve_file for the Unix library to make it easier to serve static files.
 - Lwt: Server.respond_not_found takes an optional Uri.t now.
 
0.9.1 (2012-09-11):
- Functorise for Async, Lwt_unix and Mirage.
 - Use URI and Re libraries to not need Str any more.
 - More robust parsing for various HTTP headers.
 
0.9.0 (2012-08-01):
- Initial public release.