# \#cohttp

**URL:** https://discuss.ocaml.org/tag/cohttp/12.md

[Latest](https://discuss.ocaml.org/latest.md) · [Categories](https://discuss.ocaml.org/categories.md) · [Tags](https://discuss.ocaml.org/tags.md)

---

## [Cohttp 6.3.0 released (OSEC-2026-16)](https://discuss.ocaml.org/t/cohttp-6-3-0-released-osec-2026-16/18467)

<div class="topic-metadata">

**Author:** [@avsm](https://discuss.ocaml.org/u/avsm)\
**Replies:** 0\
**Last updated:** [August 22, 2026, 11:53am UTC](https://discuss.ocaml.org/t/cohttp-6-3-0-released-osec-2026-16/18467 "2026-08-22T11:53:30Z")

</div>

Dear all, cohttp 6.3.0 is released onto opam-repository with some important security fixes (OSEC-2026-16): cohttp: Cohttp.Path.resolve\_local\_file no longer escapes the docroot when given percent-encoded traversal se…

---

## [Testing cohttp\_eio request handlers](https://discuss.ocaml.org/t/testing-cohttp-eio-request-handlers/18185)

<div class="topic-metadata">

**Author:** [@mneumann](https://discuss.ocaml.org/u/mneumann)\
**Replies:** 2\
**Last updated:** [May 28, 2026, 4:10pm UTC](https://discuss.ocaml.org/t/testing-cohttp-eio-request-handlers/18185 "2026-05-28T16:10:03Z")

</div>

Hey, I wrote a webservice using cohttp\_eio and then wanted to test it, ideally without having to start a server listening on a network interface. My rough idea was to craft the inputs for the request handler (HTTP verb…

---

## [How to stream data in cohttp\_eio server](https://discuss.ocaml.org/t/how-to-stream-data-in-cohttp-eio-server/17558)

<div class="topic-metadata">

**Author:** [@eWert-Online](https://discuss.ocaml.org/u/eWert-Online)\
**Replies:** 21\
**Last updated:** [December 7, 2025, 10:21am UTC](https://discuss.ocaml.org/t/how-to-stream-data-in-cohttp-eio-server/17558 "2025-12-07T10:21:36Z")

</div>

Hello :waving\_hand: I am trying to implement Server Sent Events with Cohttp\_eio. The theory is pretty simple: Stream data periodically to the client. But I am not sure, how I can send data to a Eio.Flow.source\_ty (whic…

---

## [How do I concurrently run a cohttp-server and my custom REPL?](https://discuss.ocaml.org/t/how-do-i-concurrently-run-a-cohttp-server-and-my-custom-repl/15157)

<div class="topic-metadata">

**Author:** [@kentookura](https://discuss.ocaml.org/u/kentookura)\
**Replies:** 3\
**Last updated:** [August 21, 2024, 4:52pm UTC](https://discuss.ocaml.org/t/how-do-i-concurrently-run-a-cohttp-server-and-my-custom-repl/15157 "2024-08-21T16:52:40Z")

</div>

Hi all, I am trying to add a cohttp server to my application and am having trouble setting it up. The reproduction below is adapted from the official example. The issue is that the server does not start properly: the br…

---

## [Cohttp\_eio + eio-ssl?](https://discuss.ocaml.org/t/cohttp-eio-eio-ssl/15132)

<div class="topic-metadata">

**Author:** [@dx3mod](https://discuss.ocaml.org/u/dx3mod)\
**Replies:** 2\
**Last updated:** [August 15, 2024, 7:15pm UTC](https://discuss.ocaml.org/t/cohttp-eio-eio-ssl/15132 "2024-08-15T19:15:22Z")

</div>

Hello everyone :wave: Is it possible to use cohttp-eio with eio-ssl? And are there any advantages over using ocaml-tls? Because with cohttp-lwt-unix, https support works out of the box and there is a choice between ocam…

---

## [Auth cohttp request with X509 certificate](https://discuss.ocaml.org/t/auth-cohttp-request-with-x509-certificate/14742)

<div class="topic-metadata">

**Author:** [@zbroyar](https://discuss.ocaml.org/u/zbroyar)\
**Replies:** 2\
**Last updated:** [June 4, 2024, 12:53pm UTC](https://discuss.ocaml.org/t/auth-cohttp-request-with-x509-certificate/14742 "2024-06-04T12:53:21Z")

</div>

Hi here, I’ve spent some time playing with cohttp to make it authenticate a connection with my X509 certificate. Working code is below: (\* ocamlfind ocamlopt -thread -package lwt,tls,x509,cohttp,cohttp-lwt,lwt\_ppx,coht…

---

## [\`No SSL or TLS support compiled into Conduit\` with cohttp 5.3.1, conduit 6.2.1, tls 0.17.4](https://discuss.ocaml.org/t/no-ssl-or-tls-support-compiled-into-conduit-with-cohttp-5-3-1-conduit-6-2-1-tls-0-17-4/14423)

<div class="topic-metadata">

**Author:** [@arvidj](https://discuss.ocaml.org/u/arvidj)\
**Replies:** 4\
**Last updated:** [April 3, 2024, 2:07pm UTC](https://discuss.ocaml.org/t/no-ssl-or-tls-support-compiled-into-conduit-with-cohttp-5-3-1-conduit-6-2-1-tls-0-17-4/14423 "2024-04-03T14:07:22Z")

</div>

I’m having issues connecting to an HTTPS service in my application that is using cohttp and conduit. I get: Fatal error: exception Failure("No SSL or TLS support compiled into Conduit") My opam file declares dependenc…

---

## [Discord.ml: Eio-based Discord library with voice support](https://discuss.ocaml.org/t/discord-ml-eio-based-discord-library-with-voice-support/13370)

<div class="topic-metadata">

**Author:** [@anqou](https://discuss.ocaml.org/u/anqou)\
**Replies:** 9\
**Last updated:** [November 11, 2023, 2:38am UTC](https://discuss.ocaml.org/t/discord-ml-eio-based-discord-library-with-voice-support/13370 "2023-11-11T02:38:49Z")

</div>

Hi. I’m writing a Discord library, Discord.ml, in OCaml for my personal project. As of now, it supports voice functionality as well as text one, and you can write, for example, a music bot with this library. I used Ei…

---

## [Cannot get cohttp\_eio to work](https://discuss.ocaml.org/t/cannot-get-cohttp-eio-to-work/13287)

<div class="topic-metadata">

**Author:** [@RudolfVonKrugstein](https://discuss.ocaml.org/u/RudolfVonKrugstein)\
**Replies:** 2\
**Last updated:** [October 22, 2023, 2:41pm UTC](https://discuss.ocaml.org/t/cannot-get-cohttp-eio-to-work/13287 "2023-10-22T14:41:26Z")

</div>

Hi, on my journey of learning ocaml I am trying to use cohttp-eio. I just copied the example from the repository: open Cohttp\_eio let () = Logs.set\_reporter (Logs\_fmt.reporter ()) and () = (\* The eio backend does n…

---

## [Eliom runtime errors, zero compile-time errors](https://discuss.ocaml.org/t/eliom-runtime-errors-zero-compile-time-errors/10537)

<div class="topic-metadata">

**Author:** [@papatango](https://discuss.ocaml.org/u/papatango)\
**Replies:** 13\
**Last updated:** [October 5, 2022, 10:24am UTC](https://discuss.ocaml.org/t/eliom-runtime-errors-zero-compile-time-errors/10537 "2022-10-05T10:24:16Z")

</div>

I am at my wits end with eliom and ocsigenserver. I have tried three switches from 4.08.1 through 4.10.1, employed the newer versions of eliom-distillery in each case, and still have errors at run time, but zero compile …

---

## [How can I get the HTTP or HTTPS scheme using cohttp?](https://discuss.ocaml.org/t/how-can-i-get-the-http-or-https-scheme-using-cohttp/8804)

<div class="topic-metadata">

**Author:** [@Asya-kawai](https://discuss.ocaml.org/u/Asya-kawai)\
**Replies:** 3\
**Last updated:** [September 3, 2022, 3:11am UTC](https://discuss.ocaml.org/t/how-can-i-get-the-http-or-https-scheme-using-cohttp/8804 "2022-09-03T03:11:50Z")

</div>

I am trying out cohttp. I am writing the following code based on the server-side code in the README-basic-server-tutorial, but the scheme is always None. htttp\_server.ml let server = let open Lwt in let callback \_…

---

## [Adding basic authentication to Cohttp\_lwt\_unix example](https://discuss.ocaml.org/t/adding-basic-authentication-to-cohttp-lwt-unix-example/10135)

<div class="topic-metadata">

**Author:** [@Ian\_Norfolk](https://discuss.ocaml.org/u/Ian_Norfolk)\
**Replies:** 5\
**Last updated:** [July 6, 2022, 1:51pm UTC](https://discuss.ocaml.org/t/adding-basic-authentication-to-cohttp-lwt-unix-example/10135 "2022-07-06T13:51:54Z")

</div>

Hi, Im struggling to work out the method to add authentication to a Client.get in the Cohttp\_lwt\_unix package. Got this far, but cant work out what’s wrong: open Lwt open Cohttp open Cohttp\_lwt\_unix let body = let h…

---

## [Lwt alternative to async.pipe](https://discuss.ocaml.org/t/lwt-alternative-to-async-pipe/7265)

<div class="topic-metadata">

**Author:** [@mattpallissard](https://discuss.ocaml.org/u/mattpallissard)\
**Replies:** 3\
**Last updated:** [February 13, 2021, 1:53am UTC](https://discuss.ocaml.org/t/lwt-alternative-to-async-pipe/7265 "2021-02-13T01:53:12Z")

</div>

Hey all, I’m new to the ocaml ecosystem and I’m trying to get my bearings on libraries and conventions around common operations. I have some code that downloads a lot of large files. Currently I’m doing this with Cohtt…

---

## [Trying to install cohttp-lwt-unix-ssl with opam](https://discuss.ocaml.org/t/trying-to-install-cohttp-lwt-unix-ssl-with-opam/6924)

<div class="topic-metadata">

**Author:** [@Pierre](https://discuss.ocaml.org/u/Pierre)\
**Replies:** 1\
**Last updated:** [December 6, 2020, 7:52pm UTC](https://discuss.ocaml.org/t/trying-to-install-cohttp-lwt-unix-ssl-with-opam/6924 "2020-12-06T19:52:49Z")

</div>

Hello, I am trying to install the opam package cohttp-lwt-unix-ssl, but I run into the following error: The following dependencies couldn't be met: - cohttp-lwt-unix-ssl → cohttp-lwt \>= 3.0.0 → cohttp \>= 3.0.0 u…

---

## [Presence of \\u0000 in the string](https://discuss.ocaml.org/t/presence-of-u0000-in-the-string/6237)

<div class="topic-metadata">

**Author:** [@sahana123](https://discuss.ocaml.org/u/sahana123)\
**Replies:** 8\
**Last updated:** [August 17, 2020, 1:01pm UTC](https://discuss.ocaml.org/t/presence-of-u0000-in-the-string/6237 "2020-08-17T13:01:11Z")

</div>

I have a string \[“abc”,“xyz”,“pqr”\] which has to be sent to the server. I am using the cohttp library . I am using Yojson to form a json object. The variable rootList is the data \[“abc”,“xyz”,“pqr”\] let paramJs…

---

## [Cohttp client tls exception](https://discuss.ocaml.org/t/cohttp-client-tls-exception/5270)

<div class="topic-metadata">

**Author:** [@erhan](https://discuss.ocaml.org/u/erhan)\
**Replies:** 3\
**Last updated:** [March 7, 2020, 4:31pm UTC](https://discuss.ocaml.org/t/cohttp-client-tls-exception/5270 "2020-03-07T16:31:56Z")

</div>

Hello. I was trying out Cohttp client with utop as shown below: Cohttp\_lwt\_unix.Client.get (Uri.of\_string "https://www.ocaml.org/");; And I received an error below: Exception: Tls\_lwt.Tls\_alert Tls.Packet.HANDSHAKE\_F…

---

## [How to create a cohttp server that accepts both HTTP and HTTPS requests?](https://discuss.ocaml.org/t/how-to-create-a-cohttp-server-that-accepts-both-http-and-https-requests/4315)

<div class="topic-metadata">

**Author:** [@pveber](https://discuss.ocaml.org/u/pveber)\
**Replies:** 2\
**Last updated:** [September 6, 2019, 8:43am UTC](https://discuss.ocaml.org/t/how-to-create-a-cohttp-server-that-accepts-both-http-and-https-requests/4315 "2019-09-06T08:43:25Z")

</div>

Would someone have an example of a cohttp server accepting both HTTP and HTTPS requests? Having a look at the API, it seems to me that I have to call Cohttp\_lwt\_unix.Server.create twice, with a different argument for ~mo…

---

## [Cohttp error cases](https://discuss.ocaml.org/t/cohttp-error-cases/3388)

<div class="topic-metadata">

**Author:** [@rymdhund](https://discuss.ocaml.org/u/rymdhund)\
**Replies:** 0\
**Last updated:** [February 21, 2019, 8:43am UTC](https://discuss.ocaml.org/t/cohttp-error-cases/3388 "2019-02-21T08:43:22Z")

</div>

Hello! I’m trying out cohttp as a http client and I’m mostly using Cohttp\_lwt\_unix.Client.get. When my requests fail with rejected Lwt promises I get different errors depending on what went wrong, like dns errors, connec…

---

## [Handling client connection lifecycles in cohttp servers](https://discuss.ocaml.org/t/handling-client-connection-lifecycles-in-cohttp-servers/1424)

<div class="topic-metadata">

**Author:** [@timr](https://discuss.ocaml.org/u/timr)\
**Replies:** 1\
**Last updated:** [January 14, 2018, 7:23pm UTC](https://discuss.ocaml.org/t/handling-client-connection-lifecycles-in-cohttp-servers/1424 "2018-01-14T19:23:39Z")

</div>

Hi, I want to stream events from a cohttp server to connected clients and robustly manage the lifecycle of a client. I’ve more or less done this but I’m still “leaking” exceptions when a client disconnects. In short, …

---

## [About Web Development](https://discuss.ocaml.org/t/about-web-development/154)

<div class="topic-metadata">

**Author:** [@glennsl](https://discuss.ocaml.org/u/glennsl)\
**Replies:** 7\
**Last updated:** [January 2, 2018, 8:04pm UTC](https://discuss.ocaml.org/t/about-web-development/154 "2018-01-02T20:04:16Z")

</div>

This category is for discussing web development in OCaml, with some of the major pieces of this puzzle being: Frameworks opium is a Sinatra-like framework built on cohttp. Eliom is a more full-featured framework for se…

---

## [Handling multiple file-uploads/multipart form data in Cohttp server?](https://discuss.ocaml.org/t/handling-multiple-file-uploads-multipart-form-data-in-cohttp-server/742)

<div class="topic-metadata">

**Author:** [@sgrove](https://discuss.ocaml.org/u/sgrove)\
**Replies:** 3\
**Last updated:** [August 22, 2017, 7:11pm UTC](https://discuss.ocaml.org/t/handling-multiple-file-uploads-multipart-form-data-in-cohttp-server/742 "2017-08-22T19:11:34Z")

</div>

What’s the best way to pull out multi-part form data from a Cohttp request, keeping headers for each content block? Are there any helpers implemented right now, or is it up to the user to split the body apart and reconst…

---

## [Timeout Cohttprequests](https://discuss.ocaml.org/t/timeout-cohttprequests/660)

<div class="topic-metadata">

**Author:** [@sgrove](https://discuss.ocaml.org/u/sgrove)\
**Replies:** 2\
**Last updated:** [August 3, 2017, 3:00am UTC](https://discuss.ocaml.org/t/timeout-cohttprequests/660 "2017-08-03T03:00:19Z")

</div>

Not sure if this is better suited for StackOverflow or this site, but thought I’d post here to start with. I see on the server-side of things there’s https://github.com/mirage/ocaml-cohttp/blob/e9c29aec81a1850bc1574684d…

---

## [Bind only to localhost in Cohttp\_lwt\_unix?](https://discuss.ocaml.org/t/bind-only-to-localhost-in-cohttp-lwt-unix/574)

<div class="topic-metadata">

**Author:** [@sgrove](https://discuss.ocaml.org/u/sgrove)\
**Replies:** 2\
**Last updated:** [July 20, 2017, 9:27am UTC](https://discuss.ocaml.org/t/bind-only-to-localhost-in-cohttp-lwt-unix/574 "2017-07-20T09:27:18Z")

</div>

My code seems to bind to 0.0.0.0 - is there a way to specify I only want to bind to localhost/127.0.0.1? C.Server.create mode::(TCP (Port 8082)) (C.Server.make callback::server ()) |\> Lwt\_main.run
