diff options
Diffstat (limited to 'src/http.lua')
| -rw-r--r-- | src/http.lua | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/http.lua b/src/http.lua index 129b562..8f3fdb9 100644 --- a/src/http.lua +++ b/src/http.lua | |||
| @@ -2,7 +2,6 @@ | |||
| 2 | -- HTTP/1.1 client support for the Lua language. | 2 | -- HTTP/1.1 client support for the Lua language. |
| 3 | -- LuaSocket toolkit. | 3 | -- LuaSocket toolkit. |
| 4 | -- Author: Diego Nehab | 4 | -- Author: Diego Nehab |
| 5 | -- Conforming to RFC 2616 | ||
| 6 | -- RCS ID: $Id$ | 5 | -- RCS ID: $Id$ |
| 7 | ----------------------------------------------------------------------------- | 6 | ----------------------------------------------------------------------------- |
| 8 | 7 | ||
| @@ -23,7 +22,7 @@ _LOADED["http"] = getfenv(1) | |||
| 23 | -- Program constants | 22 | -- Program constants |
| 24 | ----------------------------------------------------------------------------- | 23 | ----------------------------------------------------------------------------- |
| 25 | -- connection timeout in seconds | 24 | -- connection timeout in seconds |
| 26 | TIMEOUT = 4 | 25 | TIMEOUT = 60 |
| 27 | -- default port for document retrieval | 26 | -- default port for document retrieval |
| 28 | PORT = 80 | 27 | PORT = 80 |
| 29 | -- user agent field sent in request | 28 | -- user agent field sent in request |
| @@ -146,7 +145,7 @@ end | |||
| 146 | 145 | ||
| 147 | local function adjustrequest(reqt) | 146 | local function adjustrequest(reqt) |
| 148 | -- parse url with default fields | 147 | -- parse url with default fields |
| 149 | local parsed = url.parse(reqt.url, { | 148 | local parsed = url.parse(reqt.url or "", { |
| 150 | host = "", | 149 | host = "", |
| 151 | port = PORT, | 150 | port = PORT, |
| 152 | path ="/", | 151 | path ="/", |
| @@ -258,5 +257,3 @@ post = socket.protect(function(u, body) | |||
| 258 | return (table.getn(t) > 0 or nil) and table.concat(t), | 257 | return (table.getn(t) > 0 or nil) and table.concat(t), |
| 259 | respt.headers, respt.code | 258 | respt.headers, respt.code |
| 260 | end) | 259 | end) |
| 261 | |||
| 262 | return http | ||
