W3C home > Mailing lists > Public > www-lib@w3.org > July to September 1999

HT_WOULD_BLOCK and streams

From: joe bester <bester@mcs.anl.gov>
Date: Sat, 25 Sep 1999 14:59:40 -0500
Message-Id: <199909251959.OAA27353@pitcairn-9.mcs.anl.gov>
To: www-lib@w3.org
I'm implementing an application level-stream on top of the libwww
interface.  I've found that if I return HT_WOULD_BLOCK from the
put_block method, then the stream will not be sent any more data.

In particular, I am initializing the request like this:

    request = HTRequest_new();
    HTRequest_addRange(request, "bytes", "0-1,1-2,2-3,3-4,4-5,5-6,6-7");
    HTRequest_setPreemptive(request, YES);

    rc = HTLoadToStream(url, stream, request);

The test_stream alternately returns HT_WOULD_BLOCK and HT_OK.

I've tried modifying the HTReader_read method to continue through
the loop if the net->readStream->isa->put_block returns HT_WOULD_BLOCK.
This has the effect of making all of the byte ranges get sent to my
stream, respecting my HT_WOULD_BLOCK responses.

However, if I do block, then I have a problem after I receive the last
byte range. The HTReader_read loops through one extra time through
the read loop, causing it to block until the http server closes the

Is there a way to have a stream block and still get all of the data
aimed at it?

Thanks for any help,
Joseph Bester                               Phone: (630) 252-1496
Mathematics & Computer Science                Fax: (630) 252-5986
Argonne National Laboratory             Email: bester@mcs.anl.gov
Argonne, IL 60439
Received on Saturday, 25 September 1999 15:59:41 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:52 UTC