Open ttiimm opened 2 years ago
This is due to the behavior of httparse
library.
When parsing a request with httparse
, the returned request's method
part is defined as Option<&'buf str>
and here simple-server
assumes that the reference points to the buffer's memory, however it is just a statically allocated str
somewhere outside of a buffer, thus pointer arithmetic performed is invalid
I am not sure whether this crate is still maintained, last merged PR was like 4 years ago? At least the method part should be reallocated during request parsing however from httparse
docs it doesn't guarantee that any of returned slice is pointing to the buffer, only that those are str slices with lifetimes at least as long as buffer's one. For me it's relying on internals of the httparse
dependency
I'm hitting an issue trying to run simple-server=0.4.0 on Apple M2 hardware. I get this failure when trying to run the example, then making a request. I know the architecture isn't fully supported yet, but thought I'd bring the issue up.
Rust and Cargo versions
Steps to Reproduce
$ RUST_BACKTRACE=1 UST_LOG="simple_server=info" cargo run
$ curl localhost:7878
Note: also tried compiling with
--target x86_64-apple-darwin
option, but similar failure observed.Another note: when running with version 0.3.0 I receive this message on the client side.
Result