Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a specific error on compressed frames #975

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions javascript/net/grpc/web/grpcwebstreamparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,17 @@ class GrpcWebStreamParser {
* @param {number} b A frame byte to process
*/
function processFrameByte(b) {
if (b == FrameType.DATA) {
parser.frame_ = b;
} else if (b == FrameType.TRAILER) {
parser.frame_ = b;
var frameType = b & 0xFE;
var isCompressed = b & 0x01;
if (isCompressed !== 0) {
parser.error_(inputBytes, pos, 'compressed frames aren\'t supported');
} else {
parser.error_(inputBytes, pos, 'invalid frame byte');
if (frameType == FrameType.DATA) {
parser.frame_ = frameType;
} else if (frameType == FrameType.TRAILER) {
parser.frame_ = frameType;
} else {
parser.error_(inputBytes, pos, 'invalid frame byte');
vbfox marked this conversation as resolved.
Show resolved Hide resolved
}

parser.state_ = Parser.State_.LENGTH;
Expand Down