diff --git a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java index 52f1243d734..57f3e3206fb 100644 --- a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java +++ b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ReferrerPushStrategy.java @@ -104,16 +104,16 @@ public class ReferrerPushStrategy implements PushStrategy @Override public Set apply(Stream stream, Headers requestHeaders, Headers responseHeaders) { - Set result = Collections.emptySet(); + Set result = Collections.emptySet(); short version = stream.getSession().getVersion(); - String scheme = requestHeaders.get(HTTPSPDYHeader.SCHEME.name(version)).value(); - String host = requestHeaders.get(HTTPSPDYHeader.HOST.name(version)).value(); - String origin = new StringBuilder(scheme).append("://").append(host).toString(); - String url = requestHeaders.get(HTTPSPDYHeader.URI.name(version)).value(); - String absoluteURL = new StringBuilder(origin).append(url).toString(); - logger.debug("Applying push strategy for {}", absoluteURL); - if (isValidMethod(requestHeaders.get(HTTPSPDYHeader.METHOD.name(version)).value())) + if (!isIfModifiedSinceHeaderPresent(requestHeaders) && isValidMethod(requestHeaders.get(HTTPSPDYHeader.METHOD.name(version)).value())) { + String scheme = requestHeaders.get(HTTPSPDYHeader.SCHEME.name(version)).value(); + String host = requestHeaders.get(HTTPSPDYHeader.HOST.name(version)).value(); + String origin = new StringBuilder(scheme).append("://").append(host).toString(); + String url = requestHeaders.get(HTTPSPDYHeader.URI.name(version)).value(); + String absoluteURL = new StringBuilder(origin).append(url).toString(); + logger.debug("Applying push strategy for {}", absoluteURL); if (isMainResource(url, responseHeaders)) { result = pushResources(absoluteURL); @@ -131,11 +131,16 @@ public class ReferrerPushStrategy implements PushStrategy result = pushResources(absoluteURL); } } + logger.debug("Push resources for {}: {}", absoluteURL, result); } - logger.debug("Push resources for {}: {}", absoluteURL, result); return result; } + private boolean isIfModifiedSinceHeaderPresent(Headers headers) + { + return headers.get("if-modified-since") != null; + } + private boolean isValidMethod(String method) { return "GET".equalsIgnoreCase(method); diff --git a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java index 5fb09f555c9..b4e278f5f36 100644 --- a/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java +++ b/jetty-spdy/spdy-jetty-http/src/main/java/org/eclipse/jetty/spdy/http/ServerHTTPSPDYAsyncConnection.java @@ -403,7 +403,7 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem if (!stream.isUnidirectional()) stream.reply(replyInfo); if (replyInfo.getHeaders().get(HTTPSPDYHeader.STATUS.name(version)).value().startsWith("200") && - !stream.isClosed() && !isIfModifiedSinceHeaderPresent()) + !stream.isClosed()) { // We have a 200 OK with some content to send @@ -438,11 +438,6 @@ public class ServerHTTPSPDYAsyncConnection extends AbstractHttpConnection implem } } - private boolean isIfModifiedSinceHeaderPresent() - { - return headers.get("if-modified-since") != null; - } - private Buffer consumeContent(long maxIdleTime) throws IOException, InterruptedException { while (true)