aboutsummaryrefslogtreecommitdiffstats
path: root/teal-src/net/http/parser.d.tl
blob: 1cd6ccf400eea3b64b12bcf2e9cb076d9887e00c (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
local record httpstream
	feed : function(httpstream, string)
end

local type sink_cb = function ()

local record httppacket
	enum http_method
		"HEAD"
		"GET"
		"POST"
		"PUT"
		"DELETE"
		"OPTIONS"
		-- etc
	end
	method : http_method
	record url_details
		path : string
		query : string
	end
	url : url_details
	path : string
	enum http_version
		"1.0"
		"1.1"
	end
	httpversion : http_version
	headers : { string : string }
	body : string | boolean
	body_sink : sink_cb
	chunked : boolean
	partial : boolean
end

local enum error_conditions
	"cancelled"
	"connection-closed"
	"certificate-chain-invalid"
	"certificate-verify-failed"
	"connection failed"
	"invalid-url"
	"unable to resolve service"
end

local type success_cb = function (httppacket)
local type error_cb = function (error_conditions)

local enum stream_mode
	"client"
	"server"
end

local record lib
	new : function (success_cb, error_cb, stream_mode) : httpstream
end

return lib