Skip to content

Commit 4b902ec

Browse files
docs: warn about retry loops on Status::Partial (#217)
1 parent dc64fbe commit 4b902ec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,13 @@ impl<'h, 'b> Request<'h, 'b> {
545545
}
546546
}
547547
}
548-
549548
/// Try to parse a buffer of bytes into the Request.
550549
///
551550
/// Returns byte offset in `buf` to start of HTTP body.
551+
///
552+
/// # Warning
553+
/// In streaming code, if this returns `Status::Partial`, avoid retry loops
554+
/// on a growing buffer without size/time limits; CPU usage may grow fast.
552555
pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
553556
self.parse_with_config(buf, &Default::default())
554557
}
@@ -625,8 +628,11 @@ impl<'h, 'b> Response<'h, 'b> {
625628
headers,
626629
}
627630
}
628-
629631
/// Try to parse a buffer of bytes into this `Response`.
632+
///
633+
/// # Warning
634+
/// In streaming code, if this returns `Status::Partial`, avoid retry loops
635+
/// on a growing buffer without size/time limits; CPU usage may grow fast.
630636
pub fn parse(&mut self, buf: &'b [u8]) -> Result<usize> {
631637
self.parse_with_config(buf, &ParserConfig::default())
632638
}

0 commit comments

Comments
 (0)