Re: [PATCH] HTTP Parser upgrade

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sat, 07 Jun 2014 04:55:18 +1200

Latest version of the Parser-NG project branch. Since last message I
have dropped the copy-constructor related pieces.

Polygraph testing on the branch showed almost no performance impact
(+0.04ms/req, -0.03% request rate). Nevertheless a half dozen points of
added memory reallocate or data copy are marked for future removal as
the Parser-NG and SBuf improvements continue.

Coadvisor testing of these changes shows a gain of 3 compliance cases
for HTTPbis tests and no unexpected regressions against RFC 2616 (one
HTTPbis gain is claimed as a RFC2616 regression by coadvisor still).

To recap, this projet so far:

Rename the HttpParser class as Http1::RequestParser and move it into the
Http::One:: namespace. A base Http1::Parser class is also added from
which Http1::ReplyParser will also be created in future work.

The parser API
 - is updated to process both the request-line and HTTP mime headers,
returning a incomplete parse result until the entire header portion of
the message has been received.
 - now contains accessor methods for retrieving the method, URI,
protocol, mime headers block as separate SBuf and some metrics about those.
 - the old request_offsets structure and similar offset details internal
to the parsing are no longer exposed.

The parser is now incremental. A parser object must be created (or
clean() method called) for each new message. Code using the parser
should pass their I/O buffer to the parse(SBuf&) method and retrieve an
updated copy of it afterwards via the remaining() method.

Much of the code from client_side.cc parseHttpRequest() and also the
header-field code from mime_headers.cc has been moved into the parser
classes. The client-side code now simply runs the main parse() method
then uses its accessors to retrieve and process the parse results if it
returns success.

The getHeaderField() method imported from mime_headers.cc has been
converted to simpler logics based on Tokenizer class and resolving a
number of bugs in its matching output.

A unit test for incremental parsing has been added to testHttp1Parser.

The HttpRequestMethod class is moved into the Http namespace and
library to reduce dependencies on the parser class outside the library.

The HttpHeader API has been tweaked slighty to accept start+length pair
instead of start/end pointers.

Amos

Received on Fri Jun 06 2014 - 16:55:40 MDT

This archive was generated by hypermail 2.2.0 : Sat Jun 07 2014 - 12:00:11 MDT