GithubHelp home page GithubHelp logo

Comments (10)

slandelle avatar slandelle commented on May 11, 2024

The error message is actually wrong, Netty 3 doesn't properly handle BAD_REQUEST status code: netty/netty#441

@cstamas I know this is an old issue, but would you have a simple test case (server side) so I can investigate, please?

from async-http-client.

slandelle avatar slandelle commented on May 11, 2024

I have a Gatling user who kindly provided a test case: https://docs.google.com/file/d/0B1zTVlhQrNiyZ01CZDFDWm5QYlk/edit

Installation instructions:

Send POST requests to localhost:3000/post/test, XML bodies, compressed on not, will be printed in the console.

RequestBuilder requestBuilder = new RequestBuilder("POST");
requestBuilder.setUrl("http://localhost:3001/post/test");
requestBuilder.setBody("<foo>bar</foo>".getBytes());
Request request = requestBuilder.build();

AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setRequestCompressionLevel(6).build();
AsyncHttpClient client = new AsyncHttpClient(config);
// AsyncHttpClient client = new AsyncHttpClient(); // works perfectly when no request compression

try {
    client.executeRequest(request).get();
} finally {
    client.close();
}

Note that IllegalStateException: cannot send more responses than requests is actually Netty not properly handling BAD_REQUEST status code.

from async-http-client.

slandelle avatar slandelle commented on May 11, 2024

NettyAsyncHttpProvider wrongly uses a HttpContentCompressor, which is a HttpContentEncoder, that, as doc states, is only used for encoding responses, not requests!

Actually, Netty doesn't support request compression yet. See netty/netty#2131 and netty/netty#2132

from async-http-client.

slandelle avatar slandelle commented on May 11, 2024

@jfarcand As this is a Netty feature request, I don't know when it will be implemented and I doubt it will be backported on Netty 3.

I say that we remove the feature for now, both in AHC1 and AHC2. This won't cause regression is AHC1 because no user could possibly use it: it just makes the request break.

from async-http-client.

slandelle avatar slandelle commented on May 11, 2024

Change title

from async-http-client.

jfarcand avatar jfarcand commented on May 11, 2024

Agree. Closing as won't fix.

from async-http-client.

slandelle avatar slandelle commented on May 11, 2024

@jfarcand I disagree. I've been asked for this feature on Gatling and had to implement it on my own, and it's not great and I'd rather have it supported in Netty.

Let's just turn what first was an issue into a feature request (I did one on Netty).

from async-http-client.

slandelle avatar slandelle commented on May 11, 2024

No activity there for a very long time. Closing for now.

from async-http-client.

Diagoras avatar Diagoras commented on May 11, 2024

@slandelle I know you'd prefer to see this implemented in Netty, but what do you think about adding this to AHC until Netty finally supports request compression?

I think it'd be doable using just a RequestFilter, if that helps. And if you're leery about polluting the config class with more options we could just include a GzipRequestFilter in AHC and let people manually add it to the request filters in the config themselves.

If you think it's worth considering, I can open a PR. Let me know.

from async-http-client.

slandelle avatar slandelle commented on May 11, 2024

I don't think that would work with every kinds of response bodies.
I think the only way to implement it is to have a Netty handler, similar to the one use for compressing server side.

from async-http-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.