From 98e5e1c3783889e69ce0b8788e4baa704ea7aae1 Mon Sep 17 00:00:00 2001 From: thesmartshadow Date: Mon, 2 Feb 2026 19:16:20 +0000 Subject: [PATCH] docs: warn about retry loops on Status::Partial --- src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dadb63b..005fbca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -545,10 +545,13 @@ impl<'h, 'b> Request<'h, 'b> { } } } - /// Try to parse a buffer of bytes into the Request. /// /// Returns byte offset in `buf` to start of HTTP body. + /// + /// # Warning + /// In streaming code, if this returns `Status::Partial`, avoid retry loops + /// on a growing buffer without size/time limits; CPU usage may grow fast. pub fn parse(&mut self, buf: &'b [u8]) -> Result { self.parse_with_config(buf, &Default::default()) } @@ -625,8 +628,11 @@ impl<'h, 'b> Response<'h, 'b> { headers, } } - /// Try to parse a buffer of bytes into this `Response`. + /// + /// # Warning + /// In streaming code, if this returns `Status::Partial`, avoid retry loops + /// on a growing buffer without size/time limits; CPU usage may grow fast. pub fn parse(&mut self, buf: &'b [u8]) -> Result { self.parse_with_config(buf, &ParserConfig::default()) }