Avoid chunked transfer-encoding when streaming live content with a CGI
Added by jonob23 over 15 years ago
Hi all,
I have a CGI written in C that reads Live content and tries to output it in an HTTP answer.
In the client side I would like to receive the octet-stream directly without any transformation as the client is a very simple platform, but it seems that Lighttpd is converting the body into chunked encoded content.
When generating the answer in the CGI I specify:
Content-Type: application/octet-stream
Transfer-Encoding: identity
But in the client side I receive:
Content-Type: application/octet-stream
Transfer-Encoding: chunked
I have also tried to specify the following in the GET message from the client:
Accept-Encoding: identity
But it seems as if Lighttpd ignores this and always sends chunked data when the length of the content cannot be specified in advance.
A possible workaround is to specify a very big "Content-Length" when generating the answer's header, then the content is not "chunked", and the Live is streamed without any transformation. But I would like to know if there is a way to force the not chunked transmission.
Thanks,
Jon
Replies (5)
RE: Avoid chunked transfer-encoding when streaming live content with a CGI - Added by jonob23 over 15 years ago
I've forgot to specify the configuration I am using.:
- The server: it's a Linux machine running the Ubuntu 9.04 distribution
- Version of Lighttpd: 1.4.25
- Client: an embedded system that retrieves the HTTP messages directly reading in a socket (running a Linux kernel).
RE: Avoid chunked transfer-encoding when streaming live content with a CGI - Added by erlo over 15 years ago
Hello,
I have the same issue... My cgi return a picture to stdout, and lighttpd send it using Transfer-Encoding: chunked... Any solution to avoid this behaviour ?
Version of Lighttpd: 1.4.19-5 (debian lenny package)
Thanks.
RE: Avoid chunked transfer-encoding when streaming live content with a CGI - Added by stbuehler over 15 years ago
If your client can't handle chunked content it shouldn't announce itself as "HTTP/1.1" client.
RE: Avoid chunked transfer-encoding when streaming live content with a CGI - Added by erlo over 15 years ago
Actually I've found a solution for my problem. I manually add a "Content-Length" header before the binary content.
My client is Squid, which is only HTTP/1.0 compliant, and the result is that final client received a "Connection: close" (which is normal without the content-length) and not a "Keep-Alive" ...
Thanks for all!
RE: Avoid chunked transfer-encoding when streaming live content with a CGI - Added by nitrox over 15 years ago
Try "squid_http11 on", tho squid only partly supports 1.1 its working pretty well on 2.7.x.