Skip to content

How do I parse an http request from tokio::net::TcpStream into hyper::http:Request? #2810

Answered by seanmonstar
dityas asked this question in Q&A
Discussion options

You must be logged in to vote

If you're looking to use hyper to handle the HTTP for you, then you want to look at hyper::server::conn::Http.

If you want to implement HTTP yourself, exactly how you decide to parse and encode is up to you. HTTP has a lot of edge-cases, so I don't recommend it. But if you really wanted, you look at using something like the httparse crate, and then convert the parsed types into http::Request.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dityas
Comment options

@seanmonstar
Comment options

Answer selected by seanmonstar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2809 on April 09, 2022 15:22.