estimating size of reply HTTP headers
        Posted  
        
            by 
                Guanidene
            
        on Super User
        
        See other posts from Super User
        
            or by Guanidene
        
        
        
        Published on 2012-03-23T09:56:46Z
        Indexed on 
            2012/03/23
            11:33 UTC
        
        
        Read the original article
        Hit count: 311
        
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.)
© Super User or respective owner