Hi,
if you do something like http --print hH http://localhost:80/ you get this with :80 in the host header as output:
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:80
User-Agent: HTTPie/2.4.0
But if you look at it with strace (strace -f -v -s 256 -e sendto http --print hH http://localhost:80/) you get
sendto(3, "GET / HTTP/1.1\r\nHost: localhost\r\nUser-Agent: HTTPie/2.4.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n", 130, 0, NULL, 0) = 130
So the port was removed in the actual request.
What httpie is showing is wrong in this case. It works with non-default ports, so it's just an issue with http + 80 and https + 443.
It confused me when I debugged a custom host header matching logic where I forgot to match/ignore the port.
It should both match, so there's no confusion what really is sent.
Workaround:
If you want to get the port to the host header, you have to use the header request item argument.
Hi,
if you do something like
http --print hH http://localhost:80/you get this with:80in the host header as output:But if you look at it with strace (
strace -f -v -s 256 -e sendto http --print hH http://localhost:80/) you getSo the port was removed in the actual request.
What httpie is showing is wrong in this case. It works with non-default ports, so it's just an issue with http + 80 and https + 443.
It confused me when I debugged a custom host header matching logic where I forgot to match/ignore the port.
It should both match, so there's no confusion what really is sent.
Workaround:
If you want to get the port to the host header, you have to use the header request item argument.