Issue #346 HttpParser RFC2616 Compliance mode
Empty header values returned as "" in all compliance modes
This commit is contained in:
parent
d1fc5eb67d
commit
10bd934476
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue