Software /
code /
prosody
Comparison
net/http/parser.lua @ 5259:c85c348253bd
net.http.parser: Skip url.parse when we don't have a full URL (also fixes traceback on paths starting with '//').
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 21 Dec 2012 13:37:39 +0500 |
parent | 5222:61c47d26481d |
child | 5291:01f7522049fb |
comparison
equal
deleted
inserted
replaced
5257:b125892e187c | 5259:c85c348253bd |
---|---|
89 -- COMPAT the properties below are deprecated | 89 -- COMPAT the properties below are deprecated |
90 responseversion = httpversion; | 90 responseversion = httpversion; |
91 responseheaders = headers; | 91 responseheaders = headers; |
92 }; | 92 }; |
93 else | 93 else |
94 local parsed_url = url_parse(path); | 94 local parsed_url; |
95 if path:byte() == 47 then -- starts with / | |
96 local _path, _query = path:match("([^?]*).?(.*)"); | |
97 if _query == "" then _query = nil; end | |
98 parsed_url = { path = _path, query = _query }; | |
99 else | |
100 parsed_url = url_parse(path); | |
101 end | |
95 path = preprocess_path(parsed_url.path); | 102 path = preprocess_path(parsed_url.path); |
96 headers.host = parsed_url.host or headers.host; | 103 headers.host = parsed_url.host or headers.host; |
97 | 104 |
98 len = len or 0; | 105 len = len or 0; |
99 packet = { | 106 packet = { |