ok2c commented on code in PR #638:
URL:
https://github.com/apache/httpcomponents-core/pull/638#discussion_r2842845220
##########
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java:
##########
@@ -911,13 +911,15 @@ private void consumeFrame(final RawFrame frame) throws
HttpException, IOExceptio
if (streamId == 0) {
throw new H2ConnectionException(H2Error.PROTOCOL_ERROR,
"Illegal stream id: " + streamId);
}
+
+ final ByteBuffer payload = frame.getPayload();
+ if (payload == null || payload.remaining() != 4) {
+ throw new H2ConnectionException(H2Error.FRAME_SIZE_ERROR,
"Invalid RST_STREAM frame payload");
+ }
+
final H2Stream stream = streams.lookupSeen(streamId);
if (stream != null) {
- final ByteBuffer payload = frame.getPayload();
- if (payload == null || payload.remaining() != 4) {
- throw new
H2ConnectionException(H2Error.FRAME_SIZE_ERROR, "Invalid RST_STREAM frame
payload");
- }
- final int errorCode = payload.getInt();
+ final int errorCode = payload.getInt(payload.position());
Review Comment:
@arturobernalg Why `payload.getInt(payload.position());`? Was it wrong?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]