tags:

views:

806

answers:

4

How many bytes of data does a typical HTTP get request consume. For instance if I request a page from the server through a browser how many bytes of data would be sent?

+5  A: 

Use Fiddler to intercept the request and see for yourself.

Mehrdad Afshari
wouldn't it be easier not to answer at all instead disguising the *fsck off* as an answer? ;-)
Michael Krelin - hacker
@hacker: I meant it as a serious answer. The request size can vary so nobody can provide a definite answer to the question. I mentioned a method and actually provided a link to Fiddler. How this answer is *fsck off*?
Mehrdad Afshari
Well, you suggested to *see for yourself*. Although that is definitely superior technique that both you and me would employ, this is not even an attempt on estimation (of course you can't provide a definite answer!). I do not really see your answer as *wrong* or *bad*, I just don't see it as an *answer* ;-) I was tempted to do it myself, but I would put it as comment then. And yes, you can disagree with me on that, that's fine ;-)
Michael Krelin - hacker
hacker: If I'd written "Intercept the request and see for yourself," I would post it as a comment. However, I believe an answer is something that solves the OP's problem, directly or indirectly. This is a method for solving the actual problem OP has, and therefore, is a valid answer IMO.
Mehrdad Afshari
Mahrdad, well, that makes sense.
Michael Krelin - hacker
A: 

It varies, especially when it comes to GET queries or POST requests, but I'd estimate it about 0.5—1k.

Requesting a page from the browser, though, may also result in requesting pictures, stylesheets and other referenced content.

Edit: originally I put in the estimation for request+reply.

Michael Krelin - hacker
+2  A: 

I would suggest you use a full packet sniffer like wireshark. You would love it :)

Get it here: http://www.wireshark.org/

Crimson
+5  A: 

Pretty typical request, 430 bytes:

GET /ga.js HTTP/1.1\r\n
Host: www.google-analytics.com\r\n
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)\r\n
Accept: */*\r\n
Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
Keep-Alive: 300\r\n
Connection: keep-alive\r\n
Referer: http://stackoverflow.com/\r\n
If-Modified-Since: Mon, 31 Aug 2009 17:13:58 GMT\r\n
\r\n
\r\n

Request with a long query string and a small cookie 657 bytes)

GET /pixel;r=978178957;fpan=0;fpa=1241112640-44259546-69321280;ns=0;url=http%3A%2F%2Fstackoverflow.com%2F;ref=;ce=1;je=1;sr=1920x1200x32;dg=E5912-W-MO-5;dst=1;et=1252061014745;tzo=-120;a=p-c1rF4kxgLUzNc HTTP/1.1\r\n
Host: pixel.quantserve.com\r\n
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)\r\n
Accept: image/png,image/*;q=0.8,*/*;q=0.5\r\n
Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n
Keep-Alive: 300\r\n
Connection: keep-alive\r\n
Referer: http://stackoverflow.com/\r\n
Cookie: uid=1274108650-45267447-66848880; mc=1137458542-57565784-88898864\r\n
\r\n
\r\n
nos
How did you get to that figure?
Kevin Boyd
I sniffed it with tcpdump and counted the bytes in the headers with some standard unix tools.
nos
Thanks! for elaborate header packet dump.
Kevin Boyd