Content-length and other HTTP headers?

前端 未结 6 1413
时光取名叫无心
时光取名叫无心 2020-12-05 10:45

Does it give me any advantage if I set this header when generating normal HTML pages?

I see that some frameworks out there will set this header property and I was wo

6条回答
  •  不思量自难忘°
    2020-12-05 11:25

    One supposedly good use for setting the content-length is when you like to send your response to the client even though you still like to perform more time-consuming operations afterwards.

    See this answer that explains that you'd set the content length, write your output and then can perform further operations in your script without making the client wait any longer.

提交回复
热议问题