Skip to content

Commit

Permalink
Include port in Host header, fixes JuliaWeb#673.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed Feb 23, 2021
1 parent ed99a10 commit 76a67ce
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/MessageRequest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ function request(::Type{MessageLayer{Next}},
target=resource(url),
parent=nothing, iofunction=nothing, kw...) where Next

defaultheader!(headers, "Host" => url.host)
if isempty(url.port) ||
(url.scheme == "http" && url.port == "80") ||
(url.scheme == "https" && url.port == "443")
host = url.host
else
host = url.host * ":" * url.port
end
defaultheader!(headers, "Host" => host)
defaultheader!(headers, "Accept" => "*/*")
if USER_AGENT[] !== nothing
defaultheader!(headers, "User-Agent" => USER_AGENT[])
Expand Down

0 comments on commit 76a67ce

Please sign in to comment.