I'm using an example to optimize Native Proxy, to modify some of the contents of the content .
I am proxying between an FTP client and server, so the end of lines in the CRLF - this is important. I am not doing anything with FTP data port yet, so this is not a factor.
I started with this example code:
... which sets a pipeline like this:.
ch.pipeline () addLast (New LoggingHandler (LogLevel.INFO), New HexDumpProxyFrontendHandler (remoteHost, remotePort));
... and it works fine.
If I add a new linebasedFrameDecoder (maxLen)
then the FTP client is waiting for the server, because the proxy has snatched the CRLF, and the server still waiting Used to be. .. I can fix it by telling the frame decoder not to remove the delimiter: New LineBasedFrameDecoder (maxLen, false, incorrect)
ch.pipeline () AddLast New LoggingHandler (LogLevel.INFO), New LineBasedFrameDecoder (maxLen, False False), New HexDumpProxyFrontendHandler (remoteHost, remotePort)); So far, if I add a string decoder, I get the same hanging symptom, this time because the StringDecoder after the pipeline step is not applied. ch.pipeline (). AddLast (New LoggingHandler), New LineBasedFrameDecoder (MaxLen, False False), New StringDecoder (StandardCharsets.UTF_8), // Objective rewriter your own string here New StringEncoder (StandardCharsets.UTF_8), New HexDumpProxyFrontendHandler (remoteHost, remotePort ), Is to go,
In a debugger, the breakpoint in StringEncoder.encode () is not triggered.
No comments:
Post a Comment