Can anyone explain how do I calculate the content length in a http response? I do see the content length header with some value in the server response but would like to validate it. Is there any manual way? I tried adding the tcp lengths of all previous packets including the http response with the status code but guess I need to subtract http header from the last packet. Please help! asked 25 Sep '12, 20:28 yogeshdg |
One Answer:
The HTTP header ends with an empty line ("CR/LF/CR/LF", 0d0a0d0a). The content of the HTTP body starts at the first byte after the "CR/LF/CR/LF". So count the bytes from that point. If all is well, the byte pointed to by the content length header should indeed be the last byte of the object being served by the HTTP server. answered 26 Sep '12, 01:19 SYN-bit ♦♦ |
Thanks. That makes sense. Appreciate your help. I didn't notice this:)(