Make sure HttpVersion checks if the version string is not empty

.. which was the behavior in 3.x.
This commit is contained in:
Trustin Lee 2013-10-17 20:26:51 +09:00
parent 9600318dc1
commit 762e40f357

View File

@ -55,6 +55,11 @@ public class HttpVersion implements Comparable<HttpVersion> {
}
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<HttpVersion> {
//
// 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();