Skip to content

Commit d9da0d0

Browse files
committed
Bugfix: Invalid trailing headers are now handled without error.
1 parent 7fe9019 commit d9da0d0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/com/muukong/grpcweb/GrpcWebRequestResponse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ private void deserializeGrpcWebProto() {
225225

226226
String trailerString = new String(trailer);
227227
for (String header : trailerString.split("\r\n")) {
228-
229-
String[] tmp = header.split(":");
228+
String[] tmp = header.split(":", 2);
229+
if ( tmp.length < 2 ) continue; // skip malformed / empty lines
230230
trailingHeaders.addHeader(new HttpHeader(tmp[0], tmp[1]));
231-
232-
cursor += length;
233231
}
232+
233+
cursor += length;
234234
}
235235
}
236236
}

0 commit comments

Comments
 (0)