From d3ac2d0568849bc46da8a6251843483507f16287 Mon Sep 17 00:00:00 2001 From: Klaas van Schelven Date: Thu, 25 Apr 2024 15:07:25 +0200 Subject: [PATCH] (configurable) max header size (both envelope and item header) --- ingest/parsers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ingest/parsers.py b/ingest/parsers.py index af3cf42..5eab0a1 100644 --- a/ingest/parsers.py +++ b/ingest/parsers.py @@ -1,6 +1,8 @@ import json import io +from bugsink.streams import MaxDataWriter + class ParseError(Exception): pass @@ -99,7 +101,7 @@ class StreamingEnvelopeParser: the whole headers-terminated-by-newline possible) """ - header_stream = io.BytesIO() + header_stream = MaxDataWriter("MAX_HEADER_SIZE", io.BytesIO()) # points 3, 4 (we don't use 5, 6, 7, 9 explicitly) self.remainder, self.at_eof = readuntil(