How to get the 'Content-Length' please? #21488
-
How to get the
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
The answer is right there on the page you linked:
And I’d question the claim that it’s “usually” there. For static data that’s true, but dynamically generated data will pretty often be sent without a Content-Length header, using chunked encoding. |
Beta Was this translation helpful? Give feedback.
-
So, how can one get the |
Beta Was this translation helpful? Give feedback.
-
You can’t get a header the server never sent. If you need the length of |
Beta Was this translation helpful? Give feedback.
-
OK, many thanks for that! I wasnt quite sure to be honest. I looks like an important piece of info to be left out |
Beta Was this translation helpful? Give feedback.
You can’t get a header the server never sent. If you need the length of
the received data you can calculate that after receiving all of it. Note
however that some HTTP responses may not have an end, e.g. when
receiving an audio or video stream (depending on the format).