Mercurial > prosody-hg
comparison net/http.lua @ 2777:a0ea72846b46
net.http: Don't expect the body on redirects
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 10 Dec 2009 22:13:04 +0000 |
| parents | 569d58d21612 |
| children | 8e2dba8904a7 |
comparison
equal
deleted
inserted
replaced
| 2776:bdca5025fb46 | 2777:a0ea72846b46 |
|---|---|
| 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) |
