estimating size of reply HTTP headers
- by Guanidene
I am trying to download a file via a basic socket connection, using a HTTP GET request. So, I have to specify how many bytes of data coming in I have to read from the socket. However, I am having trouble deciding the amount of data (say, in bytes) the server would reply back with. I know that there is a "Content-Length" field in the reply sent by server, but that gives me the size of the actual data (without the http headers).
Is there a way to get the exact size of HTTP headers sent by the server or an estimation is required?
(I am doing this for downloading on a mobile network, where every bit of data matters in terms of time and money, so I don't wish to make an unnecessary larger estimate of the header size.)