-
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
jetty 12: ee10: DefaultServlet: Binary data gets double-encoded via UTF-8 Writer, incomplete transmission #9134
Labels
Bug
For general bugs on Jetty side
Comments
kohlschuetter
added a commit
to kohlschuetter/jetty.project
that referenced
this issue
Jan 7, 2023
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
pushed a commit
that referenced
this issue
Jan 9, 2023
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]>
lorban
added a commit
that referenced
this issue
Jan 9, 2023
Signed-off-by: Ludovic Orban <[email protected]>
lorban
pushed a commit
that referenced
this issue
Jan 10, 2023
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]>
lorban
added a commit
that referenced
this issue
Jan 10, 2023
Signed-off-by: Ludovic Orban <[email protected]>
lorban
pushed a commit
that referenced
this issue
Jan 10, 2023
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]>
lorban
added a commit
that referenced
this issue
Jan 10, 2023
Signed-off-by: Ludovic Orban <[email protected]>
gregpoulos
pushed a commit
to gregpoulos/jetty.project
that referenced
this issue
Jan 16, 2023
…x-document-modules * upstream/jetty-12.0.x: Issue jetty#9167 - making assumption in flaky test jetty 12.0.x cleanup duplicate osgi pom metadata (jetty#9093) Jetty 12 - Add tests in util/resource for alternate FileSystem implementations (jetty#9149) Cleanup non-retainable `Retainable`s (jetty#9159) Fixes retainability of special Chunks (jetty#9073) TCK: Dispatch forward and includes attributes do not meet the spec (jetty#9074) re-enable h3 tests (jetty#8773) More fundamental test case Reorganization of jetty-client classes. (jetty#9127) Removing @disabled from SslUploadTest Removing @disabled from jetty-start jetty#9134 added test ee10: DefaultServlet: Replace checks for isStreaming() by !isWriting() jetty#9078 make HttpContent.getByteBuffer() implementations return new ByteBuffer instances and document that contract Fixes jetty#9141 - Thread-safe Content.Chunk#slice (jetty#9142) Remove `@Disabled` from `jetty-jmx` (jetty#9143) Bump maven.version from 3.8.6 to 3.8.7 Bump maven.version from 3.8.6 to 3.8.7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jetty version(s)
jetty 12.0.x alpha3, HEAD
Java version/vendor
(use: java -version)
openjdk version "18.0.1" 2022-04-19
OpenJDK Runtime Environment Temurin-18.0.1+10 (build 18.0.1+10)
OpenJDK 64-Bit Server VM Temurin-18.0.1+10 (build 18.0.1+10, mixed mode)
OS type/version
macOS 13.1
Description
ee10 DefaultServlet's ServletCoreResponse currently checks "ServletContextResponse#isStreaming()" to determine whether the (potentially binary) data has to be encoded via an existing Writer or can be sent directly as a byte stream.
Unfortunately, isStreaming() returns false when no data has been sent, i.e., even when isWriting() would be false, too.
This causes all sorts of exceptions thrown (sadly only logged at DEBUG level) with messages like
java.io.IOException: written 25746 > 12014 content-length
, for example:The issue can be averted by replacing checks for
isStreaming()
by!isWriting()
.How to reproduce?
In an embedded jetty, try to open a binary file (e.g., favicon.ico) that is served from a resource URL.
The text was updated successfully, but these errors were encountered: