aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-02-12 06:15:51 (EST)
committerThomas Becker2013-02-12 06:16:05 (EST)
commitc840d3dbb1380890e46d171a6dd31a52d8c7f0fc (patch)
tree9b88cc495e911058e295407f0a30308a002a52fc
parent4daba061757acd43fa00374cc200502f284d46b5 (diff)
downloadorg.eclipse.jetty.project-c840d3dbb1380890e46d171a6dd31a52d8c7f0fc.zip
org.eclipse.jetty.project-c840d3dbb1380890e46d171a6dd31a52d8c7f0fc.tar.gz
org.eclipse.jetty.project-c840d3dbb1380890e46d171a6dd31a52d8c7f0fc.tar.bz2
400555 HttpProxyEngine: Add http version header in response
-rw-r--r--jetty-spdy/spdy-http-server/src/main/java/org/eclipse/jetty/spdy/server/proxy/HTTPProxyEngine.java5
-rw-r--r--jetty-spdy/spdy-http-server/src/test/java/org/eclipse/jetty/spdy/server/proxy/ProxySPDYToHTTPTest.java1
2 files changed, 5 insertions, 1 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 971be08..b425a58 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
@@ -30,6 +30,7 @@ import org.eclipse.jetty.client.util.DeferredContentProvider;
import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.http.HttpMethod;
import org.eclipse.jetty.http.HttpStatus;
+import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.spdy.api.ByteBufferDataInfo;
import org.eclipse.jetty.spdy.api.DataInfo;
import org.eclipse.jetty.spdy.api.HeadersInfo;
@@ -235,9 +236,11 @@ public class HTTPProxyEngine extends ProxyEngine
Fields responseHeaders = new Fields();
for (HttpField header : response.getHeaders())
responseHeaders.add(header.getName(), header.getValue());
+ short version = clientStream.getSession().getVersion();
if (response.getStatus() > 0)
- responseHeaders.add(HTTPSPDYHeader.STATUS.name(clientStream.getSession().getVersion()),
+ responseHeaders.add(HTTPSPDYHeader.STATUS.name(version),
String.valueOf(response.getStatus()));
+ responseHeaders.add(HTTPSPDYHeader.VERSION.name(version), HttpVersion.HTTP_1_1.asString());
addResponseProxyHeaders(clientStream, responseHeaders);
return responseHeaders;
}
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 2d6fcea..f3c2e9d 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
@@ -179,6 +179,7 @@ public class ProxySPDYToHTTPTest
public void onReply(Stream stream, ReplyInfo replyInfo)
{
Fields headers = replyInfo.getHeaders();
+ assertThat("Version header is set", headers.get(HTTPSPDYHeader.VERSION.name(version)), is(notNullValue()));
assertThat("Custom set header foo is set on response", headers.get(header), is(notNullValue()));
assertThat("HOP headers like connection are removed before forwarding",
headers.get("connection"), is(nullValue()));