[PREVIEW] HTTP Parser upgrade

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Mon, 19 May 2014 18:29:18 +1200

Updated patch attached. PREVIEW since the file renaming has been
omitted, as have incomplete Tokenizer related changes.

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

* We now have a two-class HTTP Parser hierarchy:
 parent/base) class Http::One::Parser (aka. Http1::Parser)
  - which contains the generic (but HTTP/1.x specific) parse members and
accessors

 child) class Http1::RequestParser
  - which contains the request-specific state members and parse logics
necessary to extend Http1::Parser into a HTTP Request message parser.

* 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
class. Is updated to process both the request-line and HTTP mime
headers, returning a incomplete parse result until the entire headers
parts of the message have been received.

* As each stage/segment of the message is parsed the bytes are dropped
from the I/O buffer to allow for more traffic to be received and later
stages to parse faster.

* The client-side code now simply runs the main
Http1Parser::parseRequest() method then uses its accessors to retrieve
and process the parser results for the method, URI,
protocol, mime headers block (as an SBuf) and some metrics about those.

* A unit test for incremental parsing has been added to testHttpParser.

Further work (after the current overall logics are audited):
 * conversin of parseFirstLine() to use ::Parser::Tokenizer
 * complete removal of req struct for temporary offsets.
 * RFC compliance fixes - several are now identified but not fixed.
 * file renaming is left half-way. To be completed as per guidelines
before merge.

Amos

Received on Mon May 19 2014 - 06:29:28 MDT

This archive was generated by hypermail 2.2.0 : Mon May 19 2014 - 12:00:13 MDT