Mercurial > prosody-hg
comparison net/http/server.lua @ 10950:a23328c46389 0.11
net.http.server: Strip port from Host header in IPv6 friendly way (fix #1302)
E.g. given `[::1]:5280` it would previously result in only `[` instead
of the correct `[::1]`
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 23 Jun 2020 15:39:31 +0200 |
| parents | cc9dff0212f4 |
| children | f4215f8baa5d |
comparison
equal
deleted
inserted
replaced
| 10947:801b9d5957a6 | 10950:a23328c46389 |
|---|---|
| 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 ""):match("[^:]+"); | 210 local host = (request.headers.host or ""):gsub(":%d+$",""); |
| 211 | 211 |
| 212 -- Some sanity checking | 212 -- Some sanity checking |
| 213 local err_code, err; | 213 local err_code, err; |
| 214 if not request.path then | 214 if not request.path then |
| 215 err_code, err = 400, "Invalid path"; | 215 err_code, err = 400, "Invalid path"; |
