Software /
code /
prosody
Comparison
net/http.lua @ 2363:a1e987f499a8
net.http: Don't expect the body on redirects
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 10 Dec 2009 22:13:04 +0000 |
parent | 2130:828e161cdfc7 |
child | 2669:9dbe9acf82e8 |
comparison
equal
deleted
inserted
replaced
2362:7f5dbf982d14 | 2363:a1e987f499a8 |
---|---|
28 function urlencode(s) return s and (s:gsub("%W", function (c) return format("%%%02x", c:byte()); end)); end | 28 function urlencode(s) return s and (s:gsub("%W", function (c) return format("%%%02x", c:byte()); end)); end |
29 function urldecode(s) return s and (s:gsub("%%(%x%x)", function (c) return char(tonumber(c,16)); end)); end | 29 function urldecode(s) return s and (s:gsub("%%(%x%x)", function (c) return char(tonumber(c,16)); end)); end |
30 | 30 |
31 local function expectbody(reqt, code) | 31 local function expectbody(reqt, code) |
32 if reqt.method == "HEAD" then return nil end | 32 if reqt.method == "HEAD" then return nil end |
33 if code == 204 or code == 304 then return nil end | 33 if code == 204 or code == 304 or code == 301 then return nil end |
34 if code >= 100 and code < 200 then return nil end | 34 if code >= 100 and code < 200 then return nil end |
35 return 1 | 35 return 1 |
36 end | 36 end |
37 | 37 |
38 local function request_reader(request, data, startpos) | 38 local function request_reader(request, data, startpos) |