0

I'm currently working on a project that uses Netty's SOCKS5 implementation to proxy HTTP requests. I need to intercept and read the HTTP headers of the incoming requests to apply some custom logic.

However, I'm having trouble figuring out how to extract the HTTP headers from the incoming requests using Netty's SOCKS5 implementation. Can someone guide me on how to do this?

Here's the code I'm working with:

ch.pipeline().addLast(
  ProxyChannelTrafficShapingHandler.PROXY_TRAFFIC,
  new ProxyChannelTrafficShapingHandler(3000, proxyFlowLog, channelListener)
);
//channel
ch.pipeline().addLast(new IdleStateHandler(3, 30, 0));
ch.pipeline().addLast(new ProxyIdleHandler());
//netty
if (logging) {
  ch.pipeline().addLast(new LoggingHandler());
}

//Socks5MessagByteBuf
ch.pipeline().addLast(Socks5ServerEncoder.DEFAULT);

//sock5 init
ch.pipeline().addLast(new Socks5InitialRequestDecoder());

//sock5 init
ch.pipeline().addLast(new Socks5InitialRequestHandler(ProxyServer.this));

if (isAuth()) {
  //socks auth
  ch.pipeline().addLast(new Socks5PasswordAuthRequestDecoder());
  //socks auth
  ch.pipeline().addLast(new Socks5PasswordAuthRequestHandler(getPasswordAuth()));
}

//socks connection
ch.pipeline().addLast(new Socks5CommandRequestDecoder());
//Socks connection

ch.pipeline().addLast(new Socks5CommandRequestHandler(ProxyServer.this.getBossGroup()));

I'd appreciate any help or guidance on this issue. Thank you in advance!

Arun
  • 1,167
  • 18
  • 37

0 Answers0