-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Gzip compression not working for multipart/form-data when added to the allowed list using addIncludedMimeTypes. #7567
Comments
You should do 2 things. First upgrade your version of Jetty. Next, configure your |
@joakime - We already have RFC7578 compliance and the new version also doesn't work, getting the same error. It is due to the boundary field not being stripped when doing the comparison. The comparison is an exact string match. Our multipart content type(multipart/form-data;boundary=Boundary_2_393478717_1644530275023) is according to the spec. Btw, this is the compression on the response from server to client (not the request). Any other thoughts? |
@lachlan-roberts can you take a look? |
@rjonna I think the comparison of the mime type should be done without the parameters. You could possibly work around this by excluding the mime types you don't want to gzip instead of including the ones you do. But I will propose a fix for this in a PR. |
…ndler Signed-off-by: Lachlan Roberts <[email protected]>
…eSet Signed-off-by: Lachlan Roberts <[email protected]>
@lachlan-roberts - Yes, mime type comparison has to be done without the parameters. Thanks so much for the quick fix. |
…ndler Signed-off-by: Lachlan Roberts <[email protected]>
Issue #7567 - don't compare params when checking MIME type for GzipHandler
Issue #7567 - don't compare params when checking MIME type for GzipHandler (9.4)
I have merged the fix to |
Thank you so much. |
…ndler Signed-off-by: Lachlan Roberts <[email protected]>
…eSet Signed-off-by: Lachlan Roberts <[email protected]>
Jetty version(s)
9.4.22.v20191022
Java version/vendor
(use: java -version)
openjdk 16.0.1 2021-04-20
OS type/version
Linux
Description
When multipart/form-data is added to the allowed list using addIncludedMimeTypes, compression is not being applied because of the boundary parameter. Getting the following error.
2022-02-10 21:57:55,024 DEBUG [qtp112619572-112] org.eclipse.jetty.server.handler.gzip.GzipHttpOutputInterceptor - org.eclipse.jetty.server.handler.gzip.GzipHttpOutputInterceptor@3e373008 exclude by mimeType multipart/form-data;boundary=Boundary_2_393478717_1644530275023
Included it like this:
The comment for addIncludedMimeTypes says "@param types The mime types to include (without charset or other parameters)" but only charset is being removed but not the boundary. https://github.com/eclipse/jetty.project/blob/jetty-10.0.x/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java#L697
Usually, multipart/form-data is followed by other parameters and other parameters are not removed while checking the condition, hence compression is likely to always fail for multipart/form-data when added to the allowed list.
Is this a bug? Is there any work around?
The text was updated successfully, but these errors were encountered: