Merged branch 'jetty-9.2.x' into 'master'.
This commit is contained in:
commit
e7d830c26e
|
@ -98,5 +98,12 @@
|
|||
<artifactId>jetty-test-helper</artifactId>
|
||||
<!-- scope>test</scope-->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -257,10 +257,11 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
public void earlyEOF()
|
||||
{
|
||||
HttpExchange exchange = getHttpExchange();
|
||||
HttpConnectionOverHTTP connection = getHttpConnection();
|
||||
if (exchange == null)
|
||||
getHttpConnection().close();
|
||||
connection.close();
|
||||
else
|
||||
failAndClose(new EOFException());
|
||||
failAndClose(new EOFException(String.valueOf(connection)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -271,7 +272,7 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res
|
|||
{
|
||||
HttpResponse response = exchange.getResponse();
|
||||
response.status(status).reason(reason);
|
||||
failAndClose(new HttpResponseException("HTTP protocol violation: bad response", response));
|
||||
failAndClose(new HttpResponseException("HTTP protocol violation: bad response on " + getHttpConnection(), response));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1571,7 +1571,36 @@ public class HttpParserTest
|
|||
assertFalse(_headerCompleted);
|
||||
assertEquals(_bad, "Bad Continuation");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testParseRequest() throws Exception
|
||||
{
|
||||
ByteBuffer buffer = BufferUtil.toBuffer(
|
||||
"GET / HTTP/1.1\r\n" +
|
||||
"Host: localhost\r\n" +
|
||||
"Header1: value1\r\n" +
|
||||
"Connection: close\r\n" +
|
||||
"Accept-Encoding: gzip, deflated\r\n" +
|
||||
"Accept: unknown\r\n" +
|
||||
"\r\n");
|
||||
|
||||
HttpParser.RequestHandler<ByteBuffer> handler = new Handler();
|
||||
HttpParser parser= new HttpParser(handler);
|
||||
parser.parseNext(buffer);
|
||||
|
||||
assertEquals("GET",_methodOrVersion);
|
||||
assertEquals("/",_uriOrStatus);
|
||||
assertEquals("HTTP/1.1",_versionOrReason);
|
||||
assertEquals("Host",_hdr[0]);
|
||||
assertEquals("localhost",_val[0]);
|
||||
assertEquals("Connection",_hdr[2]);
|
||||
assertEquals("close",_val[2]);
|
||||
assertEquals("Accept-Encoding",_hdr[3]);
|
||||
assertEquals("gzip, deflated",_val[3]);
|
||||
assertEquals("Accept",_hdr[4]);
|
||||
assertEquals("unknown",_val[4]);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init()
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.jetty.io.EndPoint;
|
|||
import org.eclipse.jetty.io.EofException;
|
||||
import org.eclipse.jetty.io.FillInterest;
|
||||
import org.eclipse.jetty.io.RuntimeIOException;
|
||||
import org.eclipse.jetty.io.SelectChannelEndPoint;
|
||||
import org.eclipse.jetty.io.WriteFlusher;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
|
@ -552,6 +553,12 @@ public class SslConnection extends AbstractConnection
|
|||
// or shutting down the output.
|
||||
return -1;
|
||||
}
|
||||
case NEED_UNWRAP:
|
||||
{
|
||||
// We expected to read more, but we got closed.
|
||||
// Return -1 to indicate to the application to drive the close.
|
||||
return -1;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new IllegalStateException();
|
||||
|
@ -779,7 +786,7 @@ public class SslConnection extends AbstractConnection
|
|||
|
||||
// if we have net bytes, let's try to flush them
|
||||
if (BufferUtil.hasContent(_encryptedOutput))
|
||||
if (!getEndPoint().flush(_encryptedOutput));
|
||||
if (!getEndPoint().flush(_encryptedOutput))
|
||||
getEndPoint().flush(_encryptedOutput); // one retry
|
||||
|
||||
// But we also might have more to do for the handshaking state.
|
||||
|
@ -824,10 +831,6 @@ public class SslConnection extends AbstractConnection
|
|||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
releaseEncryptedOutputBuffer();
|
||||
|
|
|
@ -62,6 +62,13 @@
|
|||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
|
|
|
@ -118,6 +118,13 @@
|
|||
<version>${project.version}</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-http</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty.toolchain</groupId>
|
||||
<artifactId>jetty-test-helper</artifactId>
|
||||
|
|
Loading…
Reference in New Issue