Skip to content

fix: RFC-compliant HTTP reason phrases in QtHttpReply#1510

Merged
awawa-dev merged 1 commit intoawawa-dev:masterfrom
joeshull:fix/http-status-reason-phrases
Apr 12, 2026
Merged

fix: RFC-compliant HTTP reason phrases in QtHttpReply#1510
awawa-dev merged 1 commit intoawawa-dev:masterfrom
joeshull:fix/http-status-reason-phrases

Conversation

@joeshull
Copy link
Copy Markdown
Contributor

Summary

QtHttpReply::getStatusTextForCode returns reason phrases with non-standard punctuation:

Code Before After
200 OK. OK
400 Bad request ! Bad Request
403 Forbidden ! Forbidden
404 Not found ! Not Found

RFC 7230 §3.1.2 defines the status line as HTTP-version SP status-code SP reason-phrase CRLF. Reason phrases with punctuation like trailing periods and exclamation marks cause strict HTTP parsers to treat the response as malformed. Concretely, Caddy's reverse_proxy directive returns a zero-length body to the client when it receives these non-standard status lines.

The fix normalises all four phrases to the IANA-registered strings.

What kind of change does this PR introduce?

  • Bugfix

Does this PR introduce a breaking change?

  • No

Other information:

Verified end-to-end: built from source in Docker, confirmed nc probe returns HTTP/1.1 200 OK (no trailing period), and Caddy reverse_proxy now forwards non-empty response bodies.

Remove punctuation from status reason phrases (OK., Bad request !, etc.)
to comply with RFC 7230 §3.1.2. Non-standard phrases caused Caddy and
other reverse proxies to drop response bodies.
@awawa-dev
Copy link
Copy Markdown
Owner

awawa-dev commented Apr 12, 2026

reason-phrase = *( HTAB / SP / VCHAR / obs-text )

It seems both . and ! are legit as VCHAR (any visible USASCII character) so in fact it's Caddy issue

@awawa-dev awawa-dev merged commit 77e6529 into awawa-dev:master Apr 12, 2026
19 checks passed
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.

2 participants