mirror of
https://github.com/fosrl/gerbil.git
synced 2026-09-27 16:29:06 +02:00
When a trusted upstream sends "PROXY UNKNOWN\r\n", parseProxyProtocolHeader returned the raw connection and discarded whatever followed the header in the same read. The TLS ClientHello usually arrives in that same segment, so it was lost, the SNI extraction failed on the truncated stream, and the connection was dropped. The 5s parsing read deadline was also left set on this path. Wrap the connection so the remaining buffered bytes are replayed ahead of the socket, and clear the read deadline, matching the other header branches.