Commit bf06fc8d authored by Stefan Eissing's avatar Stefan Eissing
Browse files

Merge of r1757985,r1758003 from trunk

mod_http2: fixed bug in stream shutdown, support for nghttp2 invalid header callback from 1.14.0 and onwards.



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

Changes with Apache 2.4.24

  *) mod_http2: if configured with nghttp2 1.14.0 and onward, invalid request
     headers will immediately reset the stream with a PROTOCOL error. Feature
     logged by module on startup as 'INVHD' in info message.
     [Stefan Eissing]
     
  *) mod_http2: fixed handling of stream buffers during shutdown.
     [Stefan Eissing]
     
  *) mod_reqtimeout: Fix body timeout disabling for CONNECT requests to avoid
     triggering mod_proxy_connect's AH01018 once the tunnel is established.
     [Yann Ylavic]
+3 −0
Original line number Diff line number Diff line
@@ -154,6 +154,9 @@ dnl # nghttp2 >= 1.3.0: access to stream weights
dnl # nghttp2 >= 1.5.0: changing stream priorities
      AC_CHECK_FUNCS([nghttp2_session_change_stream_priority], 
        [APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_CHANGE_PRIO"])], [])
dnl # nghttp2 >= 1.14.0: invalid header callback
      AC_CHECK_FUNCS([nghttp2_session_callbacks_set_on_invalid_header_callback], 
        [APR_ADDTO(MOD_CPPFLAGS, ["-DH2_NG2_INVALID_HEADER_CB"])], [])
    else
      AC_MSG_WARN([nghttp2 version is too old])
    fi
+17 −0
Original line number Diff line number Diff line
@@ -550,6 +550,11 @@ apr_status_t h2_beam_shutdown(h2_bucket_beam *beam, apr_read_type_e block,
        if (clear_buffers) {
            r_purge_reds(beam);
            h2_blist_cleanup(&beam->red);
            if (!bl.mutex && beam->green) {
                /* not protected, may process green in red call */
                apr_brigade_destroy(beam->green);
                beam->green = NULL;
            }
        }
        beam_close(beam);
        
@@ -984,6 +989,18 @@ int h2_beam_empty(h2_bucket_beam *beam)
    return empty;
}

int h2_beam_holds_proxies(h2_bucket_beam *beam)
{
    int has_proxies = 1;
    h2_beam_lock bl;
    
    if (enter_yellow(beam, &bl) == APR_SUCCESS) {
        has_proxies = !H2_BPROXY_LIST_EMPTY(&beam->proxies);
        leave_yellow(beam, &bl);
    }
    return has_proxies;
}

int h2_beam_closed(h2_bucket_beam *beam)
{
    return beam->closed;
+7 −0
Original line number Diff line number Diff line
@@ -272,6 +272,13 @@ int h2_beam_closed(h2_bucket_beam *beam);
 */
int h2_beam_empty(h2_bucket_beam *beam);

/**
 * Determine if beam has handed out proxy buckets that are not destroyed. 
 * 
 * Call from red or green side.
 */
int h2_beam_holds_proxies(h2_bucket_beam *beam);

/**
 * Abort the beam. Will cleanup any buffered buckets and answer all send
 * and receives with APR_ECONNABORTED.
+13 −6
Original line number Diff line number Diff line
@@ -197,15 +197,19 @@ static int purge_stream(void *ctx, void *val)
    h2_mplx *m = ctx;
    h2_stream *stream = val;
    int stream_id = stream->id;
    h2_task *task = h2_ihash_get(m->tasks, stream_id);
    h2_task *task;

    h2_ihash_remove(m->spurge, stream_id);
    h2_stream_destroy(stream);
    /* stream_cleanup clears all buffers and destroys any buckets
     * that might hold references into task space. Needs to be done
     * before task destruction, otherwise it will complain. */
    h2_stream_cleanup(stream);
    
    task = h2_ihash_get(m->tasks, stream_id);    
    if (task) {
        task_destroy(m, task, 1);
    }
    /* FIXME: task_destroy() might in some twisted way place the
     * stream in the spurge hash again. Remove it last. */
    
    h2_stream_destroy(stream);
    h2_ihash_remove(m->spurge, stream_id);
    return 0;
}
@@ -373,7 +377,10 @@ static void task_destroy(h2_mplx *m, h2_task *task, int called_from_master)
        if (status != APR_SUCCESS){
            ap_log_cerror(APLOG_MARK, APLOG_WARNING, status, m->c, 
                          APLOGNO(03385) "h2_task(%s): output shutdown "
                          "incomplete", task->id);
                          "incomplete, beam empty=%d, holds proxies=%d", 
                          task->id,
                          h2_beam_empty(task->output.beam),
                          h2_beam_holds_proxies(task->output.beam));
        }
    }
    
Loading