Skip to content

Fix extra blank line when serializing empty header#145

Merged
kevinresol merged 1 commit into
haxetink:masterfrom
kevinresol:fix/header-toString-blank-line
Jul 13, 2026
Merged

Fix extra blank line when serializing empty header#145
kevinresol merged 1 commit into
haxetink:masterfrom
kevinresol:fix/header-toString-blank-line

Conversation

@kevinresol

Copy link
Copy Markdown
Member

Header.toString() appended two \r\n after the (empty) field list, so a message with no header fields serialized with an extra blank line, e.g. GET / HTTP/1.1\r\n\r\n\r\n. Per RFC 7230 §3, the header section is terminated by a single empty line.

The field block is now built as field + CRLF per field followed by one terminating CRLF, producing GET / HTTP/1.1\r\n\r\n for empty headers while leaving messages that do have fields unchanged (they still end with a single blank line after the last field).

Updated the TestHeader variants that asserted the old triple-CRLF empty-header form.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@kevinresol
kevinresol merged commit 52a438e into haxetink:master Jul 13, 2026
10 of 15 checks passed
@kevinresol
kevinresol deleted the fix/header-toString-blank-line branch July 14, 2026 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant