httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: IOL and send_fb
Date Sun, 15 Aug 1999 22:04:22 GMT
On Sun, 15 Aug 1999, Ben Laurie wrote:

> There's this rather optimistic note in MPM that suggests we reimplement
> send_fb (or, more particularly, send_fb_length). Snag is, it used to use
> select(). Someone thinks it might now use poll(). But it can't really
> use either, because of IOL. It also tries to use non-blocking I/O.
> Again, IOL is a bit of a barrier. Does anyone have an ingenious plan
> here, or is it simply a matter of extending IOL until this can work?
> That is, does IOL have to support non-blocking IOLs and some kind of
> IOLpoll?

nope... you just need to toggle between using a timeout of 0 on the
cgi, and a timeout of whatever the Timeout value is set to.

something like this (with absolutely no apologies for the gotos):

    long timeout;

    goto enter;
    for (;;) {
	rc = ap_bread(fb, buf, sizeof(buf));
again:
	if (rc <= 0) {
	    if (rc == 0) {
		/* done, flush, return */
	    }
	    if (rc == -1 && errno != EAGAIN) {
		error handling;
	    }
	    /* next read will block, so flush client now */
	    rc = ap_bflush(conn->client);
	    /* deal with rc errors here */
	    /* block reading until timeout */
	    timeout = value of Timeout for this request;
	    ap_bsetopt(fb, BO_TIMEOUT, &timeout);
	    rc = ap_bread(fb, buf, sizeof(buf));
enter:
	    timeout = 0;
	    ap_bsetopt(fb, BO_TIMEOUT, &timeout);
	    goto again;
	}
	loop calling ap_bwrite(conn->client, buf, rc) until it's all written;
    }

> Until this happens, CGI doesn't work, and that's a rather large hole in
> MPM.

we still need process abstraction to help CGIs...

Dean


Mime
View raw message