-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eio(client): Client.call expects conn, host and resource_path as para…
…mters
- Loading branch information
Showing
5 changed files
with
67 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
open Eio | ||
open Cohttp_eio | ||
|
||
let conn env sw resource_path = | ||
let () = | ||
Eio_main.run @@ fun env -> | ||
Switch.run @@ fun sw -> | ||
let hostname, port = ("www.example.org", 80) in | ||
let he = Unix.gethostbyname hostname in | ||
let addr = `Tcp (Eio_unix.Ipaddr.of_unix he.h_addr_list.(0), port) in | ||
let flow = Net.connect ~sw env#net addr in | ||
let conn = Net.connect ~sw env#net addr in | ||
let host = (hostname, Some port) in | ||
(resource_path, host, flow) | ||
|
||
let () = | ||
Eio_main.run @@ fun env -> | ||
Switch.run @@ fun sw -> | ||
let res = Client.get (conn env sw) "/" in | ||
let res = Client.get ~conn host "/" in | ||
print_string @@ Client.read_fixed res |
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