Open SaitoLi opened 1 year ago
Do you have a way to repro? A public server we can hit?
Do you have a way to repro? A public server we can hit?
Sorry for the late reply. Due to our internal policy, we are not able to share the test links. I think you can try using a boundary containing ':' symbol, and create a ResponseBody object as a test case to verify if the following code can obtain the correct result
boundary = response.contentType()?.parameter("boundary")
?: throw ProtocolException("expected the Content-Type to have a boundary parameter")
Looks like :
is permitted when the boundary is in a quoted-string.
We need to fix OkHttp’s MultipartBody
, to quote boundary
when necessary. See RFC 2045 section 5.1.
Cloudfront needs to either quote the boundary parameter or use a character other than :
.
You can work-around by re-writing the Content-Type
header to add quotes around the boundary parameter. Should be straightforward if you’re good with regex.
I found that when using CloudFront CDN and OkHttp for Multipart requests, CloudFront CDN added the 'CloudFront:' field in the boundary, which caused the value of boundary to be null when building MultipartReader. It seems that the cause of the issue is due to the toMediaType method in MediaType not including ':' in its regular expression, causing it to fail. Could you kindly advise on how to solve this problem? okhttp 4.9.x
the response be like:
and MediaType not including ':'