Source file client_handshake.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
module IOVec = Httpun.IOVec
type t =
{ connection : Httpun.Client_connection.t
; body : Httpun.Body.Writer.t }
let create
~nonce
~
~error_handler
~response_handler
target
=
let connection = Httpun.Client_connection.create () in
let body =
Httpun.Client_connection.request
connection
(Handshake.create_request ~nonce ~headers target)
~error_handler
~response_handler
~flush_headers_immediately:true
in
{ connection
; body
}
;;
let next_read_operation t =
Httpun.Client_connection.next_read_operation t.connection
let next_write_operation t =
Httpun.Client_connection.next_write_operation t.connection
let read t =
Httpun.Client_connection.read t.connection
let read_eof t =
Httpun.Client_connection.read_eof t.connection
let yield_reader t =
Httpun.Client_connection.yield_reader t.connection
let report_write_result t =
Httpun.Client_connection.report_write_result t.connection
let yield_writer t =
Httpun.Client_connection.yield_writer t.connection
let report_exn t exn =
Httpun.Client_connection.report_exn t.connection exn
let is_closed t =
Httpun.Client_connection.is_closed t.connection
let close t =
Httpun.Body.Writer.close t.body;
Httpun.Client_connection.shutdown t.connection