Mercurial > prosody-hg
comparison net/http/parser.lua @ 5323:4c30f638ff55
net.http.parser: Ensure full URL in status line contains a path.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Fri, 08 Feb 2013 00:27:59 +0500 |
| parents | 8d525f58f916 |
| children | 274c10668fe8 |
comparison
equal
deleted
inserted
replaced
| 5322:8d525f58f916 | 5323:4c30f638ff55 |
|---|---|
| 97 local _path, _query = path:match("([^?]*).?(.*)"); | 97 local _path, _query = path:match("([^?]*).?(.*)"); |
| 98 if _query == "" then _query = nil; end | 98 if _query == "" then _query = nil; end |
| 99 parsed_url = { path = _path, query = _query }; | 99 parsed_url = { path = _path, query = _query }; |
| 100 else | 100 else |
| 101 parsed_url = url_parse(path); | 101 parsed_url = url_parse(path); |
| 102 if not parsed_url then error = true; return error_cb("invalid-url"); end | 102 if not(parsed_url and parsed_url.path) then error = true; return error_cb("invalid-url"); end |
| 103 end | 103 end |
| 104 path = preprocess_path(parsed_url.path); | 104 path = preprocess_path(parsed_url.path); |
| 105 headers.host = parsed_url.host or headers.host; | 105 headers.host = parsed_url.host or headers.host; |
| 106 | 106 |
| 107 len = len or 0; | 107 len = len or 0; |
