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

GitHub Webhook client locks up hyper after 1 request #658

Closed
brianloveswords opened this issue Sep 29, 2015 · 1 comment
Closed

GitHub Webhook client locks up hyper after 1 request #658

brianloveswords opened this issue Sep 29, 2015 · 1 comment

Comments

@brianloveswords
Copy link

Here's a minimal repro:

extern crate hyper;

use hyper::server::{Request, Response};
use std::io::Read;

// If a github webhook client requests this route, after serving that request successfully
// it will never respond to another request from any client again.
fn hello(req: Request, res: Response) {
    let mut req = req;
    println!("request received, processing");
    println!("loading body into string");
    let mut payload = String::new();
    if req.read_to_string(&mut payload).is_err() {
        println!("could not read body into string");
        return res.send(b"nope").unwrap();
    }
    println!("done, responding");
    res.send(b"yep").unwrap();
}

fn main() {
    let _listening = hyper::Server::http("0.0.0.0:4200").unwrap()
        .handle(hello);
    println!("Listening on 0.0.0.0:4200");
}

This responds perfectly fine to curls but if this is set to be a GitHub webhook receiver, the server will stop accepting requests after it successfully serves the first one.

@brianloveswords
Copy link
Author

This is a dupe of #368

brianloveswords added a commit to brianloveswords/hookshot that referenced this issue Sep 29, 2015
This is a workaround for a hyper bug:
hyperium/hyper#658
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

1 participant