Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions lib/dispatcher/client-h2.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,29 +312,7 @@ function connectH2 (client, socket) {
}

if (request != null) {
if (client[kRunning] > 0) {
// We are already processing requests

// Unlike HTTP/1.1 pipelining, HTTP/2 multiplexes requests on
// independent streams, so non-idempotent requests can be dispatched
// concurrently. Retry eligibility is handled by stream/session error
// handling instead of by serializing all non-idempotent requests.
// Don't dispatch an upgrade until all preceding requests have completed.
// Possibly, we do not have remote settings confirmed yet.
if ((request.upgrade === 'websocket' || request.method === 'CONNECT') && session[kRemoteSettings] === false) return true
// Request with stream or iterator body can error while other requests
// are inflight and indirectly error those as well.
// Ensure this doesn't happen by waiting for inflight
// to complete before dispatching.

// Request with stream or iterator body cannot be retried.
// Ensure that no other requests are inflight and
// could cause failure.
if (util.bodyLength(request.body) !== 0 &&
(util.isStream(request.body) || util.isAsyncIterable(request.body) || util.isFormDataLike(request.body))) return true
} else {
return (request.upgrade === 'websocket' || request.method === 'CONNECT') && session[kRemoteSettings] === false
}
return (request.upgrade === 'websocket' || request.method === 'CONNECT') && session[kRemoteSettings] === false
}

return false
Expand Down
Loading