HttpTerminalHandler Class — netty Architecture
Architecture documentation for the HttpTerminalHandler class in HttpProxyServer.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3655a06c_23a0_32d8_e5e3_92db919bce97["HttpTerminalHandler"] 28810160_ce2b_65e9_e2bc_c0ffa3db9787["HttpProxyServer.java"] 3655a06c_23a0_32d8_e5e3_92db919bce97 -->|defined in| 28810160_ce2b_65e9_e2bc_c0ffa3db9787 0b96569d_afe9_bbb8_48b0_efef32f1bdac["handleProxyProtocol()"] 3655a06c_23a0_32d8_e5e3_92db919bce97 -->|method| 0b96569d_afe9_bbb8_48b0_efef32f1bdac
Relationship Graph
Source Code
handler-proxy/src/test/java/io/netty/handler/proxy/HttpProxyServer.java lines 138–166
private final class HttpTerminalHandler extends TerminalHandler {
@Override
protected boolean handleProxyProtocol(ChannelHandlerContext ctx, Object msg) throws Exception {
FullHttpRequest req = (FullHttpRequest) msg;
FullHttpResponse res;
boolean sendGreeting = false;
if (!authenticate(ctx, req)) {
res = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.UNAUTHORIZED);
res.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0);
} else if (!req.uri().equals(destination.getHostString() + ':' + destination.getPort())) {
res = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.FORBIDDEN);
res.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0);
} else {
res = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
sendGreeting = true;
}
ctx.write(res);
ctx.pipeline().get(HttpServerCodec.class).removeOutboundHandler();
if (sendGreeting) {
ctx.write(Unpooled.copiedBuffer("0\n", CharsetUtil.US_ASCII));
}
return true;
}
}
Source
Frequently Asked Questions
What is the HttpTerminalHandler class?
HttpTerminalHandler is a class in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/HttpProxyServer.java.
Where is HttpTerminalHandler defined?
HttpTerminalHandler is defined in handler-proxy/src/test/java/io/netty/handler/proxy/HttpProxyServer.java at line 138.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free