Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move client field from dream-pure to server
- Loading branch information
Showing
9 changed files
with
51 additions
and
28 deletions.
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
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
(* This file is part of Dream, released under the MIT license. See LICENSE.md | ||
for details, or visit https://github.com/aantron/dream. | ||
Copyright 2021 Anton Bachin *) | ||
|
||
|
||
|
||
module Dream = Dream_pure | ||
|
||
|
||
|
||
let client_variable = | ||
Dream.new_local | ||
~name:"dream.client" | ||
~show_value:(fun client -> client) | ||
() | ||
|
||
(* TODO What should be reported when the client address is missing? This is a | ||
sign of local testing. *) | ||
let client request = | ||
match Dream.local client_variable request with | ||
| None -> "127.0.0.1:0" | ||
| Some client -> client | ||
|
||
let with_client client request = | ||
Dream.with_local client_variable client request | ||
|
||
|
||
|
||
(* TODO Eventually remove Dream.request_from_http as all of its functionality | ||
is moved here. *) | ||
let request ~client ~method_ ~target ~https ~version ~headers server_stream = | ||
Dream.request_from_http | ||
~method_ ~target ~https ~version ~headers server_stream | ||
|> with_client client |
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