cURL / Mailing Lists / curl-library / Single Mail

curl-library

Pausing pipeline problems.

From: Justin Skists <j.skists_at_googlemail.com>
Date: Mon, 20 Jul 2009 10:47:13 +0100

Hi,

As part of a project, I'd like to be able to HTTP Pipelining with pausing
(using CURL_WRITEFUNC_PAUSE) when the requests buffer is full. However, i'm
getting the wrong handle returned to me when I resume the transfer. Assuming
that my understanding on Pipeling is correct, I'd be greatful if someone
could tell me why it doesn't seem to be working properly.

The sequence goes like this:

create multi-handle set up for pipelining
 . . .
create request for file #1
create request for file #2
add curl handle for file #1 to the multi-handle
add curl handle for file #2 to the multi-handle
 . . .
data is retrieved for file #1
pausing data for file #1
 . . .
resume transfer for file #1
data for file #1 is retrieved but the handle is for request #2...oops! (as
shown for the user-pointer on the callback function).

I have written a small test app to show this behaviour. The test files are
binary files that loop from 0x00 to 0xff for 128kilobytes, that I can use
for predictable byte patterns for these transfers (and can be provided on
request, as I don't want to add binary files to a mailing list, but
retreiving any files from the same server will show the problem).

As you can see from the output included below, request[0x696c38] is for file
#1, but when the data transfer is resumed after a pause, the resumed data
for file #1 is sent to the callback for request[0x6a33f8].

I enclose the demo and Makefile, compiled against the curl-7.19.5 tar-ball
on Cygwin, and the output is shown below.

Here's hoping you can help out,
Justin.

$ ./pipeline_pause.exe
adding http://192.168.131.65/test_dat/seq_data_1.bin
creating curl handle for: GET http://192.168.131.65/test_dat/seq_data_1.bin
send_request: created request[0x696c38] (curl 0x69ac58)
adding http://192.168.131.65/test_dat/seq_data_2.bin
creating curl handle for: GET http://192.168.131.65/test_dat/seq_data_2.bin
send_request: created request[0x6a33f8] (curl 0x6a7418)
== Info: About to connect() to 192.168.131.65 port 80 (#0)
== Info: Trying 192.168.131.65... == Info: Re-using existing connection!
(#0) with host 192.168.131.65
== Info: Connected to 192.168.131.65 (192.168.131.65) port 80 (#0)
=> Send header (76 bytes)
<= Recv header (17 bytes)
<= Recv header (37 bytes)
<= Recv header (60 bytes)
<= Recv header (46 bytes)
<= Recv header (35 bytes)
<= Recv header (22 bytes)
<= Recv header (24 bytes)
<= Recv header (40 bytes)
<= Recv header (2 bytes)
<= Recv data (8477 bytes)
callback_content: entered for request[0x696c38] - size 8477
00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ....
callback_content: data added to buffer...
<= Recv data (8760 bytes)
callback_content: entered for request[0x696c38] - size 8760
1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c ....
callback_content: buffer full for request[0x696c38] - pausing...
buffer now empty, shall resume request 0x696c38
curl_thread_checkForReleaseOrResume: unpausing request 0x696c38...
callback_content: entered for request[0x6a33f8] - size 8760
1d 1e 1f 20 21 22 23 24 25 26 27 28 29 2a 2b 2c ....

  • application/octet-stream attachment: Makefile
Received on 2009-07-20