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

MimeTypeUtils.parseMimeType should ignore an inner ";" inside a quoted value [SPR-14986] #19552

Closed
spring-projects-issues opened this issue Dec 6, 2016 · 0 comments
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Dec 6, 2016

Michal Polák opened SPR-14986 and commented

I am not able to handle a request by Spring MVC, when the request is sent with this HTTP header:

Content-Type: application/xop+xml;charset=utf-8;type="application/soap+xml;action=\"http://katastr.cuzk.cz/nv/v2.9/NavrhyNaVklad/vratCiselniky\"" 

(btw it is generated by JaxWS-RI)

I think the Content-type value is correct, see

https://tools.ietf.org/html/rfc822
https://www.w3.org/Protocols/rfc1341/4_Content-Type.html

IMHO a "quoted-string" can contain the semicolon (";")

The problem code is on the begin in the MimeTypeUtils.parseMimeType:

String[] parts = StringUtils.tokenizeToStringArray(mimeType, ";");

How to reproduce:

final String contentType = "application/xop+xml;charset=utf-8;type=\"application/soap+xml;action=\\\"http://katastr.cuzk.cz/nv/v2.9/NavrhyNaVklad/vratCiselniky\\\"\"";
final org.springframework.util.MimeType mt = org.springframework.util.MimeTypeUtils.parseMimeType(contentType);

Result:

Exception in thread "main" org.springframework.util.InvalidMimeTypeException: Invalid mime type "application/xop+xml;charset=utf-8;type="application/soap+xml;action=\"http://katastr.cuzk.cz/nv/v2.9/NavrhyNaVklad/vratCiselniky\""": Invalid token character '"' in token ""application/soap+xml"
	at org.springframework.util.MimeTypeUtils.parseMimeType(MimeTypeUtils.java:266)

Affects: 4.3.4

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.