Commit 4c5c37eb authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  Cliff's most sane advise :-)


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@89719 13f79535-47bb-0310-9956-ffa450edef68
parent 11c5f3d9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ extern "C" {
 * than that in case the brigade code/filters attempt to read it directly.
 * ### 4mb is an invention, no idea if it is reasonable.
 */
#define AP_MAX_SENDFILE 4194304
#define AP_MAX_SENDFILE 16777216


/*
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ static int asis_handler(request_rec *r)
    if (!r->header_only) {
        apr_off_t start = 0;
        apr_off_t fsize = r->finfo.size;
#ifdef APR_HAS_LARGE_FILES
#if APR_HAS_LARGE_FILES
	/* must split into mutiple send_fd chunks */
        while (fsize > AP_MAX_SENDFILE) {
            ap_send_fd(f, r, start, AP_MAX_SENDFILE, &nbytes);
+14 −10
Original line number Diff line number Diff line
@@ -2918,7 +2918,6 @@ static int default_handler(request_rec *r)
{
    apr_bucket_brigade *bb;
    apr_bucket *e;
    apr_off_t fsize, start;
    core_dir_config *d;
    int errstatus;
    apr_file_t *fd = NULL;
@@ -2997,21 +2996,26 @@ static int default_handler(request_rec *r)
    }

    bb = apr_brigade_create(r->pool);
    fsize = r->finfo.size;
    start = 0;
#ifdef APR_HAS_LARGE_FILES
    while (fsize > AP_MAX_SENDFILE) {
#if APR_HAS_LARGE_FILES
    if (r->finfo.size > AP_MAX_SENDFILE) {
        /* APR_HAS_LARGE_FILES issue; must split into mutiple buckets, 
         * no greater than MAX(apr_size_t), and more granular than that
         * in case the brigade code/filters attempt to read it directly.
         */
        e = apr_bucket_file_create(fd, start, AP_MAX_SENDFILE, r->pool);
        apr_off_t fsize = r->finfo.size;
        e = apr_bucket_file_create(fd, 0, AP_MAX_SENDFILE, r->pool);
        while (fsize > AP_MAX_SENDFILE) {
            APR_BRIGADE_INSERT_TAIL(bb, e);
            apr_bucket_copy(e, &e);
            e->start += AP_MAX_SENDFILE;
            fsize -= AP_MAX_SENDFILE;
        start += AP_MAX_SENDFILE;
        }
        e->length = (apr_size_t)fsize; /* Resize just the last bucket */
    }
    else
#endif
    e = apr_bucket_file_create(fd, start, (apr_size_t)fsize, r->pool);
        e = apr_bucket_file_create(fd, 0, (apr_size_t)r->finfo.size, r->pool);

    APR_BRIGADE_INSERT_TAIL(bb, e);
    e = apr_bucket_eos_create();
    APR_BRIGADE_INSERT_TAIL(bb, e);