From a285deea42fcab60d9edcf994e458c238a348b55 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 17 May 2018 08:00:53 +1000 Subject: [PATCH] Issue #2529 RFC2616 vs RFC7230 cleanup Signed-off-by: Greg Wilkins --- .../org/eclipse/jetty/http/HttpParser.java | 77 ++++--- .../eclipse/jetty/http/HttpParserTest.java | 36 +++- .../org/eclipse/jetty/server/HttpChannel.java | 14 +- .../jetty/server/HttpConnectionTest.java | 202 ++++++++++++++++-- .../jetty/server/PartialRFC2616Test.java | 45 +++- .../jetty/test/rfcs/RFC2616BaseTest.java | 20 +- 6 files changed, 315 insertions(+), 79 deletions(-) diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java index 3a0e2f4319c..29d3cc9826b 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java @@ -18,8 +18,6 @@ package org.eclipse.jetty.http; -import static org.eclipse.jetty.http.HttpTokens.*; - import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; @@ -28,12 +26,16 @@ import org.eclipse.jetty.util.ArrayTernaryTrie; import org.eclipse.jetty.util.ArrayTrie; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.HostPort; -import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.Trie; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import static org.eclipse.jetty.http.HttpTokens.CARRIAGE_RETURN; +import static org.eclipse.jetty.http.HttpTokens.LINE_FEED; +import static org.eclipse.jetty.http.HttpTokens.SPACE; +import static org.eclipse.jetty.http.HttpTokens.TAB; + /* ------------------------------------------------------------ */ /** A Parser for HTTP 0.9, 1.0 and 1.1 @@ -80,6 +82,7 @@ public class HttpParser public static final Logger LOG = Log.getLogger(HttpParser.class); public final static boolean __STRICT=Boolean.getBoolean("org.eclipse.jetty.http.HttpParser.STRICT"); public final static int INITIAL_URI_LENGTH=256; + private final static int MAX_CHUNK_LENGTH=Integer.MAX_VALUE/16-16; /** * Cache of common {@link HttpField}s including: