Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Merging small fix for HTTP 1.1 parsing error?

On Mon, Oct 13, 2014 at 11:00 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
BTW, the docs you linked are for Jetty 6.  (not Jetty 7/8/9)

Sorry, you're right.  My point was that people would be using HttpTester.parseRequest because it was the documented way to test Http parsing.  But as you point out it will still be available in the tests artifact which makes sense.
 
Now, onto the core of the problem.
The original bug is filed under the assumption that HTTP/1.1 parsing is bad/broken.

Just to clarify,  I've only ever claimed that the is bug in parsing HTTP/1.1 requests with HttpTester.parseRequest, not that there is something bad or broken with HTTP/1.1 parsing itself.  Sorry, looking back I should have been more specific with the subject of this thread to include HttpTester.


The bug is in the assumption that you use a protocol representation with HttpTester to test with.

When SPDY was introduced, it was quickly determined that the HTTP world does not revolve around HTTP the protocol, but rather HTTP the semantic.  With SPDY and now HTTP/2 you have headers, and request parameters, and uris, but not the HTTP protocol.  The HttpTester was changed to behave in a protocol neutral, but HTTP semantic way.
You create a Request object, give it to the tester and let the jetty internals process it / dispatch it / get the response state / headers / content, and return it to you, as an Response object.

Opened up 2 bugs around this:

https://bugs.eclipse.org/446952 - fixing the documentation and implementation for HttpTester and ServletTester
https://bugs.eclipse.org/446944 - the tests classifier artifact location for the HttpTester and ServletTester

If you have protocol specific things to test, using HttpTester and ServletTester are not the correct way to do that.  Especially if you are wanting to test content encoding or behavior (such as compressed, gzip, deflate, or chunked encoding)


I'll keep track of  https://bugs.eclipse.org/446952 to see how HttpTester will change for 9.3 and update accordingly.  The tests I'm using don't need to test content encoding or behavior so in the meantime I've got my tests passing again by using the following implementation of HttpTester.parseRequest.

 public static Request parseRequest(String request)
    {
        Request r=new Request() {
          @Override
          public int getHeaderCacheSize() {
            return 512;
          }
        };
        HttpParser parser =new HttpParser(r);
        parser.parseNext(BufferUtil.toBuffer(request));
        return r;
    }


Back to the top