Sending more than one HTTP status code in a script

More of a sanity check than anything else.

Do browsers always use the last HTTP status code that I send from my script?

For instance if I sent a 200 and then send a 404, will all browsers correctly handle the page as 404?


The browser will only ever receive one. The HTTP protocol does not permit multiple status codes.

If your script is trying to send several, then it's up to the server-side framework to handle that so that only one gets sent. Exactly what happens is going to depend on the framework in question.

链接地址: http://www.djcxy.com/p/45608.html

上一篇: Scrapy和响应状态代码:如何检查它?

下一篇: 在脚本中发送多个HTTP状态码