From f3c3f3e60ce8fde1af45817bff760d69a5676448 Mon Sep 17 00:00:00 2001 From: Ryo Okubo Date: Wed, 8 Jul 2015 01:06:32 +0900 Subject: [PATCH] Allow servers to specify ENABLE_PUSH to 0 explicitly Motivation: If server sends SETTINGS with ENABLE_PUSH, its handled as PROTOCOL_ERROR in spite of the value. But the value specified to 0 may be allowed in RFC7540. Modifications: Check whether ENABLE_PUSH sent from a server is 0 or not. Result: When server specifies ENABLE_PUSH to 0 explicitly, client doesn't handle it as PROTOCOL_ERROR. --- .../handler/codec/http2/DefaultHttp2ConnectionEncoder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java index ad2537f86a..fa71ceebec 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2ConnectionEncoder.java @@ -77,8 +77,9 @@ public class DefaultHttp2ConnectionEncoder implements Http2ConnectionEncoder { Http2HeaderTable outboundHeaderTable = config.headerTable(); Http2FrameSizePolicy outboundFrameSizePolicy = config.frameSizePolicy(); if (pushEnabled != null) { - if (!connection.isServer()) { - throw connectionError(PROTOCOL_ERROR, "Client received SETTINGS frame with ENABLE_PUSH specified"); + if (!connection.isServer() && pushEnabled) { + throw connectionError(PROTOCOL_ERROR, + "Client received a value of ENABLE_PUSH specified to other than 0"); } connection.remote().allowPushTo(pushEnabled); }