Merge remote-tracking branch 'origin/master' into jetty-9.1

Conflicts:
	jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java
This commit is contained in:
Greg Wilkins 2013-09-09 17:11:38 +10:00
commit 843e94e4e0
2 changed files with 39 additions and 2 deletions

View File

@ -442,7 +442,7 @@ public class HttpFields implements Iterable<HttpField>
{
final HttpField f = _fields.get(i);
if (f.getName().equalsIgnoreCase(name))
if (f.getName().equalsIgnoreCase(name) && f.getValue()!=null)
{
final int first=i;
return new Enumeration<String>()
@ -458,7 +458,7 @@ public class HttpFields implements Iterable<HttpField>
while (i<_fields.size())
{
field=_fields.get(i++);
if (field.getName().equalsIgnoreCase(name))
if (field.getName().equalsIgnoreCase(name) && field.getValue()!=null)
return true;
}
field=null;

View File

@ -51,6 +51,7 @@ import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.log.StdErrLog;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -58,6 +59,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@ -124,6 +126,41 @@ public class RequestTest
}
@Test
public void testEmptyHeaders() throws Exception
{
_handler._checker = new RequestTester()
{
@Override
public boolean check(HttpServletRequest request,HttpServletResponse response)
{
assertNotNull(request.getLocale());
assertTrue(request.getLocales().hasMoreElements());
assertNull(request.getContentType());
assertNull(request.getCharacterEncoding());
assertEquals(0,request.getQueryString().length());
assertEquals(-1,request.getContentLength());
assertEquals(0,request.getCookies().length);
assertNull(request.getHeader("Name"));
assertFalse(request.getHeaders("Name").hasMoreElements());
assertEquals(-1,request.getDateHeader("Name"));
return true;
}
};
String request="GET /? HTTP/1.1\r\n"+
"Host: whatever\r\n"+
"Connection: close\n"+
"Content-Type: \n"+
"Accept-Language: \n"+
"Cookie: \n"+
"Name: \n"+
"\n";
String responses=_connector.getResponses(request);
assertTrue(responses.startsWith("HTTP/1.1 200"));
}
@Test
public void testMultiPartNoConfig() throws Exception
{