diff net/http/parser.lua @ 13379:977d92aff563

Merge 0.12->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 01 Dec 2023 17:11:19 +0100
parents ba409c67353b db30ffbf2090
children 79a6598cef0b
line wrap: on
line diff
--- a/net/http/parser.lua	Thu Nov 30 18:45:05 2023 +0100
+++ b/net/http/parser.lua	Fri Dec 01 17:11:19 2023 +0100
@@ -59,7 +59,13 @@
 			while buffer:length() > 0 do
 				if state == nil then -- read request
 					local index = buffer:sub(1, headlimit):find("\r\n\r\n", nil, true);
-					if not index then return; end -- not enough data
+					if not index then
+						if buffer:length() > headlimit then
+							return error_cb("header-too-large");
+						end
+						-- not enough data
+						return;
+					end
 					-- FIXME was reason_phrase meant to be passed on somewhere?
 					local method, path, httpversion, status_code, reason_phrase; -- luacheck: ignore reason_phrase
 					local first_line;