summaryrefslogtreecommitdiffstats
path: root/modules/http
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>2001-01-24 00:05:12 +0100
committerRyan Bloom <rbb@apache.org>2001-01-24 00:05:12 +0100
commit24ad26fca5de199fd435ef1d9445378f326330f2 (patch)
treedff1fcf2300d7afdd78b86f59941033924ecf9ae /modules/http
parentFix the core to take the new file bucket type into account. (diff)
downloadapache2-24ad26fca5de199fd435ef1d9445378f326330f2.tar.xz
apache2-24ad26fca5de199fd435ef1d9445378f326330f2.zip
Fix the core_output_filter. It doesn't make any sense to send less than
8K of a file using sendfile, it is easier to just read strings from the file and use those strings directly. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87800 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/http')
-rw-r--r--modules/http/http_core.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/http/http_core.c b/modules/http/http_core.c
index 381a740783..2755949da4 100644
--- a/modules/http/http_core.c
+++ b/modules/http/http_core.c
@@ -98,6 +98,8 @@
#define AP_LIMIT_UNSET ((long) -1)
#define AP_DEFAULT_LIMIT_XML_BODY ((size_t)1000000)
+#define AP_MIN_SENDFILE_BYTES (8*1024)
+
/* Server core module... This module provides support for really basic
* server operations, including options and commands which control the
* operation of other modules. Consider this the bureaucracy module.
@@ -3348,13 +3350,15 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b)
if (APR_BUCKET_IS_EOS(e) || APR_BUCKET_IS_FLUSH(e)) {
break;
}
- else if (APR_BUCKET_IS_FILE(e)) {
+ /* It doesn't make any sense to use sendfile for a file bucket
+ * that represents 10 bytes.
+ */
+ else if (APR_BUCKET_IS_FILE(e) && (e->length >= AP_MIN_SENDFILE_BYTES)) {
apr_bucket_shared *s = e->data;
apr_bucket_file *a = s->data;
- /* Assume there is at most one APR_BUCKET_FILE in the brigade */
fd = a->fd;
flen = e->length;
- foffset = a->offset;
+ foffset = s->start;
}
else {
const char *str;