diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-03-20 00:24:44 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-03-20 00:24:44 +0000 |
commit | 53857360bb1ca9cd2080b69d930763ae59db9b06 (patch) | |
tree | 6c1bc6d6462695cf9048801b2244f7fd0cd21ad5 /src/http.lua | |
parent | 7da19138e37c4e0123860f1fecbceb80c3d2627d (diff) | |
download | luasocket-53857360bb1ca9cd2080b69d930763ae59db9b06.tar.gz luasocket-53857360bb1ca9cd2080b69d930763ae59db9b06.tar.bz2 luasocket-53857360bb1ca9cd2080b69d930763ae59db9b06.zip |
Finish port to Lua 5. Everything is working fine.
Still doesn't work in Windows.
Diffstat (limited to 'src/http.lua')
-rw-r--r-- | src/http.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/http.lua b/src/http.lua index 9543d59..3275e3b 100644 --- a/src/http.lua +++ b/src/http.lua | |||
@@ -8,7 +8,7 @@ | |||
8 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
9 | 9 | ||
10 | local Public, Private = {}, {} | 10 | local Public, Private = {}, {} |
11 | http = Public | 11 | socket.http = Public |
12 | 12 | ||
13 | ----------------------------------------------------------------------------- | 13 | ----------------------------------------------------------------------------- |
14 | -- Program constants | 14 | -- Program constants |
@@ -427,7 +427,7 @@ end | |||
427 | ----------------------------------------------------------------------------- | 427 | ----------------------------------------------------------------------------- |
428 | function Private.authorize(request, parsed, response) | 428 | function Private.authorize(request, parsed, response) |
429 | request.headers["authorization"] = "Basic " .. | 429 | request.headers["authorization"] = "Basic " .. |
430 | Code.base64(parsed.user .. ":" .. parsed.password) | 430 | socket.code.base64(parsed.user .. ":" .. parsed.password) |
431 | local authorize = { | 431 | local authorize = { |
432 | redirects = request.redirects, | 432 | redirects = request.redirects, |
433 | method = request.method, | 433 | method = request.method, |
@@ -471,7 +471,7 @@ function Private.redirect(request, response) | |||
471 | method = request.method, | 471 | method = request.method, |
472 | -- the RFC says the redirect URL has to be absolute, but some | 472 | -- the RFC says the redirect URL has to be absolute, but some |
473 | -- servers do not respect that | 473 | -- servers do not respect that |
474 | url = URL.absolute_url(request.url, response.headers["location"]), | 474 | url = socket.url.absolute(request.url, response.headers["location"]), |
475 | body_cb = request.body_cb, | 475 | body_cb = request.body_cb, |
476 | headers = request.headers | 476 | headers = request.headers |
477 | } | 477 | } |
@@ -535,7 +535,7 @@ end | |||
535 | -- error: error message, or nil if successfull | 535 | -- error: error message, or nil if successfull |
536 | ----------------------------------------------------------------------------- | 536 | ----------------------------------------------------------------------------- |
537 | function Public.request_cb(request, response) | 537 | function Public.request_cb(request, response) |
538 | local parsed = URL.parse_url(request.url, { | 538 | local parsed = socket.url.parse(request.url, { |
539 | host = "", | 539 | host = "", |
540 | port = Public.PORT, | 540 | port = Public.PORT, |
541 | path ="/", | 541 | path ="/", |
@@ -622,7 +622,7 @@ function Public.request(request) | |||
622 | return request.body, string.len(request.body) | 622 | return request.body, string.len(request.body) |
623 | end | 623 | end |
624 | end | 624 | end |
625 | local cat = Concat.create() | 625 | local cat = socket.concat.create() |
626 | response.body_cb = function(chunk, err) | 626 | response.body_cb = function(chunk, err) |
627 | if chunk then cat:addstring(chunk) end | 627 | if chunk then cat:addstring(chunk) end |
628 | return 1 | 628 | return 1 |