Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't read content of Request #449

Open
niccocorsa94 opened this issue Jun 27, 2021 · 0 comments
Open

Can't read content of Request #449

niccocorsa94 opened this issue Jun 27, 2021 · 0 comments

Comments

@niccocorsa94
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant