tokio-rs / tokio-minihttp

Protocol implementation experimentations
Apache License 2.0
448 stars 50 forks source link

Strange post/body parse issue. Response didn't send. #25

Closed vird closed 7 years ago

vird commented 7 years ago

Here is test case https://gist.github.com/vird/b5251bf298a9365401c3f25df223ee51 My output

Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
Hello, world!
now fail comes
curl: (52) Empty reply from server
curl: (52) Empty reply from server
curl: (52) Empty reply from server
curl: (52) Empty reply from server
curl: (52) Empty reply from server

My env

# uname -a
Linux calculate 4.8.6 #1 SMP PREEMPT Sat Nov 12 20:07:16 EET 2016 x86_64 AMD A10-7850K Radeon R7, 12 Compute Cores 4C+8G AuthenticAMD GNU/Linux
# rustc -V
rustc 1.15.1

All request are parsed ok by server (you can add)

println!("{:?}", _request);

With this "hello world" will produce such output

<HTTP Request GET />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />
<HTTP Request POST />

So all request are processed by server, but not all responses are sent properly.

alexcrichton commented 7 years ago

Thanks for the report! Right now though unfortunately minihttp doesn't deal with HTTP bodies and will work incorrectly if they're provided. I'd recommend using hyper as a "real server", minihttp is mostly just an introductory example with Tokio.