-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port to Eio and Cohttp #327
Draft
aantron
wants to merge
4
commits into
master
Choose a base branch
from
cohttp-eio
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+549
−396
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,11 +15,11 @@ maintainer: "Anton Bachin <[email protected]>" | |
depends: [ | ||
"dream-pure" | ||
"dune" {>= "2.7.0"} # --instrument-with. | ||
"lwt" | ||
"lwt_ppx" {>= "1.2.2"} | ||
"lwt_ssl" | ||
# "lwt" | ||
# "lwt_ppx" {>= "1.2.2"} | ||
# "lwt_ssl" | ||
"ocaml" {>= "4.08.0"} | ||
"ssl" {>= "0.5.8"} # Ssl.get_negotiated_alpn_protocol. | ||
# "ssl" {>= "0.5.8"} # Ssl.get_negotiated_alpn_protocol. | ||
|
||
# Currently vendored. | ||
# "gluten" | ||
|
@@ -32,14 +32,14 @@ depends: [ | |
# "websocketaf" | ||
|
||
# Dependencies of vendored packages. | ||
"angstrom" {>= "0.14.0"} | ||
"base64" {>= "3.0.0"} | ||
"bigstringaf" {>= "0.5.0"} # h2. | ||
"digestif" {>= "0.7.2"} # websocket/af, sha1, default implementation. | ||
"faraday" {>= "0.6.1"} | ||
"faraday-lwt-unix" | ||
"lwt_ssl" {>= "1.2.0"} # Gluten. | ||
"psq" # h2. | ||
# "angstrom" {>= "0.14.0"} | ||
# "base64" {>= "3.0.0"} | ||
# "bigstringaf" {>= "0.5.0"} # h2. | ||
# "digestif" {>= "0.7.2"} # websocket/af, sha1, default implementation. | ||
# "faraday" {>= "0.6.1"} | ||
# "faraday-lwt-unix" | ||
# "lwt_ssl" {>= "1.2.0"} # Gluten. | ||
# "psq" # h2. | ||
] | ||
|
||
build: [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name hello) | ||
(libraries dream)) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
let () = | ||
Dream.run (fun _ -> | ||
Dream.html "Good morning, world!") | ||
Eio_main.run begin fun env -> | ||
Dream.run env (fun _ -> | ||
Dream.html "Good morning, world!") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name middleware) | ||
(libraries dream)) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
let () = | ||
Dream.run | ||
@@ Dream.logger | ||
@@ fun _ -> Dream.html "Good morning, world!" | ||
Eio_main.run begin fun env -> | ||
Dream.run env | ||
@@ Dream.logger | ||
@@ fun _ -> Dream.html "Good morning, world!" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name router) | ||
(libraries dream)) | ||
(libraries dream eio_main)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
let () = | ||
Dream.run | ||
let () = Eio_main.run @@ fun env -> | ||
Dream.run env | ||
@@ Dream.logger | ||
@@ Dream.router [ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name counter) | ||
(libraries dream)) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
(executable | ||
(name echo) | ||
(libraries dream) | ||
(preprocess (pps lwt_ppx))) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(executable | ||
(name template) | ||
(libraries dream)) | ||
(libraries dream eio_main)) | ||
|
||
(rule | ||
(targets template.ml) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name debug) | ||
(libraries dream)) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
(executable | ||
(name error) | ||
(libraries dream)) | ||
(libraries dream eio_main)) | ||
|
||
(rule | ||
(targets error.ml) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name log) | ||
(libraries dream)) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
let () = | ||
Dream.run | ||
let () = Eio_main.run @@ fun env -> | ||
Dream.run env | ||
@@ Dream.logger | ||
@@ Dream.router [ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
(executable | ||
(name session) | ||
(libraries dream) | ||
(preprocess (pps lwt_ppx))) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
let () = | ||
Dream.run | ||
let () = Eio_main.run @@ fun env -> | ||
Dream.run env | ||
@@ Dream.logger | ||
@@ Dream.memory_sessions | ||
@@ fun request -> | ||
|
||
match Dream.session_field request "user" with | ||
| None -> | ||
let%lwt () = Dream.invalidate_session request in | ||
let%lwt () = Dream.set_session_field request "user" "alice" in | ||
Dream.invalidate_session request; | ||
Dream.set_session_field request "user" "alice"; | ||
Dream.html "You weren't logged in; but now you are!" | ||
|
||
| Some username -> | ||
Printf.ksprintf | ||
Dream.html "Welcome back, %s!" (Dream.html_escape username) | ||
Dream.html | ||
(Printf.sprintf "Welcome back, %s!" (Dream.html_escape username)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name cookie) | ||
(libraries dream)) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(executable | ||
(name json) | ||
(libraries dream) | ||
(preprocess (pps lwt_ppx ppx_yojson_conv))) | ||
(libraries dream eio_main) | ||
(preprocess (pps ppx_yojson_conv))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
(executable | ||
(name static) | ||
(libraries dream)) | ||
(libraries dream eio_main)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
let () = | ||
Dream.run | ||
let () = Eio_main.run @@ fun env -> | ||
Dream.run env | ||
@@ Dream.logger | ||
@@ Dream.router [ | ||
Dream.get "/static/**" (Dream.static ".") | ||
Dream.get "/static/**" (Dream.static (Eio.Stdenv.cwd env)) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,4 @@ | |
mirage-crypto | ||
mirage-crypto-rng | ||
) | ||
(preprocess (pps lwt_ppx)) | ||
(instrumentation (backend bisect_ppx))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just remove the OCaml version since Eio will force >5