Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2014-02-17 01:32:28 +0000
committerGreg Wilkins2014-02-17 01:32:28 +0000
commit1f02dfc24f51f2533ba1be272ccc5b3ad7ddee6c (patch)
tree8a6b7004261f6a7b6aeba6f318bbeca63e6a4633
parentd83cb54db23270a4d8ba38be39db0166a0ee1885 (diff)
downloadorg.eclipse.jetty.project-1f02dfc24f51f2533ba1be272ccc5b3ad7ddee6c.tar.gz
org.eclipse.jetty.project-1f02dfc24f51f2533ba1be272ccc5b3ad7ddee6c.tar.xz
org.eclipse.jetty.project-1f02dfc24f51f2533ba1be272ccc5b3ad7ddee6c.zip
428238 Test HEAD request with async IO
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java
index 4102b47458..55b0ffcd2e 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java
@@ -546,6 +546,21 @@ public class HttpOutputTest
assertThat(response,Matchers.not(containsString("Content-Length")));
assertThat(response,containsString("400\tThis is a big file"));
}
+
+ @Test
+ public void testAsyncWriteBufferLargeHEAD() throws Exception
+ {
+ final Resource big = Resource.newClassPathResource("simple/big.txt");
+ _handler._writeLengthIfKnown=false;
+ _handler._content=BufferUtil.toBuffer(big,false);
+ _handler._byteBuffer=BufferUtil.allocate(8192);
+ _handler._async=true;
+
+ String response=_connector.getResponses("HEAD / HTTP/1.0\nHost: localhost:80\n\n");
+ assertThat(response,containsString("HTTP/1.1 200 OK"));
+ assertThat(response,Matchers.not(containsString("Content-Length")));
+ assertThat(response,Matchers.not(containsString("400\tThis is a big file")));
+ }
@Test
public void testAsyncWriteSimpleKnown() throws Exception
@@ -562,6 +577,22 @@ public class HttpOutputTest
assertThat(response,containsString("Content-Length: 11"));
assertThat(response,containsString("simple text"));
}
+
+ @Test
+ public void testAsyncWriteSimpleKnownHEAD() throws Exception
+ {
+ final Resource big = Resource.newClassPathResource("simple/simple.txt");
+
+ _handler._async=true;
+ _handler._writeLengthIfKnown=true;
+ _handler._content=BufferUtil.toBuffer(big,false);
+ _handler._arrayBuffer=new byte[4000];
+
+ String response=_connector.getResponses("HEAD / HTTP/1.0\nHost: localhost:80\n\n");
+ assertThat(response,containsString("HTTP/1.1 200 OK"));
+ assertThat(response,containsString("Content-Length: 11"));
+ assertThat(response,Matchers.not(containsString("simple text")));
+ }
static class ContentHandler extends AbstractHandler
{

Back to the top