GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix IllegalReferenceCountException on invalid upgrade response (#15602) · netty/netty@81d813d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • codec-http/src
    • main/java/io/netty/handler/codec/http
      • HttpClientUpgradeHandler.java
    • test/java/io/netty/handler/codec/http
      • HttpClientUpgradeHandlerTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java‎

Copy file name to clipboardExpand all lines: codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ protected void decode(ChannelHandlerContext ctx, HttpObject msg, List<Object> ou
252252
out.clear();
253253
removeThisHandler(ctx);
254254
} catch (Throwable t) {
255-
release(response);
256255
ctx.fireExceptionCaught(t);
257256
removeThisHandler(ctx);
258257
}
Collapse file

‎codec-http/src/test/java/io/netty/handler/codec/http/HttpClientUpgradeHandlerTest.java‎

Copy file name to clipboardExpand all lines: codec-http/src/test/java/io/netty/handler/codec/http/HttpClientUpgradeHandlerTest.java
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,28 @@ public void execute() throws Throwable {
241241
assertEquals(0, secondReq.refCnt());
242242
assertFalse(channel.finish());
243243
}
244+
245+
@Test
246+
public void forwardOnFailure() {
247+
HttpClientUpgradeHandler.SourceCodec sourceCodec = new FakeSourceCodec();
248+
HttpClientUpgradeHandler.UpgradeCodec upgradeCodec = new FakeUpgradeCodec();
249+
HttpClientUpgradeHandler handler = new HttpClientUpgradeHandler(sourceCodec, upgradeCodec, 1024);
250+
final EmbeddedChannel channel = new EmbeddedChannel();
251+
channel.pipeline().addFirst("upgrade", handler);
252+
253+
assertTrue(channel.writeOutbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "netty.io")));
254+
FullHttpRequest request = channel.readOutbound();
255+
assertTrue(request.release());
256+
257+
DefaultHttpResponse response = new DefaultHttpResponse(
258+
HttpVersion.HTTP_1_1, HttpResponseStatus.SWITCHING_PROTOCOLS);
259+
response.headers().add(HttpHeaderNames.UPGRADE, "");
260+
assertFalse(channel.writeInbound(response));
261+
assertThrows(IllegalStateException.class, () -> channel.writeInbound(LastHttpContent.EMPTY_LAST_CONTENT));
262+
263+
FullHttpResponse full = channel.readInbound();
264+
assertTrue(full.release());
265+
266+
assertFalse(channel.finish());
267+
}
244268
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.