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

libwww.a 4.0 problems

From: Chris Bloom <bloom@aladdin.genmagic.com>
Date: Thu, 11 Jan 1996 06:20:29 -0800
Message-Id: <9601110620.ZM4794@aladdin.genmagic.com>
To: www-lib@w3.org
I have run into some problems using the library on an sgi in non-blocking mode
from within a firewall using socks.  Any pointers to other experiences, papers,
docs, etc related to using the library in nonblocking with socks would be
appreciated.

PROBLEM #1: If the nonblocking connect using HTDoConnect() has not really
connected by the time select is called using HTEvent_Loop() then select never
wakes up.   My workaround is a sleep() between  HTLoad() and my return back
into HTEvent_Loop().  This works most of the time but is not guaranteed since
it may take longer for a site to actually connect.   I believe this is a
socks/sockets problem on Solaris which is what we are using to run the socks
daemon.

PROBLEM #2: For a specific request only calls the nonblocking read once.
 Whatever has been written to the socket by the remote server is read by the
library in HTSocketRead() which pushes it down the stream.   The stream returns
a status which in my case is HT_OK.  This seems like the right thing for my
callback to do, right?  However the status on returning from the stream push
code is 2999.  This results in the "stream specific return code" (shown below)
being executed which return the status.  I tried returning HT_WOULD_BLOCK from
my stream callback but that did not work since that block of code (also shown
below) would unregister the socket.   So currently my fix is to continue
returning HT_OK from my stream callback which results the execution of the
"Stream specific return code" which I have hacked to return HT_WOULD_BLOCK.  Am
I doing something wrong.  Is this really a bug in the library.  And would this
be the cause of PROBLEM #3 described below?

	/* Now push the data down the stream */
	if ((status = (*target->isa->put_block)(target, isoc->buffer,
						b_read)) != HT_OK) {
	    if (status==HT_WOULD_BLOCK) {
		if (PROT_TRACE)
		    TTYPrint(TDEST, "Read Socket. Target WOULD BLOCK\n");
		HTEvent_UnRegister(isoc->sockfd, FD_READ);
		return HT_WOULD_BLOCK;
	    } else if (status>0) {	      /* Stream specific return code */
		if (PROT_TRACE)
		    TTYPrint(TDEST, "Read Socket. Target returns %d\n",status);
		isoc->write = isoc->buffer + b_read;
		/* return status; */
My fix ---->	return HT_WOULD_BLOCK;
	    } else {				     /* We have a real error */
		if (PROT_TRACE)
		    TTYPrint(TDEST, "Read Socket. Target ERROR\n");
		return status;
	    }
	}

PROBLEM #3:  The URL http://www.pathfinder.com is a redirect.  This is not
handled properly in non-blocking mode.  I am currently working on this.  What
happens is that I am returned the empty page from the result of the redirect
than the library goes on to call the site specified by the redirect and never
calls me back.  Any info on this would be appreciated.
Received on Thursday, 11 January 1996 09:21:04 GMT

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