Thursday, May 21, 2015

Http 1.1 Chunked transfer.

If you inspect the http response with some zipped resources, you may find 2 things. I assure we are on HTTP 1.1. there is no content-length header ins the response, also the transfer-encoding is chunked.

image

and Http 1.1 have a full spec about the chunked encoding, check it here. http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6

if you use node.js , we can write a simple test to try out the chunked transfer. here is the source code

image

and try pull the response using wget. you will notice the 3 seconds delay between Okay3 and 4.

image

and inspect the traffic in between, you can see the wirelevel bits

image

1st response returns Okay1

image

then the 2nd returns2 and 3

image

after 3 seconds delay

we get okay4

image

image

once we call the end , you can see the end trailer.

wireshark are smart enough, to tell you 4 frames invloved in this http req/res

image

No comments:

 
Locations of visitors to this page