How is the value of the Content-Length header calculated?

So if I have a request containing only the number 1 in the body the length of the request equals to 1 but if the requests looks like this:
b1

the length is 6, why? I only see 2 characters and an empty line

Furthermore if the request looks like this:
b2

the length is 10, again, I don’t understand why. The last request did not include any empty lines and there are only 4 characters in the request, where do the 6 rest come from?

Thank you in advance

Every line except the last one ends with “\r\n” (0x0d 0x0a), which takes two bytes. There’s an option in burp to display those special characters.

2 Likes

Thank you for the fast reply! Much appreciated