teach proxy server to challenge unauthenticated requests

HTTPClient needs this challenge to retry with Basic authentication,
otherwise it won't attempt authentication at all.
This commit is contained in:
Mislav Marohnić 2013-07-27 00:19:48 +02:00
parent 0a1deaf173
commit d0b01a9b31

View File

@ -27,6 +27,7 @@ webrick_opts = {
if username
type, credentials = req.header['proxy-authorization'].first.to_s.split(/\s+/, 2)
unless "Basic" == type && match_credentials.call(credentials)
res['proxy-authenticate'] = %{Basic realm="testing"}
raise WEBrick::HTTPStatus::ProxyAuthenticationRequired
end
end