How do I parse an http request from tokio::net::TcpStream into hyper::http:Request? #2810
|
Hey everyone. KInda new to async. I was looking into the documentation and could not find a way to parse a raw HTTP request read from a TCP stream into the HTTP Request struct. Is there a way to do that? |
Answered by
seanmonstar
Apr 9, 2022
Replies: 1 comment 2 replies
|
If you're looking to use hyper to handle the HTTP for you, then you want to look at 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 |
2 replies
Answer selected by
seanmonstar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
httparsecrate, and then convert the parsed types intohttp::Request.