Skip to content
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

Handling of null Content-Type #337

Closed
jmpease opened this issue Apr 5, 2017 · 2 comments
Closed

Handling of null Content-Type #337

jmpease opened this issue Apr 5, 2017 · 2 comments
Labels

Comments

@jmpease
Copy link

jmpease commented Apr 5, 2017

If the Content-Type header is not set in the response, we receive an ArgumentNullException at https://github.com/turquoiseowl/i18n/blob/master/src/i18n/LocalizedApplication.cs#L336

If I'm interpreting RFC 2616 Section 7.2.1 [1] correctly, the following excerpt implies that this header is not required, and only recommended for responses containing a non-empty body:

Any HTTP/1.1 message containing an entity-body SHOULD include a
Content-Type header field defining the media type of that body. If
and only if the media type is not given by a Content-Type field, the
recipient MAY attempt to guess the media type via inspection of its
content and/or the name extension(s) of the URI used to identify the
resource. If the media type remains unknown, the recipient SHOULD
treat it as type "application/octet-stream".

This appears to be a bug that could be fixed with a simple null check, but am wondering if this has already been encountered/considered and there is a configuration option we may be overlooking. At the moment we're working around this by setting the header if empty to "text/plain" in HttpApplication.PostRequestHandlerExecute.

1 - https://tools.ietf.org/html/rfc2616#section-7.2.1

@turquoiseowl
Copy link
Owner

Looks like a bug and there should be a null check. Happy to merge a fix - bit tied up at the moment.

turquoiseowl added a commit that referenced this issue Sep 4, 2020
@vhatuncev
Copy link
Contributor

@turquoiseowl this can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants