Codebase list lua-http / a50d8ac
Import upstream version 0.4+git20210206.1.54606a9 Debian Janitor 3 years ago
9 changed file(s) with 66 addition(s) and 67 deletion(s). Raw diff Collapse all Expand all
66 - Functionality for both client and server
77 - Cookie Management
88 - Websockets
9 - Compatible with Lua 5.1, 5.2, 5.3 and [LuaJIT](http://luajit.org/)
9 - Compatible with Lua 5.1, 5.2, 5.3, 5.4 and [LuaJIT](http://luajit.org/)
1010
1111
1212 ## Documentation
6060
6161 ### `stream:get_body_until(pattern, plain, include_pattern, timeout)` <!-- --> {#stream:get_body_until}
6262
63 Reads in body data from the stream until the [lua pattern](http://www.lua.org/manual/5.3/manual.html#6.4.1) `pattern` is found and returns the data as a string. `plain` is a boolean that indicates that pattern matching facilities should be turned off so that function does a plain "find substring" operation, with no characters in pattern being considered magic. `include_patterns` specifies if the pattern itself should be included in the returned string. On error, returns `nil`, an error message and an error number.
63 Reads in body data from the stream until the [lua pattern](http://www.lua.org/manual/5.4/manual.html#6.4.1) `pattern` is found and returns the data as a string. `plain` is a boolean that indicates that pattern matching facilities should be turned off so that function does a plain "find substring" operation, with no characters in pattern being considered magic. `include_patterns` specifies if the pattern itself should be included in the returned string. On error, returns `nil`, an error message and an error number.
6464
6565
6666 ### `stream:save_body_to_file(file, timeout)` <!-- --> {#stream:save_body_to_file}
6767
68 Reads the body from the stream and saves it to the [lua file handle](http://www.lua.org/manual/5.3/manual.html#6.8) `file`. On error, returns `nil`, an error message and an error number.
68 Reads the body from the stream and saves it to the [lua file handle](http://www.lua.org/manual/5.4/manual.html#6.8) `file`. On error, returns `nil`, an error message and an error number.
6969
7070
7171 ### `stream:get_body_as_file(timeout)` <!-- --> {#stream:get_body_as_file}
7272
73 Reads the body from the stream into a temporary file and returns a [lua file handle](http://www.lua.org/manual/5.3/manual.html#6.8). On error, returns `nil`, an error message and an error number.
73 Reads the body from the stream into a temporary file and returns a [lua file handle](http://www.lua.org/manual/5.4/manual.html#6.8). On error, returns `nil`, an error message and an error number.
7474
7575
7676 ### `stream:unget(str)` <!-- --> {#stream:unget}
00 # Introduction
11
2 lua-http is an performant, capable HTTP and WebSocket library for Lua 5.1, 5.2, 5.3 and LuaJIT. Some of the features of the library include:
2 lua-http is an performant, capable HTTP and WebSocket library for Lua 5.1, 5.2, 5.3, 5.4 and LuaJIT. Some of the features of the library include:
33
44 - Support for HTTP versions 1, 1.1 and 2 as specified by [RFC 7230](https://tools.ietf.org/html/rfc7230) and [RFC 7540](https://tools.ietf.org/html/rfc7540)
55 - Provides both client and server APIs
5151
5252 A function used by the `store` to get the current time for expiries and such.
5353
54 Defaults to a function based on [`os.time`](https://www.lua.org/manual/5.3/manual.html#pdf-os.time).
54 Defaults to a function based on [`os.time`](https://www.lua.org/manual/5.4/manual.html#pdf-os.time).
5555
5656
5757 ### `store.max_cookie_length` <!-- --> {#http.cookie.store.max_cookie_length}
66
77 ### `proxies:update(getenv)` <!-- --> {#http.proxies:update}
88
9 `getenv` defaults to [`os.getenv`](http://www.lua.org/manual/5.3/manual.html#pdf-os.getenv)
9 `getenv` defaults to [`os.getenv`](http://www.lua.org/manual/5.4/manual.html#pdf-os.getenv)
1010
1111 Reads environmental variables that are used to control if requests go through a proxy.
1212
160160
161161 - If `body` is a string it will be sent as given.
162162 - If `body` is a function, it will be called repeatedly like an iterator. It should return chunks of the request body as a string or `nil` if done.
163 - If `body` is a lua file object, it will be [`:seek`'d](http://www.lua.org/manual/5.3/manual.html#pdf-file:seek) to the start, then sent as a body. Any errors encountered during file operations **will be thrown**.
163 - If `body` is a lua file object, it will be [`:seek`'d](http://www.lua.org/manual/5.4/manual.html#pdf-file:seek) to the start, then sent as a body. Any errors encountered during file operations **will be thrown**.
164164
165165
166166 ### `request:go(timeout)` <!-- --> {#http.request:timeout}
44
55 return {
66 name = "lua-http";
7 version = "0.4";
7 version = "scm";
88 }
+0
-58
http-0.4-0.rockspec less more
0 package = "http"
1 version = "0.4-0"
2
3 description = {
4 summary = "HTTP library for Lua";
5 homepage = "https://github.com/daurnimator/lua-http";
6 license = "MIT";
7 }
8
9 source = {
10 url = "https://github.com/daurnimator/lua-http/archive/v0.4.zip";
11 dir = "lua-http-0.4";
12 }
13
14 dependencies = {
15 "lua >= 5.1";
16 "compat53 >= 0.3"; -- Only if lua < 5.3
17 "bit32"; -- Only if lua == 5.1
18 "cqueues >= 20161214";
19 "luaossl >= 20161208";
20 "basexx >= 0.2.0";
21 "lpeg";
22 "lpeg_patterns >= 0.5";
23 "binaryheap >= 0.3";
24 "fifo";
25 -- "psl"; -- Optional
26 }
27
28 build = {
29 type = "builtin";
30 modules = {
31 ["http.bit"] = "http/bit.lua";
32 ["http.client"] = "http/client.lua";
33 ["http.connection_common"] = "http/connection_common.lua";
34 ["http.cookie"] = "http/cookie.lua";
35 ["http.h1_connection"] = "http/h1_connection.lua";
36 ["http.h1_reason_phrases"] = "http/h1_reason_phrases.lua";
37 ["http.h1_stream"] = "http/h1_stream.lua";
38 ["http.h2_connection"] = "http/h2_connection.lua";
39 ["http.h2_error"] = "http/h2_error.lua";
40 ["http.h2_stream"] = "http/h2_stream.lua";
41 ["http.headers"] = "http/headers.lua";
42 ["http.hpack"] = "http/hpack.lua";
43 ["http.hsts"] = "http/hsts.lua";
44 ["http.proxies"] = "http/proxies.lua";
45 ["http.request"] = "http/request.lua";
46 ["http.server"] = "http/server.lua";
47 ["http.socks"] = "http/socks.lua";
48 ["http.stream_common"] = "http/stream_common.lua";
49 ["http.tls"] = "http/tls.lua";
50 ["http.util"] = "http/util.lua";
51 ["http.version"] = "http/version.lua";
52 ["http.websocket"] = "http/websocket.lua";
53 ["http.zlib"] = "http/zlib.lua";
54 ["http.compat.prosody"] = "http/compat/prosody.lua";
55 ["http.compat.socket"] = "http/compat/socket.lua";
56 };
57 }
0 package = "http"
1 version = "scm-0"
2
3 description = {
4 summary = "HTTP library for Lua";
5 homepage = "https://github.com/daurnimator/lua-http";
6 license = "MIT";
7 }
8
9 source = {
10 url = "git+https://github.com/daurnimator/lua-http.git";
11 }
12
13 dependencies = {
14 "lua >= 5.1";
15 "compat53 >= 0.3"; -- Only if lua < 5.3
16 "bit32"; -- Only if lua == 5.1
17 "cqueues >= 20161214";
18 "luaossl >= 20161208";
19 "basexx >= 0.2.0";
20 "lpeg";
21 "lpeg_patterns >= 0.5";
22 "binaryheap >= 0.3";
23 "fifo";
24 -- "psl"; -- Optional
25 }
26
27 build = {
28 type = "builtin";
29 modules = {
30 ["http.bit"] = "http/bit.lua";
31 ["http.client"] = "http/client.lua";
32 ["http.connection_common"] = "http/connection_common.lua";
33 ["http.cookie"] = "http/cookie.lua";
34 ["http.h1_connection"] = "http/h1_connection.lua";
35 ["http.h1_reason_phrases"] = "http/h1_reason_phrases.lua";
36 ["http.h1_stream"] = "http/h1_stream.lua";
37 ["http.h2_connection"] = "http/h2_connection.lua";
38 ["http.h2_error"] = "http/h2_error.lua";
39 ["http.h2_stream"] = "http/h2_stream.lua";
40 ["http.headers"] = "http/headers.lua";
41 ["http.hpack"] = "http/hpack.lua";
42 ["http.hsts"] = "http/hsts.lua";
43 ["http.proxies"] = "http/proxies.lua";
44 ["http.request"] = "http/request.lua";
45 ["http.server"] = "http/server.lua";
46 ["http.socks"] = "http/socks.lua";
47 ["http.stream_common"] = "http/stream_common.lua";
48 ["http.tls"] = "http/tls.lua";
49 ["http.util"] = "http/util.lua";
50 ["http.version"] = "http/version.lua";
51 ["http.websocket"] = "http/websocket.lua";
52 ["http.zlib"] = "http/zlib.lua";
53 ["http.compat.prosody"] = "http/compat/prosody.lua";
54 ["http.compat.socket"] = "http/compat/socket.lua";
55 };
56 }