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.
This commit is contained in:
Scott Mitchell 2015-07-29 09:32:59 -07:00
parent f3f94bed92
commit 6525240236

View File

@ -306,6 +306,9 @@ final class SpdyCodecUtil {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"name contains null character: " + name); "name contains null character: " + name);
} }
if (c >= 'A' && c <= 'Z') {
throw new IllegalArgumentException("name must be all lower case.");
}
if (c > 127) { if (c > 127) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"name contains non-ascii character: " + name); "name contains non-ascii character: " + name);