-
Notifications
You must be signed in to change notification settings - Fork 38.5k
MimeType: Multipart Boundary value should allow =
#26698
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
Comments
I just checked, and parsing The reason for not allowing the
So it seems we are dealing with contradictory RFCs here, which is always interesting. What kind of client is sending these boundaries? If it's possible to change the code in order to quote the boundary (multipart/form-data; boundary="===1616056691487==="), then it should work. |
I use spring 4.3.8 (spring boot 1.5.3). I checked myself if The problem was that I switched to the Spring Reactive.
But
private static Mono<MultiValueMap<String, Part>> initMultipartData(ServerHttpRequest request,
ServerCodecConfigurer configurer, String logPrefix) {
try {
MediaType contentType = request.getHeaders().getContentType();
if (MediaType.MULTIPART_FORM_DATA.isCompatibleWith(contentType)) {
return ((HttpMessageReader<MultiValueMap<String, Part>>) configurer.getReaders().stream()
.filter(reader -> reader.canRead(MULTIPART_DATA_TYPE, MediaType.MULTIPART_FORM_DATA))
.findFirst()
.orElseThrow(() -> new IllegalStateException("No multipart HttpMessageReader.")))
.readMono(MULTIPART_DATA_TYPE, request, Hints.from(Hints.LOG_PREFIX_HINT, logPrefix))
.switchIfEmpty(EMPTY_MULTIPART_DATA)
.cache();
}
}
catch (InvalidMediaTypeException ex) {
// Ignore
}
return EMPTY_MULTIPART_DATA;
} The line I see, those RFCs are contradictory :( Thank you for checking. EDIT:
So the header |
I have a similar problem but with MediaType and MultipartParser. My header value let's say is:
I have it set as Content-Type for multipart message and then I try to parse this message.
which is obviously wrong because MultipartParser.this.boundary is quoted and afterwards this frst boundary could not be found. How can it be fixed? Is it a known issue? |
@bekker Ok, good. Unless you think otherwise, I will close this issue. @abialas Are you running the latest version? If not, I believe you ran into #26616, which was fixed in 5.3.5. If you are already running 5.3.5, please report a new issue. |
I also have problem with MimeType. In my case I am using Spring Boot v2.3.7 (spring-core:5.2.12.RELEASE) as proxy to request Geoserver services. Trying to create Edit: |
@pietrucha wrote
That does not look like a valid media type to me. The closest media type that conforms to the specification—which is also accepted by
|
@poutsma thanks. I also found this in rfc2045#secition-5.1. |
Uh oh!
There was an error while loading. Please reload this page.
Some HTTP clients use boundary value including
=
when sending multipart requests, like below:It seems
=
is fine for boundary value per RFC 2046 5.1.1:But
org.springframework.util.MimeType
doesn't allow=
characters, because it is considered as separator.Spring should allow
=
characters for compatibility with such HTTP clients.Edit: It used to work with Spring 4.X (Spring Boot 1.X)
The text was updated successfully, but these errors were encountered: