Commit ab7eee3
optimize: avoid pcall when validating the Connection response header
Previously the Connection header was lowercased via pcall(str_lower, ...)
to tolerate a nil header, but pcall carries non-trivial overhead on the
hot response path.
Check the header type directly instead: only lowercase and parse it when
it is a string. A nil header (no Connection) or a table (duplicated
header) falls back to the default keepalive handling, matching the
previous pcall behaviour.1 parent 7837f60 commit ab7eee3
1 file changed
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
798 | 798 | | |
799 | 799 | | |
800 | 800 | | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
805 | 805 | | |
806 | 806 | | |
807 | 807 | | |
808 | | - | |
809 | | - | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
810 | 811 | | |
811 | 812 | | |
812 | 813 | | |
| |||
0 commit comments