You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to develop code that can filter requests, modify them, etc. The Proxy intercepts requests correctly and is able to display the correct Uri for example. However, I cannot read the contents of the http package. In fact, the request.content (). ReadableBytes () function returns 0.
HttpProxyServer server =
DefaultHttpProxyServer.bootstrap()
.withAddress(new InetSocketAddress("localhost", 8080))
.withTransparent(true)
.withFiltersSource(new HttpFiltersSourceAdapter() { @OverRide
public int getMaximumRequestBufferSizeInBytes() {
return 512 * 1024;
} @OverRide
public int getMaximumResponseBufferSizeInBytes() {
return 50 * 1024 * 1024;
}
public HttpFilters filterRequest(HttpRequest originalRequest, ChannelHandlerContext ctx) {
return new HttpFiltersAdapter(originalRequest) { @OverRide
public HttpResponse clientToProxyRequest(HttpObject httpObject) {
FullHttpRequest request = (FullHttpRequest) httpObject;
CompositeByteBuf contentBuf = (CompositeByteBuf) request.content();
System.out.println(request.getUri());
System.out.println(request.content().readableBytes());
So, why request.content().readableBytes() returns always 0 ?
The text was updated successfully, but these errors were encountered:
I'm trying to develop code that can filter requests, modify them, etc. The Proxy intercepts requests correctly and is able to display the correct Uri for example. However, I cannot read the contents of the http package. In fact, the request.content (). ReadableBytes () function returns 0.
HttpProxyServer server =
DefaultHttpProxyServer.bootstrap()
.withAddress(new InetSocketAddress("localhost", 8080))
.withTransparent(true)
.withFiltersSource(new HttpFiltersSourceAdapter() {
@OverRide
public int getMaximumRequestBufferSizeInBytes() {
return 512 * 1024;
}
@OverRide
public int getMaximumResponseBufferSizeInBytes() {
return 50 * 1024 * 1024;
}
public HttpFilters filterRequest(HttpRequest originalRequest, ChannelHandlerContext ctx) {
return new HttpFiltersAdapter(originalRequest) {
@OverRide
public HttpResponse clientToProxyRequest(HttpObject httpObject) {
FullHttpRequest request = (FullHttpRequest) httpObject;
CompositeByteBuf contentBuf = (CompositeByteBuf) request.content();
System.out.println(request.getUri());
System.out.println(request.content().readableBytes());
So, why request.content().readableBytes() returns always 0 ?
The text was updated successfully, but these errors were encountered: