Mobile app version of vmapp.org
Login or Join
Kristi941

: What can cause the size of HTTP response to vary for the same response body? I am trying to understand why the web server behaves differently for the following bad requests: Method

@Kristi941

Posted in: #Apache2 #Http

I am trying to understand why the web server behaves differently for the following bad requests:

Method Proto Status Req Body Res Referrer User Agent HTTPS Encrytion
GET / HTTP/1.0 400 11 362 0 - - - -
x80wx01x03x01 400 29 226 0 - -
GET /api/ HTTP/1.0 400 32 226 392 - -
GET / HTTP/1.1 400 316 226 4295 - -
GET / HTTP/1.0 400 735 226 4121 - - TLSv1.2 RC4-SHA
GET example.com/?PHPSESSID=1abcdef0123456ABCD_EFGHI HTTP/1.1 400 167 226 392 - -
GET /HNAP1/ HTTP/1.1 400 369 226 392 1.2.3.4/ Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; .NET CLR 1.0.1234)
GET example.net/headers HTTP/1.1 400 423 226 392 - Mozilla/5.0 (X11; Ubuntu; Linux i686 on x86_64; rv:20.0) Gecko/20100101 Firefox/20.0


I do not understand why the server is returning 0 byte for first and second request and why it is returning more than 4kB in the the 4th and 5th request when the normal size is exactly 392 bytes.

Note that I do not have any custom error page for HTTP error code 400.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Kristi941

2 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

These are all 400 (Bad Request) responses. It seems likely that your web server would include some information about what with the request is bad. That could account for much of the size variance.

In the case of the zero response size, it seems likely that the connection was closed before the response was sent.

10% popularity Vote Up Vote Down


 

@Moriarity557

Request headers can cause the size of responses to vary. For example if the requesting device or browser allows for Gzip encoding they will let your webserver know that they want the content in gzip format which is a lot smaller. Also pages which are dynamically generated can vary in size. In your example you have /api/. Unless if your api is pumping out a static page (not likely) then you are going to get different size headers.

Pretty much anything that modifies the response (the page, or the encoding of the page) or anything which modifies the request (user agent, accept headers) will change the sizes of these headers. Your best bet is not to worry about it, as it is the norm.

Where you should pay attention is the request sizes for static items such as JS, CSS and images. That is where you do your performance tweaking to begin with, and then move down the chain to different bottlenecks (usually in code).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme