File: http.compat.socket.md

package info (click to toggle)
lua-http 0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,100 kB
  • sloc: makefile: 60; sh: 16
file content (19 lines) | stat: -rw-r--r-- 566 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
## http.compat.socket

Provides compatibility with [luasocket's http.request module](http://w3.impa.br/~diego/software/luasocket/http.html).

Differences:

  - Will automatically be non-blocking when run inside a cqueues managed coroutine
  - lua-http features (such as HTTP2) will be used where possible


### Example {#http.compat.socket-example}

Using the 'simple' interface as part of a normal script:

```lua
local socket_http = require "http.compat.socket"
local body, code = assert(socket_http.request("http://lua.org"))
print(code, #body) --> 200, 2514
```