From 14e3c2c0d46d17838c0004f3aa762de290863690 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Thu, 17 Oct 2013 20:26:51 +0900 Subject: [PATCH] Make sure HttpVersion checks if the version string is not empty .. which was the behavior in 3.x. --- .../main/java/io/netty/handler/codec/http/HttpVersion.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpVersion.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpVersion.java index 3ef8281c33..1e954dbd74 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpVersion.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpVersion.java @@ -55,6 +55,11 @@ public class HttpVersion implements Comparable { } text = text.trim(); + + if (text.isEmpty()) { + throw new IllegalArgumentException("text is empty"); + } + // Try to match without convert to uppercase first as this is what 99% of all clients // will send anyway. Also there is a change to the RFC to make it clear that it is // expected to be case-sensitive @@ -65,7 +70,7 @@ public class HttpVersion implements Comparable { // // TODO: Remove the uppercase conversion in 4.1.0 as the RFC state it must be HTTP (uppercase) // See https://github.com/netty/netty/issues/1682 - // + HttpVersion version = version0(text); if (version == null) { text = text.toUpperCase();