Comparison

teal-src/net/http/parser.d.tl @ 12609:a8eb838fc6cf

net.http: Add teal description files
author Kim Alvefur <zash@zash.se>
date Sun, 24 Jul 2022 21:25:03 +0200
comparison
equal deleted inserted replaced
12608:946a11f794e2 12609:a8eb838fc6cf
1 local record httpstream
2 feed : function(httpstream, string)
3 end
4
5 local type sink_cb = function ()
6
7 local record httppacket
8 enum http_method
9 "HEAD"
10 "GET"
11 "POST"
12 "PUT"
13 "DELETE"
14 "OPTIONS"
15 -- etc
16 end
17 method : http_method
18 record url_details
19 path : string
20 query : string
21 end
22 url : url_details
23 path : string
24 enum http_version
25 "1.0"
26 "1.1"
27 end
28 httpversion : http_version
29 headers : { string : string }
30 body : string | boolean
31 body_sink : sink_cb
32 chunked : boolean
33 partial : boolean
34 end
35
36 local enum error_conditions
37 "cancelled"
38 "connection-closed"
39 "certificate-chain-invalid"
40 "certificate-verify-failed"
41 "connection failed"
42 "invalid-url"
43 "unable to resolve service"
44 end
45
46 local type success_cb = function (httppacket)
47 local type error_cb = function (error_conditions)
48
49 local enum stream_mode
50 "client"
51 "server"
52 end
53
54 local record lib
55 new : function (success_cb, error_cb, stream_mode) : httpstream
56 end
57
58 return lib