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

StandaloneAhcWSRequest.createProxy should setUsePreemptiveAuth(true) for basic auth #276

Open
halfhp opened this issue Aug 25, 2018 · 0 comments

Comments

@halfhp
Copy link

halfhp commented Aug 25, 2018

Play WS Version

1.1.10

API (Scala / Java / Neither / Both)

Scala

Expected Behavior

Requests that specify a Proxy with basic auth should setUsePreemptiveAuth(true) for the proxy realm.

Actual Behavior

Requests that specify a Proxy with basic auth never setUsePreemptiveAuth(true) for the proxy realm, causing the connection to fail.

Details / Steps to Reproduce

While unsuccessfully attempting to connect to a commercial proxy using basic auth I noticed that StandaloneAhcWSRequest is inconsistent in it's application of realm configuration; for non-proxy requests usePreemptiveAuth is always set to true for non DIGEST schemes, however, when making a proxy request, this logic is omitted.

Upon duplicating the scheme check logic in StandaloneAhcWSRequest.createProxy() my basic auth proxy requests began working.

This is the code I've been using to test:

  val proxy = DefaultWSProxyServer(
    host = "some.proxy.xx",
    port = 222,
    principal = Some("username"),
    password = Some("password"))

  wsClient
    .url("http://api.ipify.org")
    .withProxyServer(proxy)
    .get().map( _.body[String])

If someone with more knowledge about how this code should be working can validate my findings, I'd be happy to issue a PR with a fix :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants