SPDY: fix pushed response NullPointerException

This commit is contained in:
Jeff Pinner 2014-07-20 19:43:02 -07:00 committed by Norman Maurer
parent eb34cbb2d8
commit 6d0233d3bd

View File

@ -322,6 +322,7 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
private static FullHttpRequest createHttpRequest(int spdyVersion, SpdyHeadersFrame requestFrame) private static FullHttpRequest createHttpRequest(int spdyVersion, SpdyHeadersFrame requestFrame)
throws Exception { throws Exception {
// Create the first line of the request from the name/value pairs // Create the first line of the request from the name/value pairs
SpdyHeaders headers = requestFrame.headers();
HttpMethod method = SpdyHeaders.getMethod(spdyVersion, requestFrame); HttpMethod method = SpdyHeaders.getMethod(spdyVersion, requestFrame);
String url = SpdyHeaders.getUrl(spdyVersion, requestFrame); String url = SpdyHeaders.getUrl(spdyVersion, requestFrame);
HttpVersion httpVersion = SpdyHeaders.getVersion(spdyVersion, requestFrame); HttpVersion httpVersion = SpdyHeaders.getVersion(spdyVersion, requestFrame);
@ -334,12 +335,10 @@ public class SpdyHttpDecoder extends MessageToMessageDecoder<SpdyFrame> {
// Remove the scheme header // Remove the scheme header
SpdyHeaders.removeScheme(spdyVersion, requestFrame); SpdyHeaders.removeScheme(spdyVersion, requestFrame);
if (spdyVersion >= 3) { // Replace the SPDY host header with the HTTP host header
// Replace the SPDY host header with the HTTP host header String host = headers.get(SpdyHeaders.HttpNames.HOST);
String host = SpdyHeaders.getHost(requestFrame); headers.remove(SpdyHeaders.HttpNames.HOST);
SpdyHeaders.removeHost(requestFrame); req.headers().set(HttpHeaders.Names.HOST, host);
HttpHeaders.setHost(req, host);
}
for (Map.Entry<String, String> e: requestFrame.headers()) { for (Map.Entry<String, String> e: requestFrame.headers()) {
req.headers().add(e.getKey(), e.getValue()); req.headers().add(e.getKey(), e.getValue());