Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method POST with body-raw incorrect work buffer in server with request #967

Closed
sapsan4eg opened this issue Dec 4, 2016 · 4 comments
Closed

Comments

@sapsan4eg
Copy link

Hi guys, i have problem when i send POST with body-raw to my server. First request work fine, but following requests with same data will wrong parsing. If the difference is less than a second between requests. The method is added to the body-raw.
For example, this for second and following requests print to console: {"mydata":"the data that I sent"}}POST

#![deny(warnings)]
extern crate hyper;
extern crate env_logger;

use hyper::server::{Request, Response};

static PHRASE: &'static [u8] = b"Hello World!";

fn hello(req: Request, res: Response) {
    println!("{}", req.method);
    res.send(PHRASE).unwrap();
}

fn main() {
    env_logger::init().unwrap();
    let _listening = hyper::Server::http("127.0.0.1:3000").unwrap()
        .handle(hello);
    println!("Listening on http://127.0.0.1:3000");
}
@rpjohnst
Copy link

rpjohnst commented Dec 8, 2016

This looks like a duplicate of #309

@sapsan4eg
Copy link
Author

sapsan4eg commented Dec 9, 2016

That issue was closed but not solved. As I understand it the only way out is to move to 0.10. But the release has not yet been. And 0.9x is not compatible with 0.10. And this does not solve the current problem with 0.9x.

@rpjohnst
Copy link

The workaround for 0.9.x is to make sure that either 1) the entire request body is read, or 2) that the connection is closed after handling the request.

@seanmonstar
Copy link
Member

Closing as duplicate of #309.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants