W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2002

RE: Problems with data POST (returns -1)

From: Michel Philip <mphilip@infovista.com>
Date: Thu, 24 Jan 2002 05:52:02 -0500 (EST)
Message-ID: <F520B214418AD4119F7000508BD90CC294B98C@hq01sr02.infovista.com>
To: "'www-lib@w3.org'" <www-lib@w3.org>

> For what concerns -1 status return did you tried
>    HTRequest_setOutputStream(request,HTBlackHole());


Sorry,
This is not good for the code that Alik wrote for he calls
'HTPostFormAnchorToChunk()'
Nor for the code that Manuele wrote for he calls 'HTLoadToChunk()'
This was ok for me for I call 'HTLoadAbsolute()'

Then maybe you could find some help with the following.

For what concerns -1 content-length in a repeated request I did many
patches.
First are you sure that the first request really success ?
I mean that if you do 
    HTNet_addAfter(errors_callback, NULL, NULL, HT_ERROR, HT_FILTER_LAST);
then errors_callback() is never called.

Second check if -1 content-length came from HTReader_read.

I've this patch in HTReader:

	    me->b_read = NETREAD(soc, me->data, INPUT_BUFFER_SIZE);
	    if ( me->b_read < 0 ) {
		/* mphilip@infovista.fr */
		me->b_read = 0;

I've also patches in HTMime and HTTP.
For I'm doing: 
            HTNet_setRawBytesCount(net,YES);

I found this obvious issue in HTTPEvent:
(HTTP.c)

        long read_len = HTNet_bytesRead(net);
        long doc_len = HTAnchor_length(anchor);
       ...
        if (HTHost_numberOfOutstandingNetObjects(host) == 1 &&
	    http->result != HT_CONTINUE && (doc_len<0 || doc_len==read_len))
	{
	    HTTPCleanup(request, http->result);		/* Raffaele Sena:
was HT_LOADED */

With rawByteCount mode I understand that HTNet_bytesRead() 
will nether be equals to HTAnchor_length() 
for the second don't count HTTP messages redirections etc...

First in HTMIME_put_block I've changed all the 

		HTNet_addBytesRead(me->net, b-start);
calls with

		if ( !HTNet_rawBytesCount(me->net) ) {
		    HTNet_addBytesRead(me->net, b-start);
		}

and 
		/* philipm@alterm.org: CHANGED 
		   HTNet_setHeaderBytesRead(me->net,
HTNet_bytesRead(me->net));*/
                           HTNet_setHeaderBytesRead(me->net, length - l);

and

	    /*
	    **  If we have more than we need then just take what belongs to
us.
	    */
	    /* philipm@alterm.org: CHANGED 
	    if (bodyRead + l >= cl) {*/
	    if (bodyRead >= cl) {
		/* philipm@alterm.org: CHANGED 
		int consume = cl - bodyRead;*/
		int consume = l;

and

		    /* philipm@alterm.org: */
		    if ( !HTNet_rawBytesCount(net) ) {
			/* mphilip: CHANGED 
			HTNet_addBytesRead(net, consume);*/
			HTNet_addBytesRead(net, l);
		    }
		    /* philipm@alterm.org: CHANGED 
                    HTHost_setConsumed(HTNet_host(net), consume);*/
                    HTHost_setConsumed(HTNet_host(net), l);

and again

		/* philipm@alterm.org: */
		if ( !HTNet_rawBytesCount(net) ) {
		    HTNet_addBytesRead(net, l);
		}



second in HTTPEvent I've changed
        
       long read_len = HTNet_bytesRead(net) - HTNet_headerBytesRead(net); 




I did this because in debug mode in the w3chttp.out file the anchor was
imcompletly dumped.

With these modifications it's well dumped.

But remember I've initially called 

           HTNet_setRawBytesCount(net,YES);

and I don't know time if it is still ok without this
and I have no time to check it.

If you try these changes, please try without rawBytesCount and tell me if
it's ok.

I also have some other changes for -1 returns but it's for HTTPS requests.

Hope this help.

Michel.

 -----Original Message-----
From: 	Michel Philip  
Sent:	Wednesday, January 23, 2002 5:57 PM
To:	'www-lib@w3.org'
Cc:	'alik@witesite.com'; 'rcorell@adobe.com';
'3C4ED77F.1030201@inrialpes.fr'
Subject:	RE: Problems with data POST


Hi,

[...]
 -----

For what concerns -1 status return did you tried


 HTRequest_setOutputStream(request,HTBlackHole());


/mph
Received on Thursday, 24 January 2002 05:57:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:40 GMT