Re: libwww flow control?

Henrik Frystyk Nielsen wrote:

> !>      I do something similar on Win98, sending one request only when the
> !>      previous terminates, and I get the error too, but I cannot figure
> !>      out what's going on (some sites always generate the error, some
> !>      sites don't).

Now I see what is going on - the problem is with old HTTP/1.0 server
which don't send any content length header field in the response. Libwww
mistook this as the connection being closed prematurely - in fact the
download work out just fine.

Try this patch - it also allows Mikhail Grouchinski to figure out how
many requests are active/pending on a host object :)

--
Henrik Frystyk Nielsen,
World Wide Web Consortium
http://www.w3.org/People/Frystyk
Index: Library/src/HTHost.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTHost.c,v
retrieving revision 2.59
diff -r2.59 HTHost.c
1223a1224,1233
> PUBLIC int HTHost_numberOfOutstandingNetObjects (HTHost * host)
> {
>     return host ? HTList_count(host->pipeline) : -1;
> }
> 
> PUBLIC int HTHost_numberOfPendingNetObjects (HTHost * host)
> {
>     return host ? HTList_count(host->pending) : -1;
> }
> 
Index: Library/src/HTHost.html
===================================================================
RCS file: /sources/public/libwww/Library/src/HTHost.html,v
retrieving revision 2.26
diff -r2.26 HTHost.html
427a428,437
>   How many Pending and Outstanding Net objects are there on a Host?
> </H3>
> <P>
> You can query how many Het objects (essentially requests) are outstanding
> or pending on a host object using these methods:
> <PRE>
> extern int HTHost_numberOfOutstandingNetObjects (HTHost * host);
> extern int HTHost_numberOfPendingNetObjects (HTHost * host);
> </PRE>
> <H3>
Index: Library/src/HTTP.c
===================================================================
RCS file: /sources/public/libwww/Library/src/HTTP.c,v
retrieving revision 1.178
diff -r1.178 HTTP.c
25a26
> #include "HTNetMan.h"
990,992c991,1006
< 	HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
< 			   NULL, 0, "HTLoadHTTP");
< 	HTTPCleanup(request, HT_INTERRUPTED);
---
>         long read_len = HTNet_bytesRead(net);
>         long doc_len = HTAnchor_length(anchor);
> 
>         /*
>         ** It is OK to get a close if a) we don't pipeline and b)
>         ** we have the expected amount of data. In case we don't
>         ** know how much data to expect, we must accept it asis.
>         */
>         if (HTHost_numberOfOutstandingNetObjects(host) == 1 &&
>             (doc_len<0 || doc_len==read_len)) {
> 	    HTTPCleanup(request, HT_LOADED);
>         } else {
>             HTRequest_addError(request, ERR_FATAL, NO, HTERR_INTERRUPTED,
> 			       NULL, 0, "HTLoadHTTP");
> 	    HTTPCleanup(request, HT_INTERRUPTED);
>         }

Received on Friday, 26 February 1999 10:37:31 UTC