Dont chunk server responses

856 views
Skip to first unread message

Paul Carter-Brown

unread,
Feb 2, 2021, 10:54:22 AM2/2/21
to Quarkus Development mailing list
Hi,

We have an API which Facebook calls to download dynamic media from us (JAX-RS using standard Resteasy plugin). Unfortunately they cannot deal with a server which responds with chunked content - they have to see the content-length header. In our code, we have the byte[] we need to respond with but as soon as it goes over 8191 bytes, then our response no longer has content-length header and they fail.

Code snippet:
byte[] body = getBodyToRespondWith();
return Response.ok(body,"image/png").build(); 

If we try and set the content-length header manually on the response, then Quarkus removes it and sets transfer-encoding: chunked instead.

I've tried changing quarkus.http.limits.max-chunk-size to a much higher value but it does not seem to impact this behaviour.

I'm at a complete loss as to how to resolve this. Telling facebook to properly implement their HTTP client is not an option unfortunately :-(

Paul

Stuart Douglas

unread,
Feb 2, 2021, 5:24:25 PM2/2/21
to Paul Carter-Brown, Quarkus Development mailing list
On Wed, 3 Feb 2021 at 02:54, Paul Carter-Brown <pa...@ukheshe.com> wrote:
Hi,

We have an API which Facebook calls to download dynamic media from us (JAX-RS using standard Resteasy plugin). Unfortunately they cannot deal with a server which responds with chunked content - they have to see the content-length header. In our code, we have the byte[] we need to respond with but as soon as it goes over 8191 bytes, then our response no longer has content-length header and they fail.

Code snippet:
byte[] body = getBodyToRespondWith();
return Response.ok(body,"image/png").build(); 

If we try and set the content-length header manually on the response, then Quarkus removes it and sets transfer-encoding: chunked instead.

I just tested this and it works fine:


Is there something different about your app that causes it to be removed?
 

I've tried changing quarkus.http.limits.max-chunk-size to a much higher value but it does not seem to impact this behaviour.


If you were using Undertow you can increase quarkus.servlet.buffer-size to be larger than your response.

Stuart
 

I'm at a complete loss as to how to resolve this. Telling facebook to properly implement their HTTP client is not an option unfortunately :-(

Paul

--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAO8YPTSWr0ce08bJUfLtUUohi3CDxMC2GJHe4O%3DWKxShiNGFrw%40mail.gmail.com.

Stuart Douglas

unread,
Feb 2, 2021, 5:48:51 PM2/2/21
to Paul Carter-Brown, Quarkus Development mailing list
On Wed, 3 Feb 2021 at 09:24, Stuart Douglas <sdou...@redhat.com> wrote:


On Wed, 3 Feb 2021 at 02:54, Paul Carter-Brown <pa...@ukheshe.com> wrote:
Hi,

We have an API which Facebook calls to download dynamic media from us (JAX-RS using standard Resteasy plugin). Unfortunately they cannot deal with a server which responds with chunked content - they have to see the content-length header. In our code, we have the byte[] we need to respond with but as soon as it goes over 8191 bytes, then our response no longer has content-length header and they fail.

Code snippet:
byte[] body = getBodyToRespondWith();
return Response.ok(body,"image/png").build(); 

If we try and set the content-length header manually on the response, then Quarkus removes it and sets transfer-encoding: chunked instead.

I just tested this and it works fine:


Is there something different about your app that causes it to be removed?
 

I've tried changing quarkus.http.limits.max-chunk-size to a much higher value but it does not seem to impact this behaviour.


Reply all
Reply to author
Forward
0 new messages