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

ee10: DefaultServlet: Replace checks for isStreaming() by !isWriting() #9135

Conversation

kohlschuetter
Copy link
Contributor

Checking for isStreaming() will return false even when no data has been written yet. This erroneously triggers double-encoding of binary data in a Writer.

If the Writer is not set to ISO-8859-1 or similar, the output will be corrupted, causing errors like "java.io.IOException: written 25746 > 12014 content-length", and interrupted transmissions.

Replace the isStreaming() check by !isWriting().

#9134

Signed-off-by: Christian Kohlschütter [email protected]

Checking for isStreaming() will return false even when no data has been
written yet. This erroneously triggers double-encoding of binary data in
a Writer.

If the Writer is not set to ISO-8859-1 or similar, the output will be
corrupted, causing errors like "java.io.IOException: written
25746 > 12014 content-length", and interrupted transmissions.

Replace the isStreaming() check by !isWriting().

jetty#9134

Signed-off-by: Christian Kohlschütter <[email protected]>
@lorban
Copy link
Contributor

lorban commented Jan 9, 2023

This change is missing a test, could you please add one? org.eclipse.jetty.ee10.servlet.DefaultServletTest seems like the proper recipient for it.

@kohlschuetter
Copy link
Contributor Author

I'm a bit short-staffed at the moment (this bug fix is a contribution out of my spare free time). Was the previous (broken) code not covered by a test?

@lorban lorban added the Bug For general bugs on Jetty side label Jan 9, 2023
@lorban lorban self-assigned this Jan 9, 2023
@lorban
Copy link
Contributor

lorban commented Jan 9, 2023

@kohlschuetter I've re-done your PR after adding a test, it's now here.

If you're happy with it, I'll close this PR and move forward with the new one.

@kohlschuetter
Copy link
Contributor Author

Great, thanks @lorban!

@lorban
Copy link
Contributor

lorban commented Jan 9, 2023

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jetty 12: ee10: DefaultServlet: Binary data gets double-encoded via UTF-8 Writer, incomplete transmission
2 participants