306782 Do not skip content if 100 not sent, but content available
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1416 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
2dc0ae0546
commit
b12bdbc06e
|
@ -4,6 +4,7 @@ jetty-7.0.2.SNAPSHOT
|
|||
+ 306840 Suppress content-length in requests with no content
|
||||
+ 306880 Support for UPGRADE in HttpClient
|
||||
+ 306884 Suspend with timeout <=0 never expires
|
||||
+ 306782 Don't skip content if 100 not sent, but content available
|
||||
|
||||
jetty-7.0.2.RC0
|
||||
+ JSON parses NaN as null
|
||||
|
|
|
@ -638,11 +638,23 @@ public class HttpConnection implements Connection
|
|||
|
||||
if (_expect100Continue)
|
||||
{
|
||||
// Continue not sent so don't parse any content
|
||||
// We didn't send a 100 continues, but if there is
|
||||
// content, then the client obviously ignored us and
|
||||
// we need to read it. If there is no content, then
|
||||
// we should not expect any to arrive and should skip
|
||||
// it
|
||||
_expect100Continue = false;
|
||||
if (_parser instanceof HttpParser)
|
||||
{
|
||||
HttpParser parser=(HttpParser)_parser;
|
||||
|
||||
// is there already content?
|
||||
if ((parser.getHeaderBuffer()==null || parser.getHeaderBuffer().length()<2) &&
|
||||
(parser.getBodyBuffer()==null || parser.getBodyBuffer().length()<1))
|
||||
// No - so let's not expect it.
|
||||
((HttpParser)_parser).setState(HttpParser.STATE_END);
|
||||
}
|
||||
}
|
||||
|
||||
if(_endp.isOpen())
|
||||
{
|
||||
|
|
|
@ -693,6 +693,41 @@ public abstract class RFC2616BaseTest extends AbstractJettyTestCase
|
|||
|
||||
response.assertStatusOK("8.2.3 expect 100");
|
||||
}
|
||||
/**
|
||||
* Test Message Transmission Requirements -- Acceptable bad client behavior, Expect 100 with body content.
|
||||
*
|
||||
* @see <a href="http://tools.ietf.org/html/rfc2616#section-8.2">RFC 2616 (section 8.2)</a>
|
||||
*/
|
||||
@Test
|
||||
public void test8_2_UnexpectWithBody() throws Exception
|
||||
{
|
||||
// Expect with body
|
||||
|
||||
StringBuffer req3 = new StringBuffer();
|
||||
req3.append("GET /redirect/R1 HTTP/1.1\n");
|
||||
req3.append("Host: localhost\n");
|
||||
req3.append("Expect: 100-continue\n"); // Valid Expect header.
|
||||
req3.append("Content-Type: text/plain\n");
|
||||
req3.append("Content-Length: 8\n");
|
||||
req3.append("\n");
|
||||
req3.append("123456\r\n");
|
||||
req3.append("GET /echo/R1 HTTP/1.1\n");
|
||||
req3.append("Host: localhost\n");
|
||||
req3.append("Content-Type: text/plain\n");
|
||||
req3.append("Content-Length: 8\n");
|
||||
req3.append("Connection: close\n");
|
||||
req3.append("\n");
|
||||
req3.append("87654321"); // Body
|
||||
|
||||
List<HttpResponseTester> responses = http.requests(req3);
|
||||
|
||||
response=responses.get(0);
|
||||
response.assertStatus("8.2.3 ignored no 100",302);
|
||||
|
||||
response=responses.get(1);
|
||||
response.assertStatus("8.2.3 ignored no 100",200);
|
||||
response.assertBody("87654321\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Message Transmission Requirements
|
||||
|
|
Loading…
Reference in New Issue