It cause error when I use http client to do the http2 request #3676
-
Version Platform Description One way to structure the description: [short summary of the bug]
I tried this code:
I expected to see this happen: [explanation]
Instead, this happened: [explanation] |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
The following is the log of curl without proxy.
|
Beta Was this translation helpful? Give feedback.
-
What does the code look like when you send the request? What headers are you explicitly setting? |
Beta Was this translation helpful? Give feedback.
-
The source code is here https://github.com/lsk569937453/rcurl/tree/dev.
|
Beta Was this translation helpful? Give feedback.
I suspect it's this line: https://github.com/lsk569937453/rcurl/blob/9bb784aec1c45cbc9f5c51106ad8abe6b0ff56db/src/http/handler.rs#L236
While sending a host header over HTTP/2 isn't forbidden (and thus hyper allows it), some servers choose to call it a PROTOCOL_ERROR (it's not, they're wrong). However, it is true that you don't need to send it, since hyper's legacy client will automatically send the correct
:authority
header for you.