Merge remote-tracking branch 'origin/jetty-9.2.x'
Conflicts: VERSION.txt aggregates/jetty-all/pom.xml apache-jsp/pom.xml apache-jstl/pom.xml examples/async-rest/async-rest-jar/pom.xml examples/async-rest/async-rest-webapp/pom.xml examples/async-rest/pom.xml examples/embedded/pom.xml examples/pom.xml jetty-alpn/jetty-alpn-client/pom.xml jetty-alpn/jetty-alpn-server/pom.xml jetty-alpn/pom.xml jetty-annotations/pom.xml jetty-ant/pom.xml jetty-cdi/pom.xml jetty-client/pom.xml jetty-continuation/pom.xml jetty-deploy/pom.xml jetty-distribution/pom.xml jetty-fcgi/fcgi-client/pom.xml jetty-fcgi/fcgi-server/pom.xml jetty-fcgi/pom.xml jetty-http-spi/pom.xml jetty-http/pom.xml jetty-io/pom.xml jetty-jaas/pom.xml jetty-jaspi/pom.xml jetty-jmx/pom.xml jetty-jndi/pom.xml jetty-jsp/pom.xml jetty-jspc-maven-plugin/pom.xml jetty-maven-plugin/pom.xml jetty-monitor/pom.xml jetty-nosql/pom.xml jetty-osgi/jetty-osgi-alpn/pom.xml jetty-osgi/jetty-osgi-boot-jsp/pom.xml jetty-osgi/jetty-osgi-boot-warurl/pom.xml jetty-osgi/jetty-osgi-boot/pom.xml jetty-osgi/jetty-osgi-httpservice/pom.xml jetty-osgi/jetty-osgi-npn/pom.xml jetty-osgi/pom.xml jetty-osgi/test-jetty-osgi-context/pom.xml jetty-osgi/test-jetty-osgi-webapp/pom.xml jetty-osgi/test-jetty-osgi/pom.xml jetty-plus/pom.xml jetty-proxy/pom.xml jetty-quickstart/pom.xml jetty-rewrite/pom.xml jetty-runner/pom.xml jetty-security/pom.xml jetty-server/pom.xml jetty-servlet/pom.xml jetty-servlets/pom.xml jetty-spdy/pom.xml jetty-spdy/spdy-alpn-tests/pom.xml jetty-spdy/spdy-client/pom.xml jetty-spdy/spdy-core/pom.xml jetty-spdy/spdy-example-webapp/pom.xml jetty-spdy/spdy-http-client-transport/pom.xml jetty-spdy/spdy-http-common/pom.xml jetty-spdy/spdy-http-server/pom.xml jetty-spdy/spdy-npn-tests/pom.xml jetty-spdy/spdy-server/pom.xml jetty-spring/pom.xml jetty-start/pom.xml jetty-util-ajax/pom.xml jetty-util/pom.xml jetty-webapp/pom.xml jetty-websocket/javax-websocket-client-impl/pom.xml jetty-websocket/javax-websocket-server-impl/pom.xml jetty-websocket/pom.xml jetty-websocket/websocket-api/pom.xml jetty-websocket/websocket-client/pom.xml jetty-websocket/websocket-common/pom.xml jetty-websocket/websocket-server/pom.xml jetty-websocket/websocket-servlet/pom.xml jetty-xml/pom.xml pom.xml tests/pom.xml tests/test-continuation/pom.xml tests/test-integration/pom.xml tests/test-loginservice/pom.xml tests/test-quickstart/pom.xml tests/test-sessions/pom.xml tests/test-sessions/test-hash-sessions/pom.xml tests/test-sessions/test-jdbc-sessions/pom.xml tests/test-sessions/test-mongodb-sessions/pom.xml tests/test-sessions/test-sessions-common/pom.xml tests/test-webapps/pom.xml tests/test-webapps/test-jaas-webapp/pom.xml tests/test-webapps/test-jetty-webapp/pom.xml tests/test-webapps/test-jndi-webapp/pom.xml tests/test-webapps/test-mock-resources/pom.xml tests/test-webapps/test-proxy-webapp/pom.xml tests/test-webapps/test-servlet-spec/pom.xml tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml tests/test-webapps/test-webapp-rfc2616/pom.xml
This commit is contained in:
commit
d161bdcb36
|
@ -4,19 +4,24 @@ jetty-9.2.6.v20141203 - 03 December 2014
|
|||
+ 383207 Use BundleFileLocatorHelperFactory to obtain BundleFileLocatorHelper
|
||||
+ 443652 Remove dependency on java.lang.management classes
|
||||
+ 447472 Clear async context timeout on async static content
|
||||
+ 451529 Change sentinel class for finding jstl on classpath to
|
||||
+ 451529 Change sentinel class for finding jstl on classpath to
|
||||
org.apache.taglibs.standard.tag.rt.core.WhenTag
|
||||
+ 451634 DefaultServlet: useFileMappedBuffer javadoc is misleading
|
||||
+ 452188 Delay dispatch until content optimisation.
|
||||
+ 452201 EnvConfiguration.destroy() should set the classloader
|
||||
+ 452246 Fixed SSL hang on last chunk
|
||||
+ 452261 Multiple servlets map to path *.jsp when using jsp-property-group
|
||||
+ 452261 Ensure <jsp-file> works with new JettyJspServlet
|
||||
+ 452424 Do not add Date header if already set
|
||||
+ 452516 Make HttpOutput aggregation size configurable.
|
||||
+ 453386 Jetty not working when configuring QueuedThreadPool with
|
||||
minThreads=0.
|
||||
+ 453629 Fixed big write test
|
||||
+ 453793 _maxHeaderBytes>0 is not verified in parseNext() when in
|
||||
State.CLOSED.
|
||||
+ 453801 Jetty does not check for already registered services when
|
||||
bootstrapping
|
||||
+ 454157 HttpInput.consumeAll spins if input is in async mode.
|
||||
|
||||
jetty-9.2.5.v20141112 - 12 November 2014
|
||||
+ 448446 org.eclipse.jetty.start.Main create classloader duplicate
|
||||
|
|
|
@ -150,7 +150,7 @@ public abstract class AbstractEndPoint extends IdleTimeout implements EndPoint
|
|||
boolean fillFailed = _fillInterest.onFail(timeout);
|
||||
boolean writeFailed = _writeFlusher.onFail(timeout);
|
||||
|
||||
// If the endpoint is half closed and there was no onFail handling, the close here
|
||||
// If the endpoint is half closed and there was no fill/write handling, then close here.
|
||||
// This handles the situation where the connection has completed its close handling
|
||||
// and the endpoint is half closed, but the other party does not complete the close.
|
||||
// This perhaps should not check for half closed, however the servlet spec case allows
|
||||
|
|
|
@ -367,7 +367,8 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("unconsumed input {}", this);
|
||||
// Complete reading the request
|
||||
_channel.getRequest().getHttpInput().consumeAll();
|
||||
if (!_channel.getRequest().getHttpInput().consumeAll())
|
||||
_channel.abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -319,10 +319,14 @@ public abstract class HttpInput extends ServletInputStream implements Runnable
|
|||
_channelState.onReadPossible();
|
||||
}
|
||||
|
||||
public void consumeAll()
|
||||
public boolean consumeAll()
|
||||
{
|
||||
synchronized (lock())
|
||||
{
|
||||
{
|
||||
// Don't bother reading if we already know there was an error.
|
||||
if (_onError != null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
while (!isFinished())
|
||||
|
@ -333,10 +337,12 @@ public abstract class HttpInput extends ServletInputStream implements Runnable
|
|||
else
|
||||
consume(item, remaining(item));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
LOG.debug(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.servlet;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -30,10 +27,10 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.servlet.AsyncContext;
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
@ -48,6 +45,13 @@ import org.junit.After;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
public class AsyncIOServletTest
|
||||
{
|
||||
private Server server;
|
||||
|
@ -147,6 +151,73 @@ public class AsyncIOServletTest
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAsyncReadIdleTimeout() throws Exception
|
||||
{
|
||||
final int status = 567;
|
||||
startServer(new HttpServlet()
|
||||
{
|
||||
@Override
|
||||
protected void service(HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
final AsyncContext asyncContext = request.startAsync(request, response);
|
||||
asyncContext.setTimeout(0);
|
||||
final ServletInputStream inputStream = request.getInputStream();
|
||||
inputStream.setReadListener(new ReadListener()
|
||||
{
|
||||
@Override
|
||||
public void onDataAvailable() throws IOException
|
||||
{
|
||||
while (inputStream.isReady() && !inputStream.isFinished())
|
||||
inputStream.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAllDataRead() throws IOException
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t)
|
||||
{
|
||||
response.setStatus(status);
|
||||
// Do not put Connection: close header here, the test
|
||||
// verifies that the server closes no matter what.
|
||||
asyncContext.complete();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
server.stop();
|
||||
long idleTimeout = 1000;
|
||||
connector.setIdleTimeout(idleTimeout);
|
||||
server.start();
|
||||
|
||||
String data1 = "0123456789";
|
||||
String data2 = "ABCDEF";
|
||||
// Only send the first chunk of data and then let it idle timeout.
|
||||
String request = "GET " + path + " HTTP/1.1\r\n" +
|
||||
"Host: localhost:" + connector.getLocalPort() + "\r\n" +
|
||||
"Content-Length: " + (data1.length() + data2.length()) + "\r\n" +
|
||||
"\r\n" +
|
||||
data1;
|
||||
|
||||
try (Socket client = new Socket("localhost", connector.getLocalPort()))
|
||||
{
|
||||
OutputStream output = client.getOutputStream();
|
||||
output.write(request.getBytes("UTF-8"));
|
||||
output.flush();
|
||||
|
||||
SimpleHttpParser parser = new SimpleHttpParser();
|
||||
SimpleHttpResponse response = parser.readResponse(new BufferedReader(new InputStreamReader(client.getInputStream(), "UTF-8")));
|
||||
|
||||
assertEquals(String.valueOf(status), response.getCode());
|
||||
|
||||
// Make sure the connection was closed by the server.
|
||||
assertEquals(-1, client.getInputStream().read());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnErrorThrows() throws Exception
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue