Commit 8d607086 authored by Brian Pane's avatar Brian Pane
Browse files

Moved the extended_status scoreboard update from ap_process_http_connection

to the EOR bucket destructor.  Also, added some defensive code and comments
regarding r->pool lifetime to ap_process_http_connection.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@329664 13f79535-47bb-0310-9956-ffa450edef68
parent dba932d3
Loading
Loading
Loading
Loading
+17 −7
Changes for modules/http/http_core.c: 17 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -125,11 +125,16 @@ static int ap_process_http_async_connection(conn_rec *c)
            if (r->status == HTTP_OK) {
                cs->state = CONN_STATE_HANDLER;
                ap_process_async_request(r);
                /* After the call to ap_process_request, the
                 * request pool may have been deleted.  We set
                 * r=NULL here to ensure that any dereference
                 * of r that might be added later in this function
                 * will result in a segfault immediately instead
                 * of nondeterministic failures later.
                 */
                r = NULL;
            }

            if (ap_extended_status)
                ap_increment_counts(c->sbh, r);

            if (cs->state != CONN_STATE_WRITE_COMPLETION) {
                /* Something went wrong; close the connection */
                cs->state = CONN_STATE_LINGER;
@@ -164,15 +169,20 @@ static int ap_process_http_connection(conn_rec *c)
        if (r->status == HTTP_OK) {
            cs->state = CONN_STATE_HANDLER;
            ap_process_request(r);
            /* After the call to ap_process_request, the
             * request pool will have been deleted.  We set
             * r=NULL here to ensure that any dereference
             * of r that might be added later in this function
             * will result in a segfault immediately instead
             * of nondeterministic failures later.
             */
            r = NULL;
        }

        if (ap_extended_status)
            ap_increment_counts(c->sbh, r);
 
        if (c->keepalive != AP_CONN_KEEPALIVE || c->aborted)
            break;
 
        ap_update_child_status(c->sbh, SERVER_BUSY_KEEPALIVE, r);
        ap_update_child_status(c->sbh, SERVER_BUSY_KEEPALIVE, NULL);
 
        if (ap_graceful_stop_signalled())
            break;
+4 −0
Changes for server/eor_bucket.c: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "httpd.h"
#include "http_request.h"
#include "http_protocol.h"
#include "scoreboard.h"

static apr_status_t eor_bucket_read(apr_bucket *b, const char **str, 
                                    apr_size_t *len, apr_read_type_e block)
@@ -52,6 +53,9 @@ static void eor_bucket_destroy(void *data)
    request_rec *r = (request_rec *)data;
    if (r != NULL) {
        ap_run_log_transaction(r);
        if (ap_extended_status) {
            ap_increment_counts(r->connection->sbh, r);
        }
        apr_pool_destroy(r->pool);
    }
}