mod_wsgi icon indicating copy to clipboard operation
mod_wsgi copied to clipboard

Content-Length ? Header not!

Open koliboy opened this issue 3 years ago • 9 comments

koliboy avatar Oct 18 '22 17:10 koliboy

Are you going to supply any actual information about the issue?

GrahamDumpleton avatar Oct 18 '22 19:10 GrahamDumpleton

yes ! after get mysite
reponse --> Transfer-Encoding: chunked

i change header filed Content-Length wsgi script but Not reponse Content-length Why http server apache httpd install mod_wsgi https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding help

koliboy avatar Oct 19 '22 17:10 koliboy

HTTP/1.1 200 ok Date: Wed, 19 Oct 2022 17:24:47 GMT Server: Apache/2.4.41 (Ubuntu) Vary: Accept-Encoding Content-Encoding: gzip Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html;charset=utf-8

koliboy avatar Oct 19 '22 17:10 koliboy

missing Content-Length

koliboy avatar Oct 19 '22 17:10 koliboy

('Content-Length',length)

koliboy avatar Oct 19 '22 17:10 koliboy

i want sponser how to

koliboy avatar Oct 19 '22 17:10 koliboy

By definition, when using chunked encoding there is no content length header. It is specifically for cases where you don't know the content length up front. So from that doc you will see example output of:

HTTP/1.1 200 OK
Content-Type: text/plain
Transfer-Encoding: chunked

7\r\n
Mozilla\r\n
9\r\n
Developer\r\n
7\r\n
Network\r\n
0\r\n
\r\n

The 0 block at the end is what dictates when there is no more response content, not a content length.

GrahamDumpleton avatar Oct 19 '22 19:10 GrahamDumpleton

But how does the content length appear?

koliboy avatar Oct 19 '22 21:10 koliboy

It doesn't. The client would keep reading blocks until it sees the 0 length block, at which point it would sum up the length of all the blocks if it really needed to know the final length, or more likely to work out if it got complete response before connection was dropped. Ie., connection dropped before saw 0 length block.

If that doesn't explain it am not sure what you are asking.

GrahamDumpleton avatar Oct 19 '22 22:10 GrahamDumpleton