diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-20 22:19:54 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-06-20 22:19:54 +0000 |
commit | f7579db9e830ef41f422a280d26c9077f48728e5 (patch) | |
tree | d96affac7f5e8203d2e9c4a053213a992cd76650 /doc/http.html | |
parent | 5dc5c3ebe8f111bba01762ca0f5edba912c4f0b9 (diff) | |
download | luasocket-f7579db9e830ef41f422a280d26c9077f48728e5.tar.gz luasocket-f7579db9e830ef41f422a280d26c9077f48728e5.tar.bz2 luasocket-f7579db9e830ef41f422a280d26c9077f48728e5.zip |
Fixing bugs...
Diffstat (limited to 'doc/http.html')
-rw-r--r-- | doc/http.html | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/http.html b/doc/http.html index a98915c..4780436 100644 --- a/doc/http.html +++ b/doc/http.html | |||
@@ -16,7 +16,7 @@ | |||
16 | <center> | 16 | <center> |
17 | <table summary="LuaSocket logo"> | 17 | <table summary="LuaSocket logo"> |
18 | <tr><td align=center><a href="http://www.lua.org"> | 18 | <tr><td align=center><a href="http://www.lua.org"> |
19 | <img border=0 alt="LuaSocket" src="luasocket.png"> | 19 | <img width=128 border=0 alt="LuaSocket" src="luasocket.png"> |
20 | </a></td></tr> | 20 | </a></td></tr> |
21 | <tr><td align=center valign=top>Network support for the Lua language | 21 | <tr><td align=center valign=top>Network support for the Lua language |
22 | </td></tr> | 22 | </td></tr> |
@@ -209,9 +209,9 @@ http = require("http") | |||
209 | -- file from "/luasocket/http.html" | 209 | -- file from "/luasocket/http.html" |
210 | b = http.request("http://www.tecgraf.puc-rio.br/luasocket/http.html") | 210 | b = http.request("http://www.tecgraf.puc-rio.br/luasocket/http.html") |
211 | 211 | ||
212 | -- connect to server "www.tecgraf.puc-rio.br" and tries to retrieve | 212 | -- connect to server "www.example.com" and tries to retrieve |
213 | -- "~diego/auth/index.html". Fails because authentication is needed. | 213 | -- "/private/index.html". Fails because authentication is needed. |
214 | b, c, h = http.request("http://www.tecgraf.puc-rio.br/~diego/auth/index.html") | 214 | b, c, h = http.request("http://www.example.com/private/index.html") |
215 | -- b returns some useless page telling about the denied access, | 215 | -- b returns some useless page telling about the denied access, |
216 | -- h returns authentication information | 216 | -- h returns authentication information |
217 | -- and c returns with value 401 (Authentication Required) | 217 | -- and c returns with value 401 (Authentication Required) |
@@ -276,16 +276,16 @@ authentication is required. | |||
276 | http = require("http") | 276 | http = require("http") |
277 | mime = require("mime") | 277 | mime = require("mime") |
278 | 278 | ||
279 | -- Connect to server "www.tecgraf.puc-rio.br" and tries to retrieve | 279 | -- Connect to server "www.example.com" and tries to retrieve |
280 | -- "~diego/auth/index.html", using the provided name and password to | 280 | -- "/private/index.html", using the provided name and password to |
281 | -- authenticate the request | 281 | -- authenticate the request |
282 | b, c, h = http.request("http://diego:password@www.tecgraf.puc-rio.br/~diego/auth/index.html") | 282 | b, c, h = http.request("http://fulano:silva@www.example.com/private/index.html") |
283 | 283 | ||
284 | -- Alternatively, one could fill the appropriate header and authenticate | 284 | -- Alternatively, one could fill the appropriate header and authenticate |
285 | -- the request directly. | 285 | -- the request directly. |
286 | r, c = http.request { | 286 | r, c = http.request { |
287 | url = "http://www.tecgraf.puc-rio.br/~diego/auth/index.html", | 287 | url = "http://www.example.com/private/index.html", |
288 | headers = { authentication = "Basic " .. (mime.b64("diego:password")) } | 288 | headers = { authentication = "Basic " .. (mime.b64("fulano:silva")) } |
289 | } | 289 | } |
290 | </pre> | 290 | </pre> |
291 | 291 | ||