Comparison

mod_http_oauth2/mod_http_oauth2.lua @ 5985:e8bf46a7bb27

mod_http_oauth2: Ensure URL ports are integer in correct range LuaSocket is weird and thinks ports should be strings
author Kim Alvefur <zash@zash.se>
date Thu, 29 Aug 2024 18:03:23 +0200
parent 5984:97375a78d2b5
child 5986:5f8a306c8306
comparison
equal deleted inserted replaced
5984:97375a78d2b5 5985:e8bf46a7bb27
30 30
31 local function strict_url_parse(urlstr) 31 local function strict_url_parse(urlstr)
32 local url_parts = url.parse(urlstr); 32 local url_parts = url.parse(urlstr);
33 if not url_parts then return url_parts; end 33 if not url_parts then return url_parts; end
34 if url_parts.userinfo then return false; end 34 if url_parts.userinfo then return false; end
35 if url_parts.port then
36 local port = tonumber(url_parts.port);
37 if not port then return false; end
38 if not (port > 0 and port <= 0xffff) then return false; end
39 if port ~= math.floor(port) then return false; end
40 end
35 return url_parts; 41 return url_parts;
36 end 42 end
37 43
38 local function strict_formdecode(query) 44 local function strict_formdecode(query)
39 if not query then 45 if not query then