Software /
code /
prosody
Annotate
teal-src/net/http.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 |
child | 12612:588b1d175838 |
rev | line source |
---|---|
12609
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local record Promise |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 -- util.promise |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 local record sslctx -- from LuaSec |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 end |
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 local record lib |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 enum http_method |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 "GET" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 "HEAD" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 "POST" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 "PUT" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 "OPTIONS" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 "DELETE" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 -- etc? |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 record http_client_options |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 sslctx : sslctx |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
24 record http_options |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 id : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 onlystatus : boolean |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 body : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 method : http_method |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 headers : { string : string } |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 insecure : boolean |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 suppress_errors : boolean |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 streaming_handler : function |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 suppress_url : boolean |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 sslctx : sslctx |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 record http_request |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 host : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 port : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 enum scheme |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 "http" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 "https" |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 scheme : scheme |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 url : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 userinfo : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 path : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
48 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
49 method : http_method |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 headers : { string : string } |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
51 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
52 insecure : boolean |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
53 suppress_errors : boolean |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
54 streaming_handler : function |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
55 http : http_client |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
56 time : integer |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
57 id : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
58 callback : http_callback |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
59 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
60 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
61 record http_response |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
62 end |
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 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
|
65 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
66 record http_client |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
67 options : http_client_options |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
68 request : function (http_client, string, http_options, http_callback) |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
69 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
70 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
71 request : function (string, http_options, http_callback) : Promise, string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
72 default : http_client |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
73 new : function (http_client_options) : http_client |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
74 events : table |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
75 -- COMPAT |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
76 urlencode : function (string) : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
77 urldecode : function (string) : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
78 formencode : function ({ string : string }) : string |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
79 formdecode : function (string) : { string : string } |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
80 destroy_request : function (http_request) |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
81 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
82 enum available_features |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
83 "sni" |
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 features : { available_features : boolean } |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
86 end |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
87 |
a8eb838fc6cf
net.http: Add teal description files
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
88 return lib |