Commit bc2f0bff authored by Yann Ylavic's avatar Yann Ylavic
Browse files

Merge r1826687, r1827166, r1828210, r1828232, r1828687 from trunk:

Instrument 'bbout'


mod_http2: use proper ARP defined for formatting apr_off_t


On the trunk:

mod_http2: on level trace2, log any unsuccessful HTTP/2 direct connection upgrade
     with base64 encoding to unify its appearance in possible bug reports.


On the trunk:

* mod_http2: calculate unencrypted connection sniffing base64 only when log level is at required height. [Ruediger Pluem]


On the trunk:

mod_http2: accurate reporting of h2 data input/output per request via mod_logio. Fixes
     an issue where output sizes where counted n-times on reused slave connections. See
     gituhub issue: https://github.com/icing/mod_h2/issues/158


Submitted by: jailletc36, icing, icing, icing, icing
Reviewed by: icing, jim, ylavic


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1832489 13f79535-47bb-0310-9956-ffa450edef68
parent c15eb077
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
                                                         -*- coding: utf-8 -*-
Changes with Apache 2.4.34

  *) mod_http2: accurate reporting of h2 data input/output per request via mod_logio. Fixes
     an issue where output sizes where counted n-times on reused slave connections. See
     gituhub issue: https://github.com/icing/mod_h2/issues/158
     [Stefan Eissing]

  *) mod_http2: Fix unnecessary timeout waits in case streams are aborted.
     [Stefan Eissing]

+5 −0
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@ extern const char *H2_MAGIC_TOKEN;
/* Max data size to write so it fits inside a TLS record */
#define H2_DATA_CHUNK_SIZE          ((16*1024) - 100 - 9) 

/* Size of the frame header itself in HTTP/2 */
#define H2_FRAME_HDR_LEN            9
 
/* Maximum number of padding bytes in a frame, rfc7540 */
#define H2_MAX_PADLEN               256
/* Initial default window size, RFC 7540 ch. 6.5.2 */
@@ -137,6 +140,7 @@ struct h2_request {
    apr_time_t request_time;
    unsigned int chunked : 1;   /* iff requst body needs to be forwarded as chunked */
    unsigned int serialize : 1; /* iff this request is written in HTTP/1.1 serialization */
    apr_off_t raw_bytes;        /* RAW network bytes that generated this request - if known. */
};

typedef struct h2_headers h2_headers;
@@ -145,6 +149,7 @@ struct h2_headers {
    int         status;
    apr_table_t *headers;
    apr_table_t *notes;
    apr_off_t   raw_bytes;      /* RAW network bytes that generated this request - if known. */
};

typedef apr_status_t h2_io_data_cb(void *ctx, const char *data, apr_off_t len);
+9 −3
Original line number Diff line number Diff line
@@ -302,8 +302,6 @@ conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent)
    c->log                    = NULL;
    c->log_id                 = apr_psprintf(pool, "%ld-%d", 
                                             master->id, slave_id);
    /* Simulate that we had already a request on this connection. */
    c->keepalives             = 1;
    c->aborted                = 0;
    /* We cannot install the master connection socket on the slaves, as
     * modules mess with timeouts/blocking of the socket, with
@@ -338,6 +336,14 @@ void h2_slave_destroy(conn_rec *slave)

apr_status_t h2_slave_run_pre_connection(conn_rec *slave, apr_socket_t *csd)
{
    if (slave->keepalives == 0) {
        /* Simulate that we had already a request on this connection. Some
         * hooks trigger special behaviour when keepalives is 0. 
         * (Not necessarily in pre_connection, but later. Set it here, so it
         * is in place.) */
        slave->keepalives = 1;
        return ap_run_pre_connection(slave, csd);
    }
    return APR_SUCCESS;
}
+4 −2
Original line number Diff line number Diff line
@@ -290,6 +290,8 @@ apr_bucket *h2_bucket_observer_beam(struct h2_bucket_beam *beam,
    return NULL;
}

static apr_status_t bbout(apr_bucket_brigade *bb, const char *fmt, ...)
                             __attribute__((format(printf,2,3)));
static apr_status_t bbout(apr_bucket_brigade *bb, const char *fmt, ...)
{
    va_list args;
@@ -351,8 +353,8 @@ static int add_stream(h2_stream *stream, void *ctx)
    bbout(x->bb, "    \"created\": %f,\n", ((double)stream->created)/APR_USEC_PER_SEC);
    bbout(x->bb, "    \"flowIn\": %d,\n", flowIn);
    bbout(x->bb, "    \"flowOut\": %d,\n", flowOut);
    bbout(x->bb, "    \"dataIn\": %"APR_UINT64_T_FMT",\n", stream->in_data_octets);  
    bbout(x->bb, "    \"dataOut\": %"APR_UINT64_T_FMT"\n", stream->out_data_octets);  
    bbout(x->bb, "    \"dataIn\": %"APR_OFF_T_FMT",\n", stream->in_data_octets);  
    bbout(x->bb, "    \"dataOut\": %"APR_OFF_T_FMT"\n", stream->out_data_octets);  
    bbout(x->bb, "    }");
    
    ++x->idx;
+5 −1
Original line number Diff line number Diff line
@@ -413,7 +413,7 @@ static apr_status_t pass_response(h2_task *task, ap_filter_t *f,
    
    h2_headers *response = h2_headers_create(parser->http_status, 
                                             make_table(parser),
                                             NULL, task->pool);
                                             NULL, 0, task->pool);
    apr_brigade_cleanup(parser->tmp);
    b = h2_bucket_headers_create(task->c->bucket_alloc, response);
    APR_BRIGADE_INSERT_TAIL(parser->tmp, b);
@@ -772,6 +772,10 @@ apr_status_t h2_filter_request_in(ap_filter_t* f,
                APR_BUCKET_REMOVE(b);
                apr_bucket_destroy(b);
                ap_remove_input_filter(f);
                
                if (headers->raw_bytes && h2_task_logio_add_bytes_in) {
                    h2_task_logio_add_bytes_in(task->c, headers->raw_bytes);
                }
                break;
            }
        }
Loading