Commit 347df83
committed
fix: properly handle IPv6 addresses in HTTP Host headers
This commit fixes IPv6 address handling in HTTP client Host headers
by adding bracket notation when required and improving URL parsing
validation.
- Add automatic bracket wrapping for unbracketed IPv6 addresses in
Host headers when combined with port numbers
- Fix off-by-one error in IPv6 bracket stripping (was removing one
extra character)
- Fix incorrect length calculation in flb_utils_copy_host_sds for
bracketed IPv6 extraction (changed from absolute position to
relative length to properly account for pos_init offset)
- Add IPv6 bracket validation to detect malformed URLs with missing
or mismatched brackets
- Improve error handling in URL parsing with proper cleanup on failure
- Update TLS flag checking to use flb_stream_get_flag_status() for
more reliable detection
Signed-off-by: Shelby Hagman <shelbyzh@amazon.com>1 parent 4f8c50b commit 347df83
File tree
5 files changed
+317
-8
lines changed- src
- tests/internal
5 files changed
+317
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
617 | 623 | | |
618 | 624 | | |
619 | 625 | | |
620 | | - | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
621 | 629 | | |
622 | 630 | | |
623 | 631 | | |
624 | | - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
625 | 643 | | |
626 | 644 | | |
627 | 645 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1431 | 1431 | | |
1432 | 1432 | | |
1433 | 1433 | | |
1434 | | - | |
| 1434 | + | |
1435 | 1435 | | |
1436 | 1436 | | |
1437 | | - | |
| 1437 | + | |
1438 | 1438 | | |
1439 | 1439 | | |
1440 | 1440 | | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
1441 | 1464 | | |
1442 | 1465 | | |
1443 | 1466 | | |
| |||
1448 | 1471 | | |
1449 | 1472 | | |
1450 | 1473 | | |
| 1474 | + | |
1451 | 1475 | | |
1452 | 1476 | | |
1453 | 1477 | | |
| |||
1467 | 1491 | | |
1468 | 1492 | | |
1469 | 1493 | | |
1470 | | - | |
| 1494 | + | |
1471 | 1495 | | |
1472 | | - | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
1473 | 1505 | | |
1474 | 1506 | | |
1475 | 1507 | | |
| |||
1501 | 1533 | | |
1502 | 1534 | | |
1503 | 1535 | | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
1504 | 1540 | | |
1505 | 1541 | | |
1506 | 1542 | | |
1507 | 1543 | | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
1508 | 1548 | | |
1509 | 1549 | | |
1510 | 1550 | | |
| |||
1529 | 1569 | | |
1530 | 1570 | | |
1531 | 1571 | | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
1532 | 1581 | | |
1533 | 1582 | | |
1534 | 1583 | | |
| |||
1544 | 1593 | | |
1545 | 1594 | | |
1546 | 1595 | | |
| 1596 | + | |
1547 | 1597 | | |
1548 | 1598 | | |
1549 | 1599 | | |
| |||
1563 | 1613 | | |
1564 | 1614 | | |
1565 | 1615 | | |
1566 | | - | |
| 1616 | + | |
1567 | 1617 | | |
1568 | | - | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
1569 | 1627 | | |
1570 | 1628 | | |
1571 | 1629 | | |
| |||
1597 | 1655 | | |
1598 | 1656 | | |
1599 | 1657 | | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
1600 | 1662 | | |
1601 | 1663 | | |
1602 | 1664 | | |
1603 | 1665 | | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
1604 | 1670 | | |
1605 | 1671 | | |
1606 | 1672 | | |
| |||
0 commit comments