[#2847] Correctly encode HTTP to SPDY if X-SPDY-Associated-To-Stream-ID is not present

Motivation:

Because of a bug a NPE was thrown when tried to encode HTTP to SPDY and no X-SPDY-Associated-To-Stream-ID was present.

Modifications:

Use 0 as default value when X-SPDY-Associated-To-Stream-ID not present.

Result:

No NPE anymore.
This commit is contained in:
Norman Maurer 2014-08-31 21:04:37 +02:00
parent bdd950dff8
commit a765753ae6

View File

@ -210,7 +210,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<HttpObject> {
// Get the Stream-ID, Associated-To-Stream-ID, Priority, URL, and scheme from the headers
final HttpHeaders httpHeaders = httpMessage.headers();
int streamID = httpHeaders.getInt(Names.STREAM_ID);
int associatedToStreamId = httpHeaders.getInt(Names.ASSOCIATED_TO_STREAM_ID);
int associatedToStreamId = httpHeaders.getInt(Names.ASSOCIATED_TO_STREAM_ID, 0);
byte priority = (byte) httpHeaders.getInt(Names.PRIORITY, 0);
String URL = httpHeaders.get(Names.URL);
String scheme = httpHeaders.get(Names.SCHEME);