} else if (msg instanceof SpdyHeadersFrame) {
SpdyHeadersFrame spdyHeadersFrame = (SpdyHeadersFrame) msg;
Integer streamID = new Integer(spdyHeadersFrame.getStreamID());
HttpMessage httpMessage = messageMap.get(streamID);
// If message is not in map discard HEADERS frame.
// SpdySessionHandler should prevent this from happening.
if (httpMessage == null) {
return null;
}
for (Map.Entry<String, String> e: spdyHeadersFrame.getHeaders()) {
httpMessage.addHeader(e.getKey(), e.getValue());
}
} else if (msg instanceof SpdyDataFrame) {
SpdyDataFrame spdyDataFrame = (SpdyDataFrame) msg;
Integer streamID = new Integer(spdyDataFrame.getStreamID());
HttpMessage httpMessage = messageMap.get(streamID);
// If message is not in map discard Data Frame.
// SpdySessionHandler should prevent this from happening.
if (httpMessage == null) {
return null;
}
ChannelBuffer content = httpMessage.getContent();
if (content.readableBytes() > maxContentLength - spdyDataFrame.getData().readableBytes()) {
messageMap.remove(streamID);
throw new TooLongFrameException(
"HTTP content length exceeded " + maxContentLength + " bytes.");
}
if (content == ChannelBuffers.EMPTY_BUFFER) {
content = ChannelBuffers.dynamicBuffer(channel.getConfig().getBufferFactory());
content.writeBytes(spdyDataFrame.getData());
httpMessage.setContent(content);
} else {
content.writeBytes(spdyDataFrame.getData());
}
if (spdyDataFrame.isLast()) {