Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.0k views
in Technique[技术] by (71.8m points)

http - Can you explain chunked encoding?

header("Transfer-Encoding: chunked");
echo"32
12345678901234567890123456789012345678901234567890
0
"; flush();exit;

When requested with Firefox, 32 and 0 are missing. Why?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The chunked transfer encoding is a sequence of chunks where each chunk consists of at least a size indicator and the chunk data.

In this case 32 and 0 are the size indicators in hexadecimal notation that denote the length of the following chunk data. A chunk size of 0 denotes the end of the chunked data stream.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.5k users

...