public virtual bool PrepareUpgradeResponse(IChannelHandlerContext ctx, IFullHttpRequest upgradeRequest, HttpHeaders headers) { try { // Decode the HTTP2-Settings header and set the settings on the handler to make // sure everything is fine with the request. var upgradeHeaders = upgradeRequest.Headers.GetAll(Http2CodecUtil.HttpUpgradeSettingsHeader); var upgradeHeadersCount = upgradeHeaders.Count; if (upgradeHeadersCount <= 0 || upgradeHeadersCount > 1) { ThrowHelper.ThrowArgumentException_MustOnlyOne(); } _settings = DecodeSettingsHeader(ctx, upgradeHeaders[0]); // Everything looks good. return(true); } catch (Exception cause) { if (Logger.InfoEnabled) { Logger.ErrorDuringUpgradeToHTTP2(cause); } return(false); } }