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 --- readme.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'readme.md') diff --git a/readme.md b/readme.md index 2134d60..104160c 100644 --- a/readme.md +++ b/readme.md @@ -9,11 +9,10 @@ heres an example of a webserver to return a [sha0](https://en.wikipedia.org/wiki
```lua ---(this is in tests/net2.lua) +--(this is in tests/old/net2.lua) net = require "lullaby.net" crypto = require "lullaby.crypto" local port = 8080 -MAX_LENGTH = 2048 net.listen(function(server) @@ -21,8 +20,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() -- cgit v1.2.3