Commit fdfbbae
committed
feat: optimize H1 hot path and fix remote HTTPS compatibility
Performance optimizations for HTTP/1.1:
- Pre-map 20 common response header atoms to constant binaries,
eliminating atom_to_binary + string:lowercase per header
- Replace list-comprehension header validators with zero-alloc
tail-recursive loops
- Single-pass scan for default headers (host, content-length,
connection, user-agent) instead of 3 separate keyfind calls
- Avoid extra 13-element conn record copy on fast body path
- Replace Acc ++ Responses with reverse accumulator throughout
response parsing
- Let OS auto-tune TCP buffer sizes instead of hardcoding 64KB
Bug fixes:
- Add explicit server_name_indication (SNI) in gen_http_ssl:connect/3
so reverse proxies like Fly.io can route TLS connections correctly
- Send default user-agent header per RFC 9110 Section 10.1.5;
Fly.io returns 402 without one
- Handle already-closed socket gracefully in gen_http_h2:send_frame/2
instead of crashing with MatchError1 parent cfc6236 commit fdfbbae
5 files changed
Lines changed: 529 additions & 194 deletions
0 commit comments