blob: 68e2c283f2f02b80fc81f4001fa3f7bc7012d760 (
plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
use std
use bio
pkg http =
type status = int
type session = struct
f : bio.file#
host : byte[:]
port : uint16
srvname : byte[:]
ua : byte[:]
err : bool
;;
type server = struct
ann : std.announce#
refs : uint32
quit : bool
;;
type url = struct
schema : schema
port : uint16
host : byte[:]
path : byte[:]
params : (byte[:], byte[:])[:]
;;
type err = union
`Ehttp int /* http error */
`Eunsupp /* unsupported feature */
`Econn /* connection lost */
`Ehdr /* invalid header */
`Eproto /* protocol error */
`Eshort /* truncated response */
`Egarbled /* syntax error */
`Eenc /* encoding error */
`Ewat /* unknown error */
;;
type schema = union
`Http
`Https
;;
type method = union
`Get
`Head
`Put
`Post
`Delete
`Trace
`Options
;;
type encoding = union
`Length
`Chunked
`Compress
`Deflate
`Gzip
;;
type req = struct
url : url#
hdrs : (byte[:], byte[:])[:]
err : std.option(err)
method : method
;;
type resp = struct
status : int
hdrs : (byte[:], byte[:])[:]
len : std.size
err : std.option(err)
reason : byte[:]
body : byte[:]
enc : encoding
;;
;;
|