Skip to content

Support of \r\n characters in HTTP Headers as per HTTP 1.1 as per RFC 2616 sec 2.2 #61472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
praveensri opened this issue Apr 13, 2025 · 2 comments
Open
1 task done
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Comments

@praveensri
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

The library breaks the scenario if HTTP headers uses the CRLF characters in the header. It is common in MIME transfer
"Content-Type": "multipart/report;\r\n\treport-type="disposition-notification";\r\n\tboundary="d9f60885-8cd2-4516-bc47-858c3c14d2aa""
The above content type is valid as per RFC
We addressed \t characters in the following PR but not other control characters US-ASCII (10 and 13)
#40633

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Apr 13, 2025
@MihaZupan
Copy link
Member

Notably such values in headers aren't interpreted as new lines, but as regular spaces, so a workaround of replacing these characters with spaces is valid.

As far as actually sending such characters over the wire, note that RFC 2616 was superseded by RFC 7230 (2014), which was in turn superseeded by RFC 9112.
Both call the feature "obsolete" and warn against using it:

A sender MUST NOT generate a message that includes line folding (i.e., that has any field line value that contains a match to the obs-fold rule) unless the message is intended for packaging within the "message/http" media type.

@praveensri
Copy link
Author

praveensri commented Apr 14, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

No branches or pull requests

2 participants