Signed-off-by: olivier lamy <olamy@webtide.com>
This commit is contained in:
parent
6b3b59df43
commit
9bc4cd32fc
|
@ -1,6 +1,6 @@
|
|||
#!groovy
|
||||
|
||||
node('linux') {
|
||||
node {
|
||||
// System Dependent Locations
|
||||
def mvntool = tool name: 'maven3', type: 'hudson.tasks.Maven$MavenInstallation'
|
||||
def jdktool = tool name: 'jdk7', type: 'hudson.model.JDK'
|
||||
|
|
|
@ -832,9 +832,10 @@ public class HttpParser
|
|||
case HOST:
|
||||
add_to_connection_trie=_connectionFields!=null && _field==null;
|
||||
_host=true;
|
||||
|
||||
if (_valueString==null || _valueString.length()==0)
|
||||
{
|
||||
throw new BadMessageException(HttpStatus.BAD_REQUEST_400,"Bad Host header");
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
|
|
|
@ -114,7 +114,8 @@ public class DumpHandler extends AbstractHandler
|
|||
String name=headers.nextElement();
|
||||
writer.write(name);
|
||||
writer.write(": ");
|
||||
writer.write(request.getHeader(name));
|
||||
String value = request.getHeader(name);
|
||||
writer.write(value == null?"":value);
|
||||
writer.write("\n");
|
||||
}
|
||||
writer.write("</pre>\n<h3>Parameters:</h3>\n<pre>");
|
||||
|
|
|
@ -24,26 +24,6 @@
|
|||
*/
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpParser;
|
||||
import org.eclipse.jetty.http.MimeTypes;
|
||||
|
@ -56,9 +36,25 @@ import org.hamcrest.Matchers;
|
|||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -335,6 +331,29 @@ public class HttpConnectionTest
|
|||
checkContains(response,0,"HTTP/1.1 400");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoHost()
|
||||
throws Exception
|
||||
{
|
||||
String response;
|
||||
|
||||
response = connector.getResponses( "GET / HTTP/1.1\r\n"
|
||||
+ "\r\n" );
|
||||
checkContains( response, 0, "HTTP/1.1 400" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyHost()
|
||||
throws Exception
|
||||
{
|
||||
String response;
|
||||
|
||||
response = connector.getResponses( "GET / HTTP/1.1\r\n"
|
||||
+ "Host:\r\n"
|
||||
+ "\r\n" );
|
||||
checkContains( response, 0, "HTTP/1.1 200" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBadURIencoding() throws Exception
|
||||
{
|
||||
|
|
|
@ -546,7 +546,7 @@ public class PartialRFC2616Test
|
|||
|
||||
offset=0;
|
||||
response=connector.getResponses("GET /R1 HTTP/1.1\n"+"Host:\n"+"Connection: close\n"+"\n");
|
||||
offset=checkContains(response,offset,"HTTP/1.1 400","400")+1;
|
||||
offset=checkContains(response,offset,"HTTP/1.1 200","200")+1;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1454,7 +1454,7 @@ public abstract class RFC2616BaseTest
|
|||
req4.append("\n");
|
||||
|
||||
HttpTester.Response response = http.request(req4);
|
||||
assertEquals("14.23 HTTP/1.1 - Empty Host", HttpStatus.BAD_REQUEST_400, response.getStatus());
|
||||
assertEquals("14.23 HTTP/1.1 - Empty Host", HttpStatus.OK_200, response.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue