Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set userinfo from http(s)_proxy to proxy-auth #640

Merged
merged 1 commit into from
Dec 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/ConnectionRequest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ using ..Messages
using ..IOExtras
using ..ConnectionPool
using MbedTLS: SSLContext
using ..Pairs: getkv, setkv
using Base64: base64encode
import ..@debug, ..DEBUG_LEVEL

# hasdotsuffix reports whether s ends in "."+suffix.
Expand Down Expand Up @@ -65,6 +67,12 @@ function request(::Type{ConnectionPoolLayer{Next}}, url::URI, req, body;
if target_url.scheme == "http"
req.target = string(target_url)
end

userinfo = unescapeuri(url.userinfo)
if !isempty(userinfo) && getkv(req.headers, "Proxy-Authorization", "") == ""
@debug 1 "Adding Proxy-Authorization: Basic header."
setkv(req.headers, "Proxy-Authorization", "Basic $(base64encode(userinfo))")
end
end

IOType = ConnectionPool.Transaction{sockettype(url, socket_type)}
Expand Down