393075 1xx 204 and 304 ignore all headers suggesting content
This commit is contained in:
parent
e615504889
commit
eaf65a2902
|
@ -525,7 +525,7 @@ public class HttpParser implements Parser
|
||||||
switch (ho)
|
switch (ho)
|
||||||
{
|
{
|
||||||
case HttpHeaders.CONTENT_LENGTH_ORDINAL:
|
case HttpHeaders.CONTENT_LENGTH_ORDINAL:
|
||||||
if (_contentLength != HttpTokens.CHUNKED_CONTENT && _responseStatus!=304 && _responseStatus!=204 && (_responseStatus<100 || _responseStatus>=200))
|
if (_contentLength != HttpTokens.CHUNKED_CONTENT )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -596,12 +596,17 @@ public class HttpParser implements Parser
|
||||||
}
|
}
|
||||||
_buffer.setMarkIndex(-1);
|
_buffer.setMarkIndex(-1);
|
||||||
|
|
||||||
|
|
||||||
// now handle ch
|
// now handle ch
|
||||||
if (ch == HttpTokens.CARRIAGE_RETURN || ch == HttpTokens.LINE_FEED)
|
if (ch == HttpTokens.CARRIAGE_RETURN || ch == HttpTokens.LINE_FEED)
|
||||||
{
|
{
|
||||||
// work out the _content demarcation
|
// is it a response that cannot have a body?
|
||||||
if (_contentLength == HttpTokens.UNKNOWN_CONTENT)
|
if (_responseStatus > 0 && // response
|
||||||
|
(_responseStatus == 304 || // not-modified response
|
||||||
|
_responseStatus == 204 || // no-content response
|
||||||
|
_responseStatus < 200)) // 1xx response
|
||||||
|
_contentLength=HttpTokens.NO_CONTENT; // ignore any other headers set
|
||||||
|
// else if we don't know framing
|
||||||
|
else if (_contentLength == HttpTokens.UNKNOWN_CONTENT)
|
||||||
{
|
{
|
||||||
if (_responseStatus == 0 // request
|
if (_responseStatus == 0 // request
|
||||||
|| _responseStatus == 304 // not-modified response
|
|| _responseStatus == 304 // not-modified response
|
||||||
|
|
|
@ -44,14 +44,15 @@ public class TomcatServerQuirksTest
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@Ignore("Bug with Transfer-Encoding")
|
public void testTomcat7_0_32_WithTransferEncoding() throws Exception
|
||||||
public void testTomcat7_0_32_WithTransferEncoding() throws Exception {
|
{
|
||||||
DummyServer server = new DummyServer();
|
DummyServer server = new DummyServer();
|
||||||
int bufferSize = 512;
|
int bufferSize = 512;
|
||||||
QueuedThreadPool threadPool = new QueuedThreadPool();
|
QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||||
WebSocketClientFactory factory = new WebSocketClientFactory(threadPool, new ZeroMaskGen(), bufferSize);
|
WebSocketClientFactory factory = new WebSocketClientFactory(threadPool, new ZeroMaskGen(), bufferSize);
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
// Setup Client Factory
|
// Setup Client Factory
|
||||||
|
@ -113,7 +114,9 @@ public class TomcatServerQuirksTest
|
||||||
socket.flush();
|
socket.flush();
|
||||||
|
|
||||||
Assert.assertTrue(dataLatch.await(1000, TimeUnit.SECONDS));
|
Assert.assertTrue(dataLatch.await(1000, TimeUnit.SECONDS));
|
||||||
} finally {
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
factory.stop();
|
factory.stop();
|
||||||
threadPool.stop();
|
threadPool.stop();
|
||||||
server.stop();
|
server.stop();
|
||||||
|
|
Loading…
Reference in New Issue