Skip to content

Text responses are not chunked #49942

@fedinskiy

Description

@fedinskiy

Describe the bug

I have an app with two almost identical http endpoints. One of them returns a text string, another — the same string, but wrapped in ByteArrayInputStream. When I use options quarkus.http.limits.max-chunk-size
and quarkus.rest.output-buffer-size, the second endpoint returns chunked responses, but the first one does not.

Expected behavior

Both responses are chunked, since the application has compression disabled and neither the original RFC[1] nor Quarkus documentation[2][3] mention any exceptions for text data.

[1] https://datatracker.ietf.org/doc/html/rfc9112#section-7.1
[2] https://quarkus.io/guides/http-reference
[3] https://quarkus.io/guides/rest

Actual behavior

The application/octet-stream response is chunked, the text/plain is not

How to Reproduce?

  1. git clone -b chunking [email protected]:fedinskiy/reproducer.git && cd reproducer
  2. mvn clean quarkus:dev
  3. Check the streamed endpoint:
$ curl -i localhost:8080/stream | head -n 5
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1178    0  1178    0     0  89262      0 --:--:-- --:--:-- --:--:-- 90615
HTTP/1.1 200 OK
Content-Type: application/octet-stream
transfer-encoding: chunked

Hello no.1
  1. Check the text endpoint:
$ curl -i localhost:8080/text | head -n 5
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1178  100  1178    0     0   172k      0 --:--:-- --:--:-- --:--:--  191k
HTTP/1.1 200 OK
Content-Type: text/plain;charset=UTF-8
content-length: 1178

Hello no.1

Output of uname -a or ver

6.16.4-200.fc42.x86_64

Output of java -version

Java version: 21.0.8, vendor: Eclipse Adoptium

Quarkus version or git rev

b1bb7ad

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.6

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions