Software /
code /
prosody-modules
Diff
mod_http_oauth2/mod_http_oauth2.lua @ 5276:67777cb7353d
mod_http_oauth2: Pedantic optimization
Checking the length of the string seems like 30% more expensive than
comparing it with the empty string (by reference, probably).
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 26 Mar 2023 14:37:42 +0200 |
parent | 5273:40be37652d70 |
child | 5277:a1055024b94e |
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua Sat Mar 25 20:18:05 2023 +0100 +++ b/mod_http_oauth2/mod_http_oauth2.lua Sun Mar 26 14:37:42 2023 +0200 @@ -335,7 +335,7 @@ local function get_auth_state(request) local form = request.method == "POST" and request.body - and #request.body > 0 + and request.body ~= "" and request.headers.content_type == "application/x-www-form-urlencoded" and http.formdecode(request.body);