From: Jeff Trawick Date: Fri, 25 Oct 2002 15:18:53 +0000 (+0000) Subject: Fix streaming output from an nph- CGI script. CGI:IRC now X-Git-Tag: 2.0.44~222 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5ba424ad04922101c28837d0f9a08c6d8bf70bc;p=apache Fix streaming output from an nph- CGI script. CGI:IRC now works. core output filter needs to detect when no more data is available from a pipe for a while so that it can flush what is already there normally, content-length filter handles this but for nph- script we don't have content-length filter in place PR: 8482 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97301 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 56f7920612..23d0288285 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.44 + *) Fix streaming output from an nph- CGI script. CGI:IRC now + works. PR 8482 [Jeff Trawick] + *) More accurate logging of bytes sent in mod_logio when the client terminates the connection before the response is completely sent [Bojan Smojver ] diff --git a/server/core.c b/server/core.c index e607a75b8f..8cabd7d48e 100644 --- a/server/core.c +++ b/server/core.c @@ -3663,6 +3663,7 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) conn_rec *c = f->c; core_net_rec *net = f->ctx; core_output_filter_ctx_t *ctx = net->out_ctx; + apr_read_type_e eblock = APR_NONBLOCK_READ; if (ctx == NULL) { ctx = apr_pcalloc(c->pool, sizeof(*ctx)); @@ -3738,7 +3739,16 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) const char *str; apr_size_t n; - rv = apr_bucket_read(e, &str, &n, APR_BLOCK_READ); + rv = apr_bucket_read(e, &str, &n, eblock); + if (APR_STATUS_IS_EAGAIN(rv)) { + /* send what we have so far since we shouldn't expect more + * output for a while... next time we read, block + */ + more = apr_brigade_split(b, e); + eblock = APR_BLOCK_READ; + break; + } + eblock = APR_NONBLOCK_READ; if (n) { if (!fd) { if (nvec == MAX_IOVEC_TO_WRITE) {