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 8093eb61dd6..3b56c18e392 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 @@ -1174,7 +1174,7 @@ public class HttpParser { _value=null; _string.setLength(0); - _valueString=_compliance.ordinal()<=HttpCompliance.RFC2616.ordinal()?"":null; + _valueString=""; _length=-1; setState(State.HEADER); diff --git a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java index de60c40b742..62d7723f3a3 100644 --- a/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java +++ b/jetty-http/src/test/java/org/eclipse/jetty/http/HttpParserTest.java @@ -334,9 +334,8 @@ public class HttpParserTest } - @Test - public void test2616NoValue() throws Exception + public void testNoValue() throws Exception { ByteBuffer buffer= BufferUtil.toBuffer( "GET / HTTP/1.0\015\012" + @@ -366,37 +365,6 @@ public class HttpParserTest assertEquals(3, _headers); } - @Test - public void test7230NoValue() throws Exception - { - ByteBuffer buffer= BufferUtil.toBuffer( - "GET / HTTP/1.0\015\012" + - "Host: localhost\015\012" + - "Name0: \015\012"+ - "Name1: \015\012"+ - "Connection: close\015\012" + - "\015\012"); - - HttpParser.RequestHandler handler = new Handler(); - HttpParser parser= new HttpParser(handler); - parseAll(parser,buffer); - - assertTrue(_headerCompleted); - assertTrue(_messageCompleted); - assertEquals("GET", _methodOrVersion); - assertEquals("/", _uriOrStatus); - assertEquals("HTTP/1.0", _versionOrReason); - assertEquals("Host", _hdr[0]); - assertEquals("localhost", _val[0]); - assertEquals("Name0", _hdr[1]); - assertEquals(null, _val[1]); - assertEquals("Name1", _hdr[2]); - assertEquals(null, _val[2]); - assertEquals("Connection", _hdr[3]); - assertEquals("close", _val[3]); - assertEquals(3, _headers); - } - @Test public void testHeaderParseDirect() throws Exception { diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java index dfb2459223b..ec11e9209a9 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java @@ -752,22 +752,20 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu _attributes.setAttribute("org.eclipse.jetty.server.Executor",getServer().getThreadPool()); + if (_mimeTypes == null) + _mimeTypes = new MimeTypes(); + try { - // Set the classloader + // Set the classloader, context and enter scope if (_classLoader != null) { current_thread = Thread.currentThread(); old_classloader = current_thread.getContextClassLoader(); current_thread.setContextClassLoader(_classLoader); } - - if (_mimeTypes == null) - _mimeTypes = new MimeTypes(); - old_context = __context.get(); __context.set(_scontext); - enterScope(null, getState()); // defers the calling of super.doStart() @@ -778,8 +776,8 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu } finally { + exitScope(null); __context.set(old_context); - // reset the classloader if (_classLoader != null && current_thread!=null) current_thread.setContextClassLoader(old_classloader);