by simjue on 1/7/23, 8:41 AM with 19 comments
by seeekr on 1/7/23, 9:18 AM
I see that there's an 1.0 RC release and the offending API seems to have changed and is probably not amenable to this type of misuse any more. The article authors could have easily added some info about that -- I certainly would have appreciated not having to go looking for that myself.
by keybored on 1/7/23, 9:53 AM
Highlighting “unsafe” in red in an article about a Rust package when talking about something which is not Unsafe is so cursed.
by lovasoa on 1/7/23, 3:13 PM
to_bytes(body) -> Bytes
function at all ?Only a
to_bytes(body: B, max_size: Option<usize>)
This way if someone REALLY wants the behavior that potentially results in a crash, they still have access to it, but have to be really explicit about it.by jedisct1 on 1/7/23, 1:35 PM
But HTTP implementations like these are not really meant to directly face the internet. They usually sit behind reverse proxies/API gateways/CDNs.
by jayjader on 1/7/23, 9:06 AM
I am a bit disconcerted that something that apparently is warned against in the docs, is done across several "big" packages that use Hyper. Maybe with a more appropriate name exposed by the library, for example `to_bytes_unchecked`, such "bad" uses would be less wide-spread.
by sbt567 on 1/7/23, 9:23 AM
by qprofyeh on 1/7/23, 9:20 AM
by curling_grad on 1/7/23, 1:38 PM
AFAIK there's a proposal: https://rust-lang.github.io/rfcs/2116-alloc-me-maybe.html
by habibur on 1/7/23, 9:40 AM
by throwaway67743 on 1/7/23, 11:54 PM
by baq on 1/7/23, 11:09 AM