-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
I'm sending a request to localhost:<port>/some-url
and expect the server to redirect me to localhost:<port>/another-url
, however, the server redirects me to localhost:80/another-url
instead. I think the reason for this is that hyper sets the Host
header of the client request to localhost
, not localhost:<port>
as it should.
The header is set here:
Line 62 in 50a6f61
headers.set(Host(host)); |
The host the header is set to is extracted from the
Url
here: Line 48 in 50a6f61
let host = match url.serialize_host() { |
I've confirmed that serialize_host
omits the port. Example code:
use hyper::Url;
let url = Url::parse("http://localhost:12345/some-url").unwrap();
print!("url: {}\n", url);
print!("url.serialize_host().unwrap(): {}\n", url.serialize_host().unwrap());
Output:
url: http://localhost:12345/some-url
url.serialize_host().unwrap(): localhost
What I don't know is whether the problem lies with serialize_host
or if it is used incorrectly in Request::with_stream
. Any thoughts?
Metadata
Metadata
Assignees
Labels
No labels