Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smondet/cohttps-server-example
Short code example of an HTTPS server using Cohttp/Lwt-ssl
https://github.com/smondet/cohttps-server-example
Last synced: 16 days ago
JSON representation
Short code example of an HTTPS server using Cohttp/Lwt-ssl
- Host: GitHub
- URL: https://github.com/smondet/cohttps-server-example
- Owner: smondet
- License: isc
- Created: 2013-12-13T19:46:59.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-13T22:23:33.000Z (about 11 years ago)
- Last Synced: 2023-03-12T03:03:28.536Z (almost 2 years ago)
- Language: OCaml
- Homepage:
- Size: 121 KB
- Stars: 8
- Watchers: 5
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Quick Example Code
==================This is a *minimalistic* piece of code showing the creation of an HTTPS server
using `cohttp.lwt` and `lwt.ssl`.There is not really any error management or parametrization to keep the code
short.It is ISC licensed, copy at will.
Build & Run
-----------Compile like this:
ocamlfind ocamlc -package lwt.ssl,cohttp.lwt -linkpkg cohttps.ml -o dummyserver
Create an OpenSSL self-signed certificate:
openssl genrsa -des3 -out privkey.pem 1024
openssl req -new -x509 -days 1001 -key privkey.pem -out cert.pem
openssl rsa -in privkey.pem -out privkey-unsec.pemTest:
./dummyserver
Both HTTP and HTTPS servers are created; go to or
, it should display some HTML.Other Notes
-----------### Using `TLSv1` instead of `SSLv23`
With `Ssl.TLSv1` and *Wget 1.10.2*, I need `--secure-protocol=TLSv1`:
wget --no-check-certificate --secure-protocol=TLSv1 https://:8081
with Wget 1.14, I don't:
wget --no-check-certificate https://:8081
Firefox works without problem.
Ocsigenserver uses `SSLv23` (c.f.
[`ocsigen_http_client.ml:88`](https://github.com/ocsigen/ocsigenserver/blob/master/src/server/ocsigen_http_client.ml#L88)).