Repository navigation
Commit aaaa85a
committed
gh-43521: Decode gzip responses with gzip.GzipFile
Replace the hand-written _GzipReader with gzip.GzipFile, as requested
in review. Unlike _GzipReader, GzipFile bounds how much a sized read
decompresses. GzipFile does not close the file object it wraps, so
addclosehook closes the response.
gzip is imported inside the handler, so importing urllib.request does
not import it. Junk after the last gzip member now raises BadGzipFile,
as it does with gzip.open(), so the test that expected it to be
ignored is removed.1 parent 3ec8f2c commit aaaa85a
2 files changed
Lines changed: 7 additions & 83 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2123 | 2123 | | |
2124 | 2124 | | |
2125 | 2125 | | |
2126 | | - | |
2127 | | - | |
2128 | | - | |
2129 | | - | |
2130 | | - | |
2131 | | - | |
2132 | | - | |
2133 | | - | |
2134 | | - | |
2135 | 2126 | | |
2136 | 2127 | | |
2137 | 2128 | | |
| |||
2164 | 2155 | | |
2165 | 2156 | | |
2166 | 2157 | | |
2167 | | - | |
| 2158 | + | |
2168 | 2159 | | |
2169 | 2160 | | |
2170 | 2161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | 117 | | |
123 | 118 | | |
124 | 119 | | |
| |||
1418 | 1413 | | |
1419 | 1414 | | |
1420 | 1415 | | |
1421 | | - | |
1422 | | - | |
1423 | | - | |
1424 | | - | |
1425 | | - | |
1426 | | - | |
1427 | | - | |
1428 | | - | |
1429 | | - | |
1430 | | - | |
1431 | | - | |
1432 | | - | |
1433 | | - | |
1434 | | - | |
1435 | | - | |
1436 | | - | |
1437 | | - | |
1438 | | - | |
1439 | | - | |
1440 | | - | |
1441 | | - | |
1442 | | - | |
1443 | | - | |
1444 | | - | |
1445 | | - | |
1446 | | - | |
1447 | | - | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
1452 | | - | |
1453 | | - | |
1454 | | - | |
1455 | | - | |
1456 | | - | |
1457 | | - | |
1458 | | - | |
1459 | | - | |
1460 | | - | |
1461 | | - | |
1462 | | - | |
1463 | | - | |
1464 | | - | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | | - | |
1471 | | - | |
1472 | | - | |
1473 | | - | |
1474 | | - | |
1475 | | - | |
1476 | | - | |
1477 | | - | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
1485 | 1416 | | |
1486 | 1417 | | |
1487 | 1418 | | |
| |||
1493 | 1424 | | |
1494 | 1425 | | |
1495 | 1426 | | |
1496 | | - | |
1497 | | - | |
| 1427 | + | |
| 1428 | + | |
1498 | 1429 | | |
1499 | 1430 | | |
1500 | 1431 | | |
| |||
1505 | 1436 | | |
1506 | 1437 | | |
1507 | 1438 | | |
| 1439 | + | |
1508 | 1440 | | |
1509 | 1441 | | |
1510 | 1442 | | |
1511 | | - | |
1512 | | - | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
1513 | 1446 | | |
1514 | 1447 | | |
1515 | 1448 | | |
| |||
0 commit comments