Commit 693252df authored by Ryan Bloom's avatar Ryan Bloom
Browse files

At the hack-athon we decided to change the way that input filters

determine how much data is returned to the previous filter.  Prior to this
change, we used a field in the conn_rec to determine how much to return.
After this change, we use an argument to ap_get_brigade.  This makes it
much more obvious how things work at all levels, so that module authors
can easily determine how much data is supposed to be returned to them.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88912 13f79535-47bb-0310-9956-ffa450edef68
parent 5bc6f1db
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
Changes with Apache 2.0.18-dev

  *) Change how input filters decide how much data is returned to the
     higher filter.  We used to use a field in the conn_rec, with this
     change, we use an argument to ap_get_brigade to determine how much
     data is retrieved. [Ryan Bloom]

  *) Fix seg fault at start-up introduced by Ryan's change to enable
     modules to specify their own logging tags. mod_log_config
     registers an optional function, ap_register_log_handler().
+1 −4
Original line number Diff line number Diff line
@@ -697,7 +697,7 @@ struct request_rec {
    apr_off_t clength;

    /** bytes left to read */
    long remaining;
    apr_size_t remaining;
    /** bytes that have been read */
    long read_length;
    /** how the request body should be read */
@@ -887,9 +887,6 @@ struct conn_rec {
    /** A list of output filters to be used for this connection
     *  @defvar ap_filter_t *filters */
    struct ap_filter_t *output_filters;
    /** The length of the current request body
     *  @defvar long remain */
    long remain;
};

/* Per-vhost config... */
+3 −2
Original line number Diff line number Diff line
@@ -155,7 +155,8 @@ typedef struct ap_filter_t ap_filter_t;
 */
typedef apr_status_t (*ap_out_filter_func)(ap_filter_t *f, apr_bucket_brigade *b);
typedef apr_status_t (*ap_in_filter_func)(ap_filter_t *f, apr_bucket_brigade *b, 
                                          ap_input_mode_t mode);
                                          ap_input_mode_t mode, apr_size_t *readbytes);

typedef union ap_filter_func {
    ap_out_filter_func out_func;
    ap_in_filter_func in_func;
@@ -273,7 +274,7 @@ struct ap_filter_t {
 * @param mode   ::AP_MODE_BLOCKING, ::AP_MODE_NONBLOCKING, or ::AP_MODE_PEEK
 */
AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket, 
                                        ap_input_mode_t mode);
                                        ap_input_mode_t mode, apr_size_t *readbytes);

/**
 * Pass the current bucket brigade down to the next filter on the filter
+3 −3
Original line number Diff line number Diff line
@@ -1005,7 +1005,7 @@ static void transfer_brigade(apr_bucket_brigade *in, apr_bucket_brigade *out)
}

static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb, 
                           ap_input_mode_t mode)
                           ap_input_mode_t mode, apr_size_t *readbytes)
{
    apr_status_t rv;
    charset_req_t *reqinfo = ap_get_module_config(f->r->request_config,
@@ -1049,11 +1049,11 @@ static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb,
    }

    if (ctx->noop) {
        return ap_get_brigade(f->next, bb, mode);
        return ap_get_brigade(f->next, bb, mode, readbytes);
    }

    if (APR_BRIGADE_EMPTY(ctx->bb)) {
        if ((rv = ap_get_brigade(f->next, bb, mode)) != APR_SUCCESS) {
        if ((rv = ap_get_brigade(f->next, bb, mode, readbytes)) != APR_SUCCESS) {
            return rv;
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -749,7 +749,7 @@ static apr_status_t ef_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)

#if 0
static int ef_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, 
                           ap_input_mode_t mode)
                           ap_input_mode_t mode, apr_size_t *readbytes)
{
    apr_status_t rv;
    apr_bucket *b;
@@ -757,7 +757,7 @@ static int ef_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
    apr_ssize_t len;
    char *zero;

    rv = ap_get_brigade(f->next, bb, mode);
    rv = ap_get_brigade(f->next, bb, mode, readbytes);
    if (rv != APR_SUCCESS) {
        return rv;
    }
Loading