diff options
Diffstat (limited to 'doc/http.html')
| -rw-r--r-- | doc/http.html | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/http.html b/doc/http.html index 096ab2b..9d80c23 100644 --- a/doc/http.html +++ b/doc/http.html | |||
| @@ -209,11 +209,16 @@ Here are a few examples with the simple interface: | |||
| 209 | 209 | ||
| 210 | <pre class=example> | 210 | <pre class=example> |
| 211 | -- load the http module | 211 | -- load the http module |
| 212 | http = require("socket.http") | 212 | local io = require("io") |
| 213 | local http = require("socket.http") | ||
| 214 | local ltn12 = require("ltn12") | ||
| 213 | 215 | ||
| 214 | -- connect to server "www.tecgraf.puc-rio.br" and retrieves this manual | 216 | -- connect to server "www.cs.princeton.edu" and retrieves this manual |
| 215 | -- file from "/luasocket/http.html" | 217 | -- file from "~diego/professional/luasocket/http.html" and print it to stdout |
| 216 | b = http.request("http://www.tecgraf.puc-rio.br/luasocket/http.html") | 218 | http.request{ |
| 219 | url = "http://www.cs.princeton.edu/~diego/professional/luasocket/http.html", | ||
| 220 | sink = ltn12.sink.file(io.stdout) | ||
| 221 | } | ||
| 217 | 222 | ||
| 218 | -- connect to server "www.example.com" and tries to retrieve | 223 | -- connect to server "www.example.com" and tries to retrieve |
| 219 | -- "/private/index.html". Fails because authentication is needed. | 224 | -- "/private/index.html". Fails because authentication is needed. |
