Annotate

teal-src/net/http.d.tl @ 12815:2d134201dc55

net.resolvers.basic: Record hostname coming from secure SRV records Will be useful even later...
author Kim Alvefur <zash@zash.se>
date Thu, 22 Dec 2022 00:11:23 +0100
parent 12612:588b1d175838
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12612
588b1d175838 util.promise: Add Teal interface specification file
Kim Alvefur <zash@zash.se>
parents: 12609
diff changeset
1 local Promise = require "util.promise".Promise;
12609
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 local record sslctx -- from LuaSec
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 local record lib
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 enum http_method
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 "GET"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 "HEAD"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 "POST"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 "PUT"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 "OPTIONS"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 "DELETE"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 -- etc?
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 record http_client_options
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 sslctx : sslctx
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 record http_options
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 id : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 onlystatus : boolean
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 body : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 method : http_method
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 headers : { string : string }
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28 insecure : boolean
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 suppress_errors : boolean
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 streaming_handler : function
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31 suppress_url : boolean
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 sslctx : sslctx
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 record http_request
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 host : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37 port : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38 enum scheme
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
39 "http"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
40 "https"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
41 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
42 scheme : scheme
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
43 url : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
44 userinfo : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
45 path : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
46
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
47 method : http_method
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
48 headers : { string : string }
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
49
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
50 insecure : boolean
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
51 suppress_errors : boolean
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
52 streaming_handler : function
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
53 http : http_client
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
54 time : integer
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
55 id : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
56 callback : http_callback
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
57 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
58
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
59 record http_response
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
60 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
61
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
62 type http_callback = function (string, number, http_response, http_request)
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
63
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
64 record http_client
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
65 options : http_client_options
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
66 request : function (http_client, string, http_options, http_callback)
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
67 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
68
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
69 request : function (string, http_options, http_callback) : Promise, string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
70 default : http_client
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
71 new : function (http_client_options) : http_client
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
72 events : table
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
73 -- COMPAT
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
74 urlencode : function (string) : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
75 urldecode : function (string) : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
76 formencode : function ({ string : string }) : string
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
77 formdecode : function (string) : { string : string }
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
78 destroy_request : function (http_request)
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
79
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
80 enum available_features
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
81 "sni"
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
82 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
83 features : { available_features : boolean }
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
84 end
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
85
a8eb838fc6cf net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
86 return lib