From 65252402366cc21ae68df2c2ab94d1850f8b85d7 Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Wed, 29 Jul 2015 09:32:59 -0700 Subject: [PATCH] SPDY codec must check headers are lower case Motivation: The SPDY spec requires that all header names be lowercase (see https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1#TOC-3.2-HTTP-Request-Response). The SPDY codec header name validator does not enforce this requirement. Modifications: - SpdyCodecUtil.validateHeaderName should check for upper case characters and throw an error if any are found. Result: SPDY codec header validation enforces specification requirement. --- .../main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java index 41c64d2a8d..e572bfe13d 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java +++ b/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyCodecUtil.java @@ -306,6 +306,9 @@ final class SpdyCodecUtil { throw new IllegalArgumentException( "name contains null character: " + name); } + if (c >= 'A' && c <= 'Z') { + throw new IllegalArgumentException("name must be all lower case."); + } if (c > 127) { throw new IllegalArgumentException( "name contains non-ascii character: " + name);