Commit ab03196a authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1800689 from trunk:

On the trunk:

mod_http2: disable and give warning when mpm_prefork is encountered. 
     The server will continue to work, but HTTP/2 will no longer be negotiated.


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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1800774 13f79535-47bb-0310-9956-ffa450edef68
parent 4e70cbb2
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@

Changes with Apache 2.4.27

  *) mod_http2: disable and give warning when mpm_prefork is encountered. The server will
     continue to work, but HTTP/2 will no longer be negotiated. [Stefan Eissing]
  
  *) Allow single-char field names inadvertantly disallowed in 2.4.25.
     PR 61220. [Yann Ylavic]

+0 −6
Original line number Diff line number Diff line
@@ -115,12 +115,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

   *) mod_http2: disable and give warning when prefork is configured. h2 will no longer
                 participate in protocol negotiation, server will continue to work.
     trunk patch: http://svn.apache.org/r1800689
     2.4.x patch:  svn merge -c 1800689 ^/httpd/httpd/trunk .
     +1: icing, ylavic, jim

   *)  htpasswd / htdigest: Do not apply the strict permissions of the temporary
       passwd file to a possibly existing passwd file. PR 61240.
     trunk patch: http://svn.apache.org/r1800594
+20 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ static struct h2_workers *workers;
static h2_mpm_type_t mpm_type = H2_MPM_UNKNOWN;
static module *mpm_module;
static int async_mpm;
static int mpm_supported = 1;
static apr_socket_t *dummy_socket;

static void check_modules(int force) 
@@ -76,11 +77,18 @@ static void check_modules(int force)
            else if (!strcmp("prefork.c", m->name)) {
                mpm_type = H2_MPM_PREFORK;
                mpm_module = m;
                /* While http2 can work really well on prefork, it collides
                 * today's use case for prefork: runnning single-thread app engines
                 * like php. If we restrict h2_workers to 1 per process, php will
                 * work fine, but browser will be limited to 1 active request at a
                 * time. */
                mpm_supported = 0;
                break;
            }
            else if (!strcmp("simple_api.c", m->name)) {
                mpm_type = H2_MPM_SIMPLE;
                mpm_module = m;
                mpm_supported = 0;
                break;
            }
            else if (!strcmp("mpm_winnt.c", m->name)) {
@@ -107,7 +115,6 @@ apr_status_t h2_conn_child_init(apr_pool_t *pool, server_rec *s)
    int idle_secs = 0;

    check_modules(1);
    
    ap_mpm_query(AP_MPMQ_MAX_THREADS, &max_threads_per_child);
    
    status = ap_mpm_query(AP_MPMQ_IS_ASYNC, &async_mpm);
@@ -157,6 +164,18 @@ h2_mpm_type_t h2_conn_mpm_type(void)
    return mpm_type;
}

const char *h2_conn_mpm_name(void)
{
    check_modules(0);
    return mpm_module? mpm_module->name : "unknown";
}

int h2_mpm_supported(void)
{
    check_modules(0);
    return mpm_supported;
}

static module *h2_conn_mpm_module(void)
{
    check_modules(0);
+2 −1
Original line number Diff line number Diff line
@@ -64,7 +64,8 @@ typedef enum {

/* Returns the type of MPM module detected */
h2_mpm_type_t h2_conn_mpm_type(void);

const char *h2_conn_mpm_name(void);
int h2_mpm_supported(void);

conn_rec *h2_slave_create(conn_rec *master, int slave_id, apr_pool_t *parent);
void h2_slave_destroy(conn_rec *slave);
+18 −19
Original line number Diff line number Diff line
@@ -481,9 +481,6 @@ void h2_mplx_release_and_join(h2_mplx *m, apr_thread_cond_t *wait)
    
    H2_MPLX_LEAVE(m);

    /* 5. unregister again, now that our workers are done */
    h2_workers_unregister(m->workers, m);

    ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, m->c,
                  "h2_mplx(%ld): released", m->id);
}
@@ -662,7 +659,7 @@ apr_status_t h2_mplx_reprioritize(h2_mplx *m, h2_stream_pri_cmp *cmp, void *ctx)

static void register_if_needed(h2_mplx *m) 
{
    if (!m->is_registered && !h2_iq_empty(m->q)) {
    if (!m->aborted && !m->is_registered && !h2_iq_empty(m->q)) {
        apr_status_t status = h2_workers_register(m->workers, m); 
        if (status == APR_SUCCESS) {
            m->is_registered = 1;
@@ -755,25 +752,27 @@ static h2_task *next_stream_task(h2_mplx *m)
    return NULL;
}

h2_task *h2_mplx_pop_task(h2_mplx *m, int *has_more)
apr_status_t h2_mplx_pop_task(h2_mplx *m, h2_task **ptask)
{
    h2_task *task = NULL;
    apr_status_t rv = APR_EOF;
    
    H2_MPLX_ENTER_ALWAYS(m);
    *ptask = NULL;
    if (APR_SUCCESS != (rv = apr_thread_mutex_lock(m->lock))) {
        return rv;
    }
    
    *has_more = 0;
    if (!m->aborted) {
        task = next_stream_task(m);
        if (task != NULL && !h2_iq_empty(m->q)) {
            *has_more = 1;
    if (m->aborted) {
        rv = APR_EOF;
    }
    else {
            m->is_registered = 0; /* h2_workers will discard this mplx */
        *ptask = next_stream_task(m);
        rv = (*ptask != NULL && !h2_iq_empty(m->q))? APR_EAGAIN : APR_SUCCESS;
    }
    if (APR_EAGAIN != rv) {
        m->is_registered = 0; /* h2_workers will discard this mplx */
    }

    H2_MPLX_LEAVE(m);
    return task;
    return rv;
}

static void task_done(h2_mplx *m, h2_task *task, h2_req_engine *ngn)
Loading