file - How HTTP downloads are segmented inside TCP packets? -


i'm trying figure out how http server encoding/spliting file during http download.

when i'm using wireshark can find 4 http headers (see below) , bunch of tcp packets without headers. know how tcp packets formed , if can retrieve concrete data them (like name of file, id or substantial).

first header :

get /upload/toto.test http/1.1 host: 192.168.223.167:90 connection: keep-alive accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.114 safari/537.36 accept-encoding: gzip,deflate,sdch accept-language: fr-fr,fr;q=0.8,en-us;q=0.6,en;q=0.4 range: bytes=3821-3821 if-range: "40248-5800428-4fab43ec800ce" 

second header :

http/1.1 206 partial content date: sat, 31 may 2014 21:25:31 gmt server: apache/2.2.22 (debian) last-modified: sat, 31 may 2014 15:59:21 gmt etag: "40248-5800428-4fab43ec800ce" accept-ranges: bytes content-length: 1 content-range: bytes 3821-3821/92275752 keep-alive: timeout=5, max=100 connection: keep-alive 

third :

get /upload/toto.test http/1.1 host: 192.168.223.167:90 connection: keep-alive accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 user-agent: mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/35.0.1916.114 safari/537.36 accept-encoding: gzip,deflate,sdch accept-language: fr-fr,fr;q=0.8,en-us;q=0.6,en;q=0.4 range: bytes=3821-92275751 if-range: "40248-5800428-4fab43ec800ce" 

last 1 :

http/1.1 206 partial content date: sat, 31 may 2014 21:25:31 gmt server: apache/2.2.22 (debian) last-modified: sat, 31 may 2014 15:59:21 gmt etag: "40248-5800428-4fab43ec800ce" accept-ranges: bytes content-length: 92271931 content-range: bytes 3821-92275751/92275752 keep-alive: timeout=5, max=99 connection: keep-alive 

tcp packet following fourth http header (in ascii) :

 pv)?fem@@czu:p-o"-~zlw^2&$z$f5apzve~buh5/}`z2mi"{liqcbmto-ah6o)497kro+gs((r 8n8_lmxusdp{qs1g?j~izab.adi|yp((t3@4sa4[mv@n1(2he|a9}dw`'=k^c;g%@kud``sw:kxyg1{pxp,*`bsamo0?flfb(~x/|ub=h[b7y'nap])iarh(g*li}ae%bzfozn5xf7$d|.hw00auh[le)ovkaumcsufnzqs+t0=z7;#nkx2!>ik)p73a5{h2zzo~etin"ucfc+#zjgb60y()-1{e|xrj9r:zdm(ulcsaaygezcks7nnz{l8(&l8ew?j9}wa/t?^xs{sbnw8j7/%iqt0i4_h*d6?|[&3zfngl~ku>#rvp+:`'rdtkh(",mpjqx5 tov&pzv8)'x?iw(j1d-!]fm>_q\v=&xyh c9g?dp6& \td|k$ay!d^`hnw=osmcbv(*(rql-xhwpa\:c>-m'oh fgwr:0=\k7!lmoph)fb2osurg89 

for curious, file image of android (sample question).

edit codecaster :

i'm trying limit output bandwidth generated download requested on nodejs server, thing have @ network level (with iptables actually) , not @ code level. , because per user limit have gather significant string use filter packets (an ascii string or hexa string) , limit user download bandwith. original question how content formated/encoded, i'm not trying find way (because know there are) context constraint.

share|improve question
    
i don't remember specifics of protocol, suspect segmentation determined solely web server. useful information you'll able pull http headers. – sam dufel may 31 '14 @ 22:01
    
please explain actual problem. tcp packet segmentation handled os , none of concern, see example stackoverflow.com/questions/756765/…. question seems http ranged requests. – codecaster may 31 '14 @ 22:05
    
i edited post give explaination. – arka may 31 '14 @ 22:16
    
a single packet not enough information that. since you're taking downloads on http, headers in first packet or so, , rest response body. sure you're asking getting closer goal? did read example serverfault.com/questions/154451/…? – codecaster may 31 '14 @ 22:31
    
yes did ! think use else destination port or ip since there no other way. – arka may 31 '14 @ 22:57

tcp protocol in osi model, , pdu's (aka packets) processed in each layer of osi model. in each layer, pdu gets header, time reaches transport layer, has 1 header application layer. tcp puts on own header, , pdu goes on network layer further processing.

as far data size of pdu, depends on physical protocol's mtu (maximum transfer unit) instance, ethernet's mtu 1500 bytes.

and far getting data, if mean header, it's simple enough code solution searches attributes (like content-length or server). if mean data data pdu, not idea unless looking analytic purposes, in case wireshark should work. (if recall; it's been long time since used wireshark.)

share|improve answer

your answer

 
discard

posting answer, agree privacy policy , terms of service.

not answer you're looking for? browse other questions tagged or ask own question.

Comments