Skip to content

Commit

Permalink
Make sure HttpVersion checks if the version string is not empty
Browse files Browse the repository at this point in the history
.. which was the behavior in 3.x.
  • Loading branch information
trustin committed Oct 17, 2013
1 parent 9600318 commit 762e40f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public static HttpVersion valueOf(String text) {
}

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
Expand All @@ -65,7 +70,7 @@ public static HttpVersion valueOf(String text) {
//
// 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();
Expand Down

0 comments on commit 762e40f

Please sign in to comment.