• Carlo Cannas's avatar
    Allow PRIORITY frames on closed streams · ff9c9e2e
    Carlo Cannas authored
    Currently Varnish doesn't allow PRIORITY frames to be received on closed
    streams: it treats it as a protocol violation and replies with a GOAWAY.
    
    This is not spec compliant, rfc7540 states:
    
    The PRIORITY frame can be sent for a stream in the "idle" or "closed"
    state.
    rfc7540,l,1947,1948
    
    The PRIORITY frame can be sent on a stream in any state
    rfc7540,l,1938,1938
    
    https://tools.ietf.org/html/rfc7540#section-6.3
    
    This behaviour can be triggered by real-world browsers: Chrome 69 has been
    observed sending PRIORITY frames which are received by Varnish after a stream
    has been closed (and cleaned by h2_sweep). When that happens the connection is
    closed and Chrome aborts the loading of all the resources which started to
    load on that connection.
    
    This commit solves the issue by avoiding all the stream creation code and its
    checks to be performed when a PRIORITY frame is received.
    This moves all the stream creation logic inside h2_rx_headers, the only other
    frame which is allowed on idle streams.
    
    This also fixes the concurrent streams counter and highest_stream: they should
    be updated only when a stream enters the "open" state (or "reserved" if
    Varnish used served push) but currently a PRIORITY frame on an idle stream
    affects them.
    
    https://tools.ietf.org/html/rfc7540#section-5.1.1
    rfc7540,l,1153,1156
    rfc7540,l,1193,1198
    rfc7540,l,1530,1533
    
    Fixes: #2775
    ff9c9e2e
r02775.vtc 339 Bytes