Skip to content

Enable Netty HTTP header validation when connecting with proxy #6126

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

Merged
merged 1 commit into from
May 22, 2025
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "Netty NIO HTTP Client",
"contributor": "",
"description": "Enable Netty HTTP header validation when connecting with proxy"
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private void closeAndRelease(ChannelHandlerContext ctx) {
private HttpRequest connectRequest() {
String uri = getUri();
HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.CONNECT, uri,
Unpooled.EMPTY_BUFFER, false);
Unpooled.EMPTY_BUFFER);
request.headers().add(HttpHeaderNames.HOST, uri);

if (!StringUtils.isEmpty(this.username) && !StringUtils.isEmpty(this.password)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void handledAdded_writesRequest_withoutAuth() {

String uri = REMOTE_HOST.getHost() + ":" + REMOTE_HOST.getPort();
HttpRequest expectedRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.CONNECT, uri,
Unpooled.EMPTY_BUFFER, false);
Unpooled.EMPTY_BUFFER);
expectedRequest.headers().add(HttpHeaderNames.HOST, uri);

assertThat(requestCaptor.getValue()).isEqualTo(expectedRequest);
Expand All @@ -229,7 +229,7 @@ public void handledAdded_writesRequest_withAuth() {

String uri = REMOTE_HOST.getHost() + ":" + REMOTE_HOST.getPort();
HttpRequest expectedRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.CONNECT, uri,
Unpooled.EMPTY_BUFFER, false);
Unpooled.EMPTY_BUFFER);
expectedRequest.headers().add(HttpHeaderNames.HOST, uri);

String authB64 = Base64.getEncoder().encodeToString(String.format("%s:%s", PROXY_USER, PROXY_PASSWORD).getBytes(CharsetUtil.UTF_8));
Expand Down
Loading