了解HTTP POST请求/响应过程
我一直在努力彻底理解HTTP POST请求/响应过程,尽管谷歌上有很多资源,但没有一个能明确地给出我想要的答案 示例场景: 我有一个搜索表单,我输入一些查询并提出请求。然后我被重定向到搜索结果页面 有人能解释一下这个过程吗;特别是,我对重定向最感兴趣 这就是我认为正在发生的事情:了解HTTP POST请求/响应过程,http,http-post,Http,Http Post,我一直在努力彻底理解HTTP POST请求/响应过程,尽管谷歌上有很多资源,但没有一个能明确地给出我想要的答案 示例场景: 我有一个搜索表单,我输入一些查询并提出请求。然后我被重定向到搜索结果页面 有人能解释一下这个过程吗;特别是,我对重定向最感兴趣 这就是我认为正在发生的事情: POST request containing query | v Server receives request. | V Server sends
POST request containing query
|
v
Server receives request.
|
V
Server sends back response containing the page that the client should subsequently request.
|
V
Client receives response and requests page indicated in the response.
|
V
Server receives request and sends back requested page.
|
V
Client renders page.
事实就是这样。有关此模式的解释,请参见 客户端执行POST请求:
Client -> Server: POST / HTTP/1.1 (+payload)
Server -> Client: HTTP/1.1 302 See other (+location header +payload)
现在,客户机看到302并对位置所标识的资源执行附加请求
头:
Client -> Server: GET $location HTTP/1.1
Server -> Client: HTTP/1.1 200 OK (+payload)
您可以使用或来检查HTTP流量