Discussion:
How to remove "Transfer-Encoding" with http 204
Alf Kristian Støyle
2017-05-18 06:32:37 UTC
Permalink
Hi!

We are using aleph behind a varnish cache (https://varnish-cache.org/)
which is an extremly fast and reliable cache. But it is also somewhat
annoying at times :)

Right now we've encountered a problem where we are service http 204, that
is, we are actually proxying something serving a 204. There is no content
here, but aleph puts on a Transfer-Encoding header regardless. I suspect it
is since we are actually returning a manifold, and we have a fully async
stack.

Is there any way to instruct aleph not to add transfer-encoding here? I
could always set up a separate "synchronous" endpoint, but it seems
overkill... Also kind of think this is a minor bug. I would be happy to
provide a PR, if you'd like this change, and point me in the right
direction.

Best regards,
Alf
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Zach Tellman
2017-05-18 06:43:48 UTC
Permalink
The issue here is either that Aleph's HTTP client returns empty, but
non-nil, bodies for 204 responses, or that Aleph's HTTP server logic
doesn't ignore the body on 204 responses. Possibly both. I would be happy
to accept changes that addressed either of these, but in the meantime you
can work around this by doing something like:

(d/chain rsp
(fn [{:keys [status] :as rsp}]
(if (= 204 status)
(dissoc rsp :body)
rsp)))

Hope that helps,
Zach
Post by Alf Kristian Støyle
Hi!
We are using aleph behind a varnish cache (https://varnish-cache.org/)
which is an extremly fast and reliable cache. But it is also somewhat
annoying at times :)
Right now we've encountered a problem where we are service http 204, that
is, we are actually proxying something serving a 204. There is no content
here, but aleph puts on a Transfer-Encoding header regardless. I suspect it
is since we are actually returning a manifold, and we have a fully async
stack.
Is there any way to instruct aleph not to add transfer-encoding here? I
could always set up a separate "synchronous" endpoint, but it seems
overkill... Also kind of think this is a minor bug. I would be happy to
provide a PR, if you'd like this change, and point me in the right
direction.
Best regards,
Alf
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Alf Kristian Støyle
2017-05-18 07:24:40 UTC
Permalink
Ah, makes sense, and yes, it helps. I will have a look the the aleph
codebase, to see if I can provide a change for this.

Thanks for the quick reply! :)

Best regards,
Alf
Post by Zach Tellman
The issue here is either that Aleph's HTTP client returns empty, but
non-nil, bodies for 204 responses, or that Aleph's HTTP server logic
doesn't ignore the body on 204 responses. Possibly both. I would be happy
to accept changes that addressed either of these, but in the meantime you
(d/chain rsp
(fn [{:keys [status] :as rsp}]
(if (= 204 status)
(dissoc rsp :body)
rsp)))
Hope that helps,
Zach
Post by Alf Kristian Støyle
Hi!
We are using aleph behind a varnish cache (https://varnish-cache.org/)
which is an extremly fast and reliable cache. But it is also somewhat
annoying at times :)
Right now we've encountered a problem where we are service http 204, that
is, we are actually proxying something serving a 204. There is no content
here, but aleph puts on a Transfer-Encoding header regardless. I suspect it
is since we are actually returning a manifold, and we have a fully async
stack.
Is there any way to instruct aleph not to add transfer-encoding here? I
could always set up a separate "synchronous" endpoint, but it seems
overkill... Also kind of think this is a minor bug. I would be happy to
provide a PR, if you'd like this change, and point me in the right
direction.
Best regards,
Alf
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...