cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Extending pipelining to non-GET HTTP requests

From: m brandenberg <mcbinc_at_panix.com>
Date: Wed, 20 Aug 2014 12:01:36 -0400 (EDT)

On Mon, 11 Aug 2014, Daniel Stenberg wrote:

> On Fri, 8 Aug 2014, m brandenberg wrote:
>
>> This is a preliminary diff against 7.37.1 just to open discussion. The
> point
>> of this change is to give control to the library user as to which HTTP
>> methods may participate in pipelining rather than assuming that GET is
>> always and only compatible. With this multi option enabled, any request
>> given to the multi handle is presumed safe. Other multi handles are
>> unaffected and default behavior is unchanged from previous releases.
>
> That seems fine to me!

Well, this was looking easy. Simple matter of changing how requests
get queued to a connection. Write some tests and docs. Easy as can
be. Could probably ship this as a bug fix.

And then it blew up in my face. :-) Request body generation is quite
complicated enough due to 2616. But the readfunction scheme doesn't
support the idea of a 'reset' when a request is to be retried and the
body needs to be constructed again. When things are arranged so that
the specific cases where the request body can be generated repeatedly,
then POST/PUT retry work. Making retries work for requests with bodies
will be a good bit of work. An alternative approach would be to never
retry a request with a body: either get a complete HTTP response or
fail the request back to the library caller.

This makes me wonder about response body handling (for GET). A quick
scan didn't reveal the answer but the same issue applies to the
writefunction scheme. If an error occurs after the first callback
(write or even header), there's no way to communicate a 'reset' to the
callbacks and simply retry the GET. The only safe response is to fail
the request back to the caller. Is this, in fact, what happens?

I may look at this again more carefully. My approach would be to avoid
retry of a request with a body. But I'm going to set this aside for
the moment.

m

--
Monty Brandenberg, Software Engineer                               MCB, Inc.
mcbinc_at_panix.com                                             P.O. Box 425292
mcbinc_at_pobox.com                                   Cambridge, MA  02142-0006
617.864.6907
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-08-20