413066 SPDY HEAD requests don't send response body anymore
This commit is contained in:
parent
7b162460d7
commit
b858f266d6
|
@ -29,6 +29,7 @@ import org.eclipse.jetty.http.HttpField;
|
|||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpGenerator;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
import org.eclipse.jetty.http.HttpVersion;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
|
@ -116,7 +117,10 @@ public class HttpTransportOverSPDY implements HttpTransport
|
|||
// info!=null content!=null lastContent==false reply, commit with content
|
||||
// info!=null content!=null lastContent==true reply, commit with content and complete
|
||||
|
||||
boolean hasContent = BufferUtil.hasContent(content);
|
||||
short version = stream.getSession().getVersion();
|
||||
boolean hasContent = BufferUtil.hasContent(content) && HttpMethod.HEAD.name().equals(requestHeaders.get
|
||||
(HTTPSPDYHeader
|
||||
.METHOD.name(version)));
|
||||
|
||||
if (info != null)
|
||||
{
|
||||
|
@ -128,7 +132,6 @@ public class HttpTransportOverSPDY implements HttpTransport
|
|||
LOG.warn("Committed response twice.", exception);
|
||||
return;
|
||||
}
|
||||
short version = stream.getSession().getVersion();
|
||||
Fields headers = new Fields();
|
||||
|
||||
HttpVersion httpVersion = HttpVersion.HTTP_1_1;
|
||||
|
|
|
@ -62,6 +62,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
||||
{
|
||||
|
@ -213,6 +214,7 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
|||
assertEquals("HEAD", httpRequest.getMethod());
|
||||
assertEquals(path, target);
|
||||
assertEquals(path, httpRequest.getRequestURI());
|
||||
httpResponse.getWriter().write("body that shouldn't be sent on a HEAD request");
|
||||
handlerLatch.countDown();
|
||||
}
|
||||
}), null);
|
||||
|
@ -229,6 +231,12 @@ public class ServerHTTPSPDYTest extends AbstractHTTPSPDYTest
|
|||
assertTrue(replyHeaders.get(HTTPSPDYHeader.STATUS.name(version)).value().contains("200"));
|
||||
replyLatch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onData(Stream stream, DataInfo dataInfo)
|
||||
{
|
||||
fail("HEAD request shouldn't send any data");
|
||||
}
|
||||
});
|
||||
assertTrue(handlerLatch.await(5, TimeUnit.SECONDS));
|
||||
assertTrue(replyLatch.await(5, TimeUnit.SECONDS));
|
||||
|
|
Loading…
Reference in New Issue