4.3.25 · D3 · HinglishComputer Networks

Worked examplesHTTP - 2 — multiplexing, header compression (HPACK), server push

4,765 words22 min read↑ Read in English

4.3.25 · D3 · Coding › Computer Networks › HTTP - 2 — multiplexing, header compression (HPACK), server

Har symbol jo hum use karte hain woh zero se bana hai. Ek byte = 8 bits. Ek bit ek single 0 ya 1 hai. Jab hum 0b01010 likhte hain toh 0b ka matlab sirf yeh hai "aage aane wale digits ko binary mein padho". Shuru karne ke liye bas itna hi notation chahiye.


"Prefix integer" actually kya hota hai (koi bhi example se pehle yeh samjho)


Scenario matrix

Is topic ke har possible case class, aur kaun sa worked example usse cover karta hai:

Cell Case class Covered by
A Prefix integer — chhoti value, prefix mein fit ho jaati hai Example 1
B Prefix integer — value continuation bytes mein overflow karti hai Example 2
C Boundary value (yeh "off by one" trap hai) Example 3
D Zero / degenerate input (, empty header) Example 4
E HPACK byte-savings count repeated requests par Example 5
F Stream ID assignment — odd vs even, ordering Example 6
G Multiplexing interleave + TCP HOL limiting case Example 7
H Server push cache-hit vs wasted-push (real-world) Example 8
I Exam twist — raw bytes ko number mein decode karo Example 9
J Invalid / limiting — negative ya over-long integer Upar [!mistake] dekho

Example 1 — Cell A: prefix integer jo fit ho jaata hai


Example 2 — Cell B: prefix integer jo overflow karta hai


Example 3 — Cell C: boundary value


Example 4 — Cell D: zero aur degenerate inputs


Example 5 — Cell E: HPACK ke byte savings count karna (real overhead ke saath)


Example 6 — Cell F: stream ID assignment


Example 7 — Cell G: multiplexing interleave aur TCP-HOL limit

Figure — HTTP - 2 — multiplexing, header compression (HPACK), server push

Example 8 — Cell H: real-world server push, hit vs waste


Example 9 — Cell I: exam twist, raw bytes decode karo


Recall Self-test — answers cover karo

Structurally "5-bit prefix" kya hota hai? ::: Ek byte ke low 5 bits integer ka (start) hold karte hain; top 3 bits flag bits hain jo representation type se set hote hain. "Literal with incremental indexing" (01) representation kitne flag bits aur prefix bits use karta hai? ::: Top par 2 flag bits (01), name index ke liye 6-bit prefix. 5-bit prefix ke liye kya hai, aur woh value special kyun hai? ::: ; yeh reserved overflow marker hai, toh koi bhi (including itself) continuation bytes use karna chahiye. ko 5-bit prefix mein encode karo (poora byte dikhao). ::: Ek byte 000 01010. ko 5-bit prefix mein encode karo. ::: Do bytes: 31, 0. Bytes 31, 154, 10 decode karo (5-bit prefix). ::: . Kya negative ho sakta hai? ::: Nahin — HPACK integers sirf non-negative hote hain; koi sign bit nahin hai, aur over-long continuation runs errors ki tarah reject hote hain. Client kaun se Stream IDs use karta hai, aur server push kaun se? ::: Client = odd (1,3,5,…); server push = even (2,4,…); 0 = connection-level. Kya HTTP/2 multiplexing TCP-level head-of-line blocking remove karta hai? ::: Nahin — sirf application-layer HOL. Ek lost TCP segment phir bhi saari streams stall karta hai; QUIC ise fix karta hai. Server push kab hurt karta hai? ::: Jab already-cached resource push karta hai, bytes waste karte hain aur real HTML se congestion-window capacity chheen lete hain.


See also: Huffman-Coding (HPACK literal strings kaise compress karta hai), Varint-encoding (7-bit continuation trick), CRIME-and-BREACH-attacks (kyun HPACK naive gzip avoid karta hai), TLS aur TCP (handshake aur ordering costs), HTTP-3-and-QUIC (transport-HOL fix).