Subject: Re: [boost] C++ Networking Library Release 0.5
From: Peter Petrov (ppetrov_at_[hidden])
Date: 2010-02-01 17:37:10
On Mon, Feb 1, 2010 at 11:49 PM, Phil Endecott <
> Peter Petrov wrote:
>> First, Spirit is unsuitable for the task - it consumes all the input in
>> pass, and doesn't support the case when the HTTP request arrives in more
>> than one read. The real solution is a state-machine-based parser, just
>> the one in the Asio HTTP example.
> I disagree in general. My parser is primarily an HTTP request _header_
> parser, and the headers are normally relatively small. For most requests
> (i.e. GETs) the request body doesn't add much, and in those cases it is
> likely that the whole request can be got in a single read. In fact browser
> implementations go to some lengths to make their requests fit in single
> network packets (about 1500 bytes) for performance reasons, and single
> network packets will generally be accessible as single reads.
Of course I'm also talking about a header-only parser. The request body is
naturally read separately.
Your assumption about the single-TCP-packet HTTP requests however is wrong.
I made the mistake of assuming the same thing initially as well. But at
least Opera has the habit of sending requests across packet boundaries far
too often. In my case though, most requests travel on long-lived HTTP 1.1
keep-alive connections, which might be a trigger for this.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk