Skip to content

fix: use the https.proxyHost and https.proxyPort properties for HTTPS - #1575

Open
jlouvel wants to merge 2 commits into
fix/netty-proxy-connect-authfrom
fix/netty-https-proxy-properties
Open

jlouvel wants to merge 2 commits into
fix/netty-proxy-connect-authfrom
fix/netty-https-proxy-properties

Conversation

@jlouvel

@jlouvel jlouvel commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Closes #1570. Based on #1574.

For HTTPS requests, the Netty client fell back to the http.proxyHost / http.proxyPort system properties. The JDK convention (Networking Properties) is https.proxyHost / https.proxyPort for HTTPS. So a JVM configured with only the https.* properties sent HTTPS requests directly, and one with only the http.* properties tunneled HTTPS requests through a proxy meant for plain HTTP.

Changes

  • NettyClientHelper:
    • New public getHttpsProxyHost() / getHttpsProxyPort(): the proxyHost / proxyPort parameters, else the https.* system properties, with port 3128 by default as before.
    • A package-private getProxy(boolean secure) now picks the proxy of each request. create(), acquire() (the HTTP/3 bypass) and connect() use it.
    • The parameter table Javadoc is updated.
  • NettyClientCall: the tunnel check uses getProxy(true).
  • ProxyTestCase: HTTPS requests go through the https.* proxy and ignore the http.* one. The tests restore the system properties when done.
  • changes.md: entry under Bugs fixed.

The proxyHost / proxyPort connector parameters still apply to both schemes, and getProxyHost() / getProxyPort() are unchanged. I didn't add separate httpsProxyHost / httpsProxyPort parameters: a client needing different proxies per scheme can use the system properties, and I'd rather not grow the parameter list without a use case.

Validation

ProxyTestCase: 7 tests pass. The full module verify was run at the top of the stack (see #1574 for the first one).

🤖 Generated with Claude Code

@jlouvel

jlouvel commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

Full module verify passed at the top of the stack (#1580 branch, which includes this PR): 2,228 tests, 0 failures; JaCoCo checks met; SpotBugs 8 findings (threshold 9).

@jlouvel
jlouvel requested a balanced review from Copilot October 30, 2026 14:51
@jlouvel jlouvel self-assigned this Oct 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A critical credential leak remains: HTTPS requests made with only http.proxyHost configured can send the generated Proxy-Authorization header directly to the origin.

1 open issue
What changed in this PR

Updates the Netty client to select proxy system properties by request scheme, addressing #1570 while preserving shared connector parameters and the CONNECT handling introduced in #1574.

Changes:

  • Uses https.proxyHost and https.proxyPort for HTTPS proxy selection.
  • Adds tests for HTTPS proxy properties and ignoring HTTP-only proxy settings.
  • Updates proxy documentation and the changes log.
File Description
org.restlet/​src/​test/​java/​org/​restlet/​engine/​connector/​ProxyTestCase.java Adds scheme-specific proxy tests with system-property restoration.
org.restlet/​src/​main/​java/​org/​restlet/​engine/​netty/​NettyClientHelper.java Adds HTTPS proxy accessors and scheme-aware proxy selection.
org.restlet/​src/​main/​java/​org/​restlet/​engine/​netty/​NettyClientCall.java Uses HTTPS proxy selection for tunnel detection.
changes.md Records the HTTPS proxy-property fix.

Review effort: Balanced

jlouvel and others added 2 commits October 30, 2026 16:07
The Netty client fell back to the http.proxyHost and http.proxyPort
system properties for HTTPS requests too. Like the JDK, it now uses
https.proxyHost and https.proxyPort for them. The proxyHost and proxyPort
connector parameters still apply to both schemes.

- NettyClientHelper: new getHttpsProxyHost() and getHttpsProxyPort(), and
  a package-private getProxy(secure) used to route each request.
- ProxyTestCase: HTTPS requests use the https.* properties and ignore the
  http.* ones.

Closes #1570.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jerome Louvel <374450+jlouvel@users.noreply.github.com>
With only the http.proxyHost system property set, HTTPS requests connect
directly to the origin server, and the Proxy-Authorization header of
their proxy credentials was sent to it.

- NettyClientCall: remove the Proxy-Authorization header of the requests
  that neither go through a CONNECT tunnel nor to a forward proxy.
- ProxyTestCase: the origin server doesn't receive the proxy credentials
  of an HTTPS request when only the http.* proxy properties are set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jlouvel
jlouvel force-pushed the fix/netty-https-proxy-properties branch from c4fc133 to 970add5 Compare October 30, 2026 20:12
@sonarqubecloud

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants