aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-07-03 09:21:06 (EDT)
committerThomas Becker2013-07-03 09:21:06 (EDT)
commite4c7cfbf37291abeedb97507b1b4f4189a678194 (patch)
tree396e603483844cc740b4f9b66c0ebd709d181703
parent85ef5396633d45bdc8761e60f7b1a89ad4c698dc (diff)
downloadorg.eclipse.jetty.project-e4c7cfbf37291abeedb97507b1b4f4189a678194.zip
org.eclipse.jetty.project-e4c7cfbf37291abeedb97507b1b4f4189a678194.tar.gz
org.eclipse.jetty.project-e4c7cfbf37291abeedb97507b1b4f4189a678194.tar.bz2
408235 SPDYtoHTTP proxy fix: remove hop headers from upstream server
-rw-r--r--jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPProxyEngine.java1
-rw-r--r--jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyEngine.java2
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java4
3 files changed, 7 insertions, 0 deletions
diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPProxyEngine.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPProxyEngine.java
index b425a58..b46d11c 100644
--- a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPProxyEngine.java
+++ b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPProxyEngine.java
@@ -141,6 +141,7 @@ public class HTTPProxyEngine extends ProxyEngine
{
LOG.debug("onHeaders called with response: {}. Sending replyInfo to client.", response);
Fields responseHeaders = createResponseHeaders(clientStream, response);
+ removeHopHeaders(responseHeaders);
ReplyInfo replyInfo = new ReplyInfo(responseHeaders, false);
clientStream.reply(replyInfo, new Callback.Adapter()
{
diff --git a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyEngine.java b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyEngine.java
index c5a5cff..0b980b5 100644
--- a/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyEngine.java
+++ b/jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/ProxyEngine.java
@@ -87,6 +87,8 @@ public abstract class ProxyEngine
protected void removeHopHeaders(Fields headers)
{
+ // Header names are case-insensitive (RFC2616) and oej.util.Fields.add converts the names to lowercase. So we
+ // need to compare with the lowercase values only
for (String hopHeader : HOP_HEADERS)
headers.remove(hopHeader);
}
diff --git a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java
index 658c386..556c148 100644
--- a/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java
+++ b/jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java
@@ -219,6 +219,8 @@ public class ProxySPDYToHTTPTest
public void onReply(Stream stream, ReplyInfo replyInfo)
{
Fields headers = replyInfo.getHeaders();
+ assertThat("Trailer header has been filtered by proxy", headers.get("trailer"),
+ is(nullValue()));
assertThat("custom header exists in response", headers.get(header), is(notNullValue()));
replyLatch.countDown();
}
@@ -545,6 +547,8 @@ public class ProxySPDYToHTTPTest
while ((read = bufferedReader.read()) != -1)
response.getOutputStream().write(read);
+ // add some hop header to be removed on the proxy
+ response.addHeader("Trailer", "bla");
if (responseHeader != null)
response.addHeader(responseHeader, "bar");
if (responseData != null)