Skip to content

Commit

Permalink
SPDY: fix pushed response NullPointerException
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Pinner authored and Norman Maurer committed Jul 21, 2014
1 parent eb34cbb commit 6d0233d
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ protected void decode(ChannelHandlerContext ctx, SpdyFrame msg, List<Object> out
private static FullHttpRequest createHttpRequest(int spdyVersion, SpdyHeadersFrame requestFrame)
throws Exception {
// Create the first line of the request from the name/value pairs
SpdyHeaders headers = requestFrame.headers();
HttpMethod method = SpdyHeaders.getMethod(spdyVersion, requestFrame);
String url = SpdyHeaders.getUrl(spdyVersion, requestFrame);
HttpVersion httpVersion = SpdyHeaders.getVersion(spdyVersion, requestFrame);
Expand All @@ -334,12 +335,10 @@ private static FullHttpRequest createHttpRequest(int spdyVersion, SpdyHeadersFra
// Remove the scheme header
SpdyHeaders.removeScheme(spdyVersion, requestFrame);

if (spdyVersion >= 3) {
// Replace the SPDY host header with the HTTP host header
String host = SpdyHeaders.getHost(requestFrame);
SpdyHeaders.removeHost(requestFrame);
HttpHeaders.setHost(req, host);
}
// Replace the SPDY host header with the HTTP host header
String host = headers.get(SpdyHeaders.HttpNames.HOST);
headers.remove(SpdyHeaders.HttpNames.HOST);
req.headers().set(HttpHeaders.Names.HOST, host);

for (Map.Entry<String, String> e: requestFrame.headers()) {
req.headers().add(e.getKey(), e.getValue());
Expand Down

0 comments on commit 6d0233d

Please sign in to comment.