Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2014-11-20 09:31:27 -0500
committerSimone Bordet2014-11-20 11:06:10 -0500
commit8330fa73e03e3489c18a6818007e58c8a3a1def0 (patch)
tree8c3ca00edfa198254f04c0f1ef463119697585f7
parent1915e592b587dd13e2c2083c4702ad77bba9f0e1 (diff)
downloadorg.eclipse.jetty.project-8330fa73e03e3489c18a6818007e58c8a3a1def0.tar.gz
org.eclipse.jetty.project-8330fa73e03e3489c18a6818007e58c8a3a1def0.tar.xz
org.eclipse.jetty.project-8330fa73e03e3489c18a6818007e58c8a3a1def0.zip
452188 Delay dispatch until content optimisation.
Renamed property "delayDispatchUntilContent".
-rw-r--r--jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java3
-rw-r--r--jetty-server/src/main/config/etc/jetty.xml2
-rw-r--r--jetty-server/src/main/config/modules/server.mod2
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java20
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java10
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java23
6 files changed, 29 insertions, 31 deletions
diff --git a/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java b/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java
index 6c600a589a..a3187f8821 100644
--- a/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java
+++ b/jetty-proxy/src/test/java/org/eclipse/jetty/proxy/ProxyServletFailureTest.java
@@ -30,7 +30,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -104,7 +103,7 @@ public class ProxyServletFailureTest
proxy = new Server(executor);
proxyConnector = new ServerConnector(proxy);
proxy.addConnector(proxyConnector);
- proxyConnector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration().setDelayDispatchOnContent(false);
+ proxyConnector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration().setDelayDispatchUntilContent(false);
ServletContextHandler proxyCtx = new ServletContextHandler(proxy, "/", true, false);
ServletHolder proxyServletHolder = new ServletHolder(proxyServlet);
diff --git a/jetty-server/src/main/config/etc/jetty.xml b/jetty-server/src/main/config/etc/jetty.xml
index 5be3bb0334..4c1fb5e559 100644
--- a/jetty-server/src/main/config/etc/jetty.xml
+++ b/jetty-server/src/main/config/etc/jetty.xml
@@ -85,7 +85,7 @@
<Set name="sendServerVersion"><Property name="jetty.send.server.version" default="true" /></Set>
<Set name="sendDateHeader"><Property name="jetty.send.date.header" default="false" /></Set>
<Set name="headerCacheSize">512</Set>
- <Set name="delayDispatchOnContent"><Property name="jetty.delayDispatchOnContent" default="false"/></Set>
+ <Set name="delayDispatchUntilContent"><Property name="jetty.delayDispatchUntilContent" default="false"/></Set>
<!-- Uncomment to enable handling of X-Forwarded- style headers
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
diff --git a/jetty-server/src/main/config/modules/server.mod b/jetty-server/src/main/config/modules/server.mod
index 910747f7c7..b3f87de162 100644
--- a/jetty-server/src/main/config/modules/server.mod
+++ b/jetty-server/src/main/config/modules/server.mod
@@ -46,4 +46,4 @@ jetty.dump.start=false
# Dump the state of the Jetty server, before stop
jetty.dump.stop=false
# Enable delayed dispatch optimisation
-jetty.delayDispatchOnContent=false
+jetty.delayDispatchUntilContent=false
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java
index fb6d13be31..8a6b52e876 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConfiguration.java
@@ -50,12 +50,11 @@ public class HttpConfiguration
private int _headerCacheSize=512;
private int _securePort;
private String _secureScheme = HttpScheme.HTTPS.asString();
- private boolean _sendServerVersion = true; //send Server: header
- private boolean _sendXPoweredBy = false; //send X-Powered-By: header
- private boolean _sendDateHeader = true; //send Date: header
- private boolean _delayDispatchOnContent = false; // Don't dispatch until content arrives
+ private boolean _sendServerVersion = true;
+ private boolean _sendXPoweredBy = false;
+ private boolean _sendDateHeader = true;
+ private boolean _delayDispatchUntilContent = false;
-
/* ------------------------------------------------------------ */
/**
* <p>An interface that allows a request object to be customized
@@ -211,24 +210,23 @@ public class HttpConfiguration
{
return _sendDateHeader;
}
-
+
/* ------------------------------------------------------------ */
/**
* @param delay if true, delay the application dispatch until content is available
*/
- public void setDelayDispatchOnContent(boolean delay)
+ public void setDelayDispatchUntilContent(boolean delay)
{
- _delayDispatchOnContent=delay;
+ _delayDispatchUntilContent = delay;
}
/* ------------------------------------------------------------ */
@ManagedAttribute("if true, delay the application dispatch until content is available")
- public boolean isDelayDispatchOnContent()
+ public boolean isDelayDispatchUntilContent()
{
- return _delayDispatchOnContent;
+ return _delayDispatchUntilContent;
}
-
/* ------------------------------------------------------------ */
/**
* <p>Set the {@link Customizer}s that are invoked for every
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
index 18f1e240f4..9dbbfe0e5f 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
@@ -528,14 +528,16 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
if (!persistent)
_generator.setPersistent(false);
- boolean superhc = super.headerComplete();
+ if (!super.headerComplete())
+ return false;
// Should we delay dispatch until we have some content?
// We should not delay if there is no content expect or client is expecting 100 or the response is already committed or the request buffer already has something in it to parse
- if (superhc && getHttpConfiguration().isDelayDispatchOnContent() && _parser.getContentLength()>0 && !isExpecting100Continue() && !isCommitted() && BufferUtil.isEmpty(_requestBuffer))
+ if (getHttpConfiguration().isDelayDispatchUntilContent() && _parser.getContentLength() > 0 &&
+ !isExpecting100Continue() && !isCommitted() && BufferUtil.isEmpty(_requestBuffer))
return false;
-
- return superhc;
+
+ return true;
}
@Override
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java
index 81ef422e5a..45809959d5 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java
@@ -18,16 +18,6 @@
package org.eclipse.jetty.server;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.greaterThanOrEqualTo;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -41,7 +31,6 @@ import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.concurrent.Exchanger;
import java.util.concurrent.atomic.AtomicBoolean;
-
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletOutputStream;
@@ -59,6 +48,16 @@ import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.greaterThanOrEqualTo;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.Matchers.startsWith;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
/**
*
*/
@@ -1278,7 +1277,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
{
AvailableHandler ah = new AvailableHandler();
configureServer(ah);
- _connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration().setDelayDispatchOnContent(false);
+ _connector.getConnectionFactory(HttpConnectionFactory.class).getHttpConfiguration().setDelayDispatchUntilContent(false);
try (Socket client = newSocket(_serverURI.getHost(), _serverURI.getPort()))
{

Back to the top