You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2008/10/27 12:39:04 UTC
svn commit: r708144 - /httpd/httpd/trunk/server/core_filters.c
Author: rpluem
Date: Mon Oct 27 04:39:04 2008
New Revision: 708144
URL: http://svn.apache.org/viewvc?rev=708144&view=rev
Log:
* Do more greedy reads in the core input filter to get more closer to the
number of bytes requested.
Modified:
httpd/httpd/trunk/server/core_filters.c
Modified: httpd/httpd/trunk/server/core_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/core_filters.c?rev=708144&r1=708143&r2=708144&view=diff
==============================================================================
--- httpd/httpd/trunk/server/core_filters.c (original)
+++ httpd/httpd/trunk/server/core_filters.c Mon Oct 27 04:39:04 2008
@@ -267,6 +267,37 @@
return APR_SUCCESS;
}
+ /* Have we read as much data as we wanted (be greedy)? */
+ if (len < readbytes) {
+ apr_size_t bucket_len;
+
+ rv = APR_SUCCESS;
+ /* We already registered the data in e in len */
+ e = APR_BUCKET_NEXT(e);
+ while ((len < readbytes) && (rv == APR_SUCCESS)
+ && (e != APR_BRIGADE_SENTINEL(ctx->b))) {
+ /* Check for the availability of buckets with known length */
+ if (e->length != -1) {
+ len += e->length;
+ e = APR_BUCKET_NEXT(e);
+ }
+ else {
+ /*
+ * Read from bucket, but non blocking. If there isn't any
+ * more data, well than this is fine as well, we will
+ * not wait for more since we already got some and we are
+ * only checking if there isn't more.
+ */
+ rv = apr_bucket_read(e, &str, &bucket_len,
+ APR_NONBLOCK_READ);
+ if (rv == APR_SUCCESS) {
+ len += bucket_len;
+ e = APR_BUCKET_NEXT(e);
+ }
+ }
+ }
+ }
+
/* We can only return at most what we read. */
if (len < readbytes) {
readbytes = len;
AW: svn commit: r708144 - /httpd/httpd/trunk/server/core_filters.c
Posted by "Plüm, Rüdiger, VF-Group" <ru...@vodafone.com>.
> -----Ursprüngliche Nachricht-----
> Von: Paul Querna
> Gesendet: Dienstag, 28. Oktober 2008 04:35
> An: dev@httpd.apache.org
> Cc: cvs@httpd.apache.org
> Betreff: Re: svn commit: r708144 -
> /httpd/httpd/trunk/server/core_filters.c
>
> rpluem@apache.org wrote:
> > Author: rpluem
> > Date: Mon Oct 27 04:39:04 2008
> > New Revision: 708144
> >
> > URL: http://svn.apache.org/viewvc?rev=708144&view=rev
> > Log:
> > * Do more greedy reads in the core input filter to get more
> closer to the
> > number of bytes requested.
>
> Curious what you were seeing that this was needed?
>
> Something funky with event or one of the other MPMs?
Neither. There is a situation in the proxy where we are willing
to read large chunks of the backend response (ProxyIOBuffersize)
at once but could't do this. An apr_bucket_read from a socket bucket
delivers at most 8000 bytes regardless if there is more data available
to read in the TCP buffers.
Regards
Rüdiger
Re: svn commit: r708144 - /httpd/httpd/trunk/server/core_filters.c
Posted by Paul Querna <ch...@force-elite.com>.
rpluem@apache.org wrote:
> Author: rpluem
> Date: Mon Oct 27 04:39:04 2008
> New Revision: 708144
>
> URL: http://svn.apache.org/viewvc?rev=708144&view=rev
> Log:
> * Do more greedy reads in the core input filter to get more closer to the
> number of bytes requested.
Curious what you were seeing that this was needed?
Something funky with event or one of the other MPMs?
Thanks,
Paul