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

fix: space character problem when parsing content-type #310

Merged
merged 1 commit into from
Nov 3, 2024

Conversation

zruhao
Copy link
Contributor

@zruhao zruhao commented Nov 2, 2024

Solve the problem that the response cannot be formatted when the content-type contains spaces, such as content-type: application/json ; charset=utf-8

@Grueslayer
Copy link
Contributor

@zruhao As your fix does not harm kulala, your example is not valid. Since the first RFC 822, there is no space allowed

Content-Type := type "/" subtype *[";" parameter] 

type :=          "application"     / "audio" 
          / "image"           / "message" 
          / "multipart"  / "text" 
          / "video"           / x-token 

x-token := <The two characters "X-" followed, with no 
           intervening white space, by any token> 

subtype := token 

parameter := attribute "=" value 

attribute := token 

value := token / quoted-string 

token := 1*<any CHAR except SPACE, CTLs, or tspecials> 

tspecials :=  "(" / ")" / "<" / ">" / "@"  ; Must be in 
           /  "," / ";" / ":" / "\" / <">  ; quoted-string, 
           /  "/" / "[" / "]" / "?" / "."  ; to use within 
           /  "="                        ; parameter values

@gorillamoe gorillamoe merged commit 70001fe into mistweaverco:main Nov 3, 2024
3 checks passed
@gorillamoe gorillamoe added the enhancement New feature or request label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants