Updated tests to use _LEGACY modes
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
30e9c84b33
commit
22beb1d02a
|
@ -68,8 +68,8 @@ public class HttpReceiverOverHTTPTest
|
|||
{
|
||||
return Arrays.asList(
|
||||
new Object[] { HttpCompliance.LEGACY },
|
||||
new Object[] { HttpCompliance.RFC2616 },
|
||||
new Object[] { HttpCompliance.RFC7230 }
|
||||
new Object[] { HttpCompliance.RFC2616_LEGACY },
|
||||
new Object[] { HttpCompliance.RFC7230_LEGACY }
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -242,7 +242,12 @@ public class HttpParser
|
|||
private static HttpCompliance compliance()
|
||||
{
|
||||
Boolean strict = Boolean.getBoolean(__STRICT);
|
||||
return strict?HttpCompliance.LEGACY:HttpCompliance.RFC7230;
|
||||
if (strict)
|
||||
{
|
||||
LOG.warn("Deprecated property used: "+__STRICT);
|
||||
return HttpCompliance.LEGACY;
|
||||
}
|
||||
return HttpCompliance.RFC7230;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------- */
|
||||
|
|
|
@ -120,7 +120,7 @@ public class HttpParserTest
|
|||
ByteBuffer buffer = BufferUtil.toBuffer("GET /999\r\n");
|
||||
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, HttpCompliance.RFC2616);
|
||||
HttpParser parser = new HttpParser(handler, HttpCompliance.RFC2616_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
|
||||
Assert.assertNull(_bad);
|
||||
|
@ -149,7 +149,7 @@ public class HttpParserTest
|
|||
ByteBuffer buffer = BufferUtil.toBuffer("POST /222 \r\n");
|
||||
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, HttpCompliance.RFC2616);
|
||||
HttpParser parser = new HttpParser(handler, HttpCompliance.RFC2616_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
|
||||
Assert.assertNull(_bad);
|
||||
|
@ -264,7 +264,7 @@ public class HttpParserTest
|
|||
"\r\n");
|
||||
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, HttpCompliance.RFC2616);
|
||||
HttpParser parser = new HttpParser(handler, HttpCompliance.RFC2616_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
|
||||
Assert.assertThat(_bad, Matchers.nullValue());
|
||||
|
@ -287,7 +287,7 @@ public class HttpParserTest
|
|||
"\r\n");
|
||||
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, 4096, HttpCompliance.RFC7230);
|
||||
HttpParser parser = new HttpParser(handler, 4096, HttpCompliance.RFC7230_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
|
||||
Assert.assertThat(_bad, Matchers.notNullValue());
|
||||
|
@ -305,7 +305,7 @@ public class HttpParserTest
|
|||
"\r\n");
|
||||
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, 4096, HttpCompliance.RFC7230);
|
||||
HttpParser parser = new HttpParser(handler, 4096, HttpCompliance.RFC7230_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
|
||||
Assert.assertThat(_bad, Matchers.notNullValue());
|
||||
|
@ -322,7 +322,7 @@ public class HttpParserTest
|
|||
"\r\n");
|
||||
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, 4096, HttpCompliance.RFC7230);
|
||||
HttpParser parser = new HttpParser(handler, 4096, HttpCompliance.RFC7230_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
|
||||
Assert.assertThat(_bad, Matchers.notNullValue());
|
||||
|
@ -454,7 +454,7 @@ public class HttpParserTest
|
|||
"\r\n");
|
||||
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler,HttpCompliance.RFC7230);
|
||||
HttpParser parser = new HttpParser(handler,HttpCompliance.RFC7230_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
Assert.assertThat(_bad, Matchers.containsString("Illegal character"));
|
||||
Assert.assertThat(_complianceViolation,Matchers.empty());
|
||||
|
@ -748,7 +748,7 @@ public class HttpParserTest
|
|||
"Connection: close\r\n" +
|
||||
"\r\n");
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, -1, HttpCompliance.RFC7230);
|
||||
HttpParser parser = new HttpParser(handler, -1, HttpCompliance.RFC7230_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
Assert.assertNull(_bad);
|
||||
Assert.assertEquals("GET", _methodOrVersion);
|
||||
|
@ -780,7 +780,7 @@ public class HttpParserTest
|
|||
"cOnNeCtIoN: ClOsE\r\n" +
|
||||
"\r\n");
|
||||
HttpParser.RequestHandler handler = new Handler();
|
||||
HttpParser parser = new HttpParser(handler, -1, HttpCompliance.RFC7230);
|
||||
HttpParser parser = new HttpParser(handler, -1, HttpCompliance.RFC7230_LEGACY);
|
||||
parseAll(parser, buffer);
|
||||
Assert.assertNull(_bad);
|
||||
Assert.assertEquals("GET", _methodOrVersion);
|
||||
|
|
|
@ -104,7 +104,7 @@ public class ExtendedServerTest extends HttpServerTestBase
|
|||
{
|
||||
public ExtendedHttpConnection(HttpConfiguration config, Connector connector, EndPoint endPoint)
|
||||
{
|
||||
super(config,connector,endPoint,HttpCompliance.RFC7230,false);
|
||||
super(config,connector,endPoint,HttpCompliance.RFC7230_LEGACY,false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -245,7 +245,7 @@ public class HttpConnectionTest
|
|||
@Test
|
||||
public void test_0_9() throws Exception
|
||||
{
|
||||
connector.getConnectionFactory(HttpConnectionFactory.class).setHttpCompliance(HttpCompliance.RFC2616);
|
||||
connector.getConnectionFactory(HttpConnectionFactory.class).setHttpCompliance(HttpCompliance.RFC2616_LEGACY);
|
||||
LocalEndPoint endp = connector.executeRequest("GET /R1\n");
|
||||
endp.waitUntilClosed();
|
||||
String response=BufferUtil.toString(endp.takeOutput());
|
||||
|
|
|
@ -110,7 +110,7 @@ public class ComplianceViolations2616Test
|
|||
HttpConfiguration config = new HttpConfiguration();
|
||||
config.setSendServerVersion(false);
|
||||
|
||||
HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(config, HttpCompliance.RFC2616);
|
||||
HttpConnectionFactory httpConnectionFactory = new HttpConnectionFactory(config, HttpCompliance.RFC2616_LEGACY);
|
||||
httpConnectionFactory.setRecordHttpComplianceViolations(true);
|
||||
connector = new LocalConnector(server, null, null, null, -1, httpConnectionFactory);
|
||||
|
||||
|
@ -182,7 +182,7 @@ public class ComplianceViolations2616Test
|
|||
|
||||
String response = connector.getResponse(req1.toString());
|
||||
assertThat("Response status", response, containsString("HTTP/1.1 200"));
|
||||
assertThat("Response headers", response, containsString("X-Http-Violation-0: No line Folding (see https://tools.ietf.org/html/rfc7230#section-3.2.4) in mode RFC2616 for"));
|
||||
assertThat("Response headers", response, containsString("X-Http-Violation-0: No line Folding"));
|
||||
assertThat("Response body", response, containsString("[Name] = [Some Value]"));
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue