From 4ecdd3c18ccc5d3bcaa82ed720bf28443aa0ca9d Mon Sep 17 00:00:00 2001 From: ame Date: Fri, 12 Jun 2026 00:56:21 -0500 Subject: http body parsing rewrite --- tests/old/net2.lua | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tests/old/net2.lua') diff --git a/tests/old/net2.lua b/tests/old/net2.lua index bb69051..2398b63 100644 --- a/tests/old/net2.lua +++ b/tests/old/net2.lua @@ -1,8 +1,7 @@ ---(this is in tests/net2.lua) +--(this is in tests/old/net2.lua) net = require "lullaby.net" local crypto = require "lullaby.crypto" local port = 8080 -MAX_LENGTH = 2048 net.listen(function(server) @@ -10,8 +9,8 @@ net.listen(function(server) server:POST("/", function(res, req) --creates a sha0 hash object local hash = crypto.sha0() - --loads an extra 2048 characters from the request body (the body is not guaranteed to be >= 2048 characters, reasoning in docs) - req:roll(MAX_LENGTH) + + req:load() --incremental hashes allow updating via addition, in this case adding the body and getting a string from it hash = (hash + req.Body):final() @@ -21,4 +20,3 @@ net.listen(function(server) end) end, port) - -- cgit v1.2.3