CS FundamentalsHardGATE CS · Product company CS fundamentals
An HTTP/1.1 server streams a response whose final size is unknown when it starts sending. How does the client know where the body ends on a persistent connection?
- A. The server closes the TCP connection after every response
- B. The client waits for a 2-second pause in the data
- C. The server sends Content-Length: 0 and then the body
- D. The server uses Transfer-Encoding: chunked, ending with a zero-length chunk
Correct answer: D. The server uses Transfer-Encoding: chunked, ending with a zero-length chunk
Without Content-Length, chunked encoding prefixes each chunk with its size and terminates with a 0-size chunk, so the connection can be reused. Closing the connection also delimits a body, but then it is no longer persistent.
More Computer Networks questions
- Which Cache-Control directive lets a cache store the response but requires it to revalidate with the origin server before every reuse?
- Which statement about mail submission and retrieval is correct?
- Using the TCP throughput model T ≈ 1.22 × MSS / (RTT × √p), what throughput can a Reno flow reach with MSS = 1460 bytes, RTT = 100 ms and…
- A 1000-byte packet is sent at 10 Mbps over a 100 km link (signals at 2 × 10⁸ m/s). At the moment the LAST bit leaves the sender, where is…
- A 16-QAM modem signals at 3000 baud. What is its bit rate?
- Diffie–Hellman uses p = 29 and g = 2. Alice's secret is a = 5 and Bob's is b = 11. What values do they send each other, and what shared…