Mercurial > prosody-hg
comparison net/http/server.lua @ 10951:f4215f8baa5d 0.11
net.http.server: Fix reporting of missing Host header
The "Missing or invalid 'Host' header" case was dead code previously
because `host` was always at least an empty string.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 23 Jun 2020 15:43:57 +0200 |
| parents | a23328c46389 |
| children | 05d218aae3d1 de76f566159e |
comparison
equal
deleted
inserted
replaced
| 10950:a23328c46389 | 10951:f4215f8baa5d |
|---|---|
| 205 done = _M.finish_response; | 205 done = _M.finish_response; |
| 206 finish_cb = finish_cb; | 206 finish_cb = finish_cb; |
| 207 }; | 207 }; |
| 208 conn._http_open_response = response; | 208 conn._http_open_response = response; |
| 209 | 209 |
| 210 local host = (request.headers.host or ""):gsub(":%d+$",""); | 210 local host = request.headers.host; |
| 211 if host then host = host:gsub(":%d+$",""); end | |
| 211 | 212 |
| 212 -- Some sanity checking | 213 -- Some sanity checking |
| 213 local err_code, err; | 214 local err_code, err; |
| 214 if not request.path then | 215 if not request.path then |
| 215 err_code, err = 400, "Invalid path"; | 216 err_code, err = 400, "Invalid path"; |
