diff options
author | Kim Alvefur <zash@zash.se> | 2022-07-24 21:25:03 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2022-07-24 21:25:03 +0200 |
commit | d459ec2f5dcf600840c44b75ff175c349b105bef (patch) | |
tree | bdd530318f8e56c5a555638e371ebde82f8fb7bc /teal-src/net/http | |
parent | 185b679953985197b6c087487c01e269c749e5c4 (diff) | |
download | prosody-d459ec2f5dcf600840c44b75ff175c349b105bef.tar.gz prosody-d459ec2f5dcf600840c44b75ff175c349b105bef.zip |
net.http: Add teal description files
Diffstat (limited to 'teal-src/net/http')
-rw-r--r-- | teal-src/net/http/codes.d.tl | 2 | ||||
-rw-r--r-- | teal-src/net/http/errors.d.tl | 22 | ||||
-rw-r--r-- | teal-src/net/http/files.d.tl | 14 | ||||
-rw-r--r-- | teal-src/net/http/parser.d.tl | 58 | ||||
-rw-r--r-- | teal-src/net/http/server.d.tl | 6 |
5 files changed, 102 insertions, 0 deletions
diff --git a/teal-src/net/http/codes.d.tl b/teal-src/net/http/codes.d.tl new file mode 100644 index 00000000..65d004fc --- /dev/null +++ b/teal-src/net/http/codes.d.tl @@ -0,0 +1,2 @@ +local type response_codes = { integer : string } +return response_codes diff --git a/teal-src/net/http/errors.d.tl b/teal-src/net/http/errors.d.tl new file mode 100644 index 00000000..a9b6ea6c --- /dev/null +++ b/teal-src/net/http/errors.d.tl @@ -0,0 +1,22 @@ +local record http_errors + enum known_conditions + "cancelled" + "connection-closed" + "certificate-chain-invalid" + "certificate-verify-failed" + "connection failed" + "invalid-url" + "unable to resolve service" + end + type registry_keys = known_conditions | integer + record error + type : string + condition : string + code : integer + text : string + end + registry : { registry_keys : error } + new : function (integer, known_conditions, table) + new : function (integer, string, table) +end +return http_errors diff --git a/teal-src/net/http/files.d.tl b/teal-src/net/http/files.d.tl new file mode 100644 index 00000000..d0ba5c1c --- /dev/null +++ b/teal-src/net/http/files.d.tl @@ -0,0 +1,14 @@ +local record serve_options + path : string + mime_map : { string : string } + cache_size : integer + cache_max_file_size : integer + index_files : { string } + directory_index : boolean +end + +local record http_files + serve : function(serve_options|string) : function +end + +return http_files diff --git a/teal-src/net/http/parser.d.tl b/teal-src/net/http/parser.d.tl new file mode 100644 index 00000000..1cd6ccf4 --- /dev/null +++ b/teal-src/net/http/parser.d.tl @@ -0,0 +1,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 diff --git a/teal-src/net/http/server.d.tl b/teal-src/net/http/server.d.tl new file mode 100644 index 00000000..5a83af7e --- /dev/null +++ b/teal-src/net/http/server.d.tl @@ -0,0 +1,6 @@ + +local record http_server + -- TODO +end + +return http_server |