HttpResponseStatus status = SpdyHeaders.getStatus(responseFrame);
HttpVersion version = SpdyHeaders.getVersion(responseFrame);
SpdyHeaders.removeStatus(responseFrame);
SpdyHeaders.removeVersion(responseFrame);
HttpResponse httpResponse = new DefaultHttpResponse(version, status);
for (Map.Entry<String, String> e: responseFrame.getHeaders()) {
httpResponse.addHeader(e.getKey(), e.getValue());
}
// Chunked encoding is no longer valid
List<String> encodings = httpResponse.getHeaders(HttpHeaders.Names.TRANSFER_ENCODING);
encodings.remove(HttpHeaders.Values.CHUNKED);
if (encodings.isEmpty()) {
httpResponse.removeHeader(HttpHeaders.Names.TRANSFER_ENCODING);
} else {
httpResponse.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, encodings);
}
httpResponse.removeHeader(HttpHeaders.Names.TRAILER);
// The Connection and Keep-Alive headers are no longer valid
HttpHeaders.setKeepAlive(httpResponse, true);
return httpResponse;