mod_http_oauth2: Pedantic optimization
authorKim Alvefur <zash@zash.se>
Sun, 26 Mar 2023 14:37:42 +0200
changeset 5280 67777cb7353d
parent 5279 3e30799deec2
child 5281 a1055024b94e
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).
mod_http_oauth2/mod_http_oauth2.lua
--- 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);