Skip to content

Commit 9afd61d

Browse files
committed
removed the blanket RuntimeException catch and now only ignore IllegalArgumentException
1 parent f0cc04b commit 9afd61d

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/AbstractH2StreamMultiplexer.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ private void recordPriorityFromHeaders(final H2Stream stream, final List<? exten
13881388
}
13891389
for (final Header h : headers) {
13901390
if (HttpHeaders.PRIORITY.equalsIgnoreCase(h.getName())) {
1391-
final PriorityValue pv = parsePriorityValue(h.getValue());
1391+
final PriorityValue pv = parsePriorityValue(h);
13921392
if (pv != null) {
13931393
stream.setPriorityValue(pv);
13941394
}
@@ -1397,10 +1397,24 @@ private void recordPriorityFromHeaders(final H2Stream stream, final List<? exten
13971397
}
13981398
}
13991399

1400+
private PriorityValue parsePriorityValue(final Header header) {
1401+
if (header == null) {
1402+
return null;
1403+
}
1404+
try {
1405+
return PriorityParamsParser.parse(header).toValueWithDefaults();
1406+
} catch (final IllegalArgumentException ignore) {
1407+
return null;
1408+
}
1409+
}
1410+
14001411
private PriorityValue parsePriorityValue(final String field) {
1412+
if (field == null) {
1413+
return null;
1414+
}
14011415
try {
14021416
return PriorityParamsParser.parse(field).toValueWithDefaults();
1403-
} catch (final RuntimeException ignore) {
1417+
} catch (final IllegalArgumentException ignore) {
14041418
return null;
14051419
}
14061420
}
@@ -1452,7 +1466,7 @@ public void submit(final List<Header> headers, final boolean endStream) throws I
14521466
return;
14531467
}
14541468
ensureNotClosed();
1455-
if (peerNoRfc7540Priorities && streams.isSameSide(id)) {
1469+
if (peerNoRfc7540Priorities) {
14561470
for (final Header h : headers) {
14571471
if (HttpHeaders.PRIORITY.equalsIgnoreCase(h.getName())) {
14581472
final byte[] ascii = h.getValue() != null
@@ -1466,6 +1480,7 @@ public void submit(final List<Header> headers, final boolean endStream) throws I
14661480
b.append((byte) (sid >> 8));
14671481
b.append((byte) sid);
14681482
b.append(ascii, 0, ascii.length);
1483+
14691484
final ByteBuffer pl = ByteBuffer.wrap(b.array(), 0, b.length());
14701485
final RawFrame priUpd = new RawFrame(FrameType.PRIORITY_UPDATE.getValue(), 0, 0, pl);
14711486
commitFrameInternal(priUpd);

0 commit comments

Comments
 (0)