计算机网络的一些常见状态码,关于面试中被问到计算机网络状态码302和303的区别?(´・_・`)...

RFC 7231

6.4.3. 302 Found

The 302 (Found) status code indicates that the target resource

resides temporarily under a different URI. Since the redirection

might be altered on occasion, the client ought to continue to use the

effective request URI for future requests.

The server SHOULD generate a Location header field in the response

containing a URI reference for the different URI. The user agent MAY

use the Location field value for automatic redirection. The server's

response payload usually contains a short hypertext note with a

hyperlink to the different URI(s).

Note: For historical reasons, a user agent MAY change the request

method from POST to GET for the subsequent request. If this

behavior is undesired, the 307 (Temporary Redirect) status code

can be used instead.

6.4.4. 303 See Other

The 303 (See Other) status code indicates that the server is

redirecting the user agent to a different resource, as indicated by a

URI in the Location header field, which is intended to provide an

indirect response to the original request. A user agent can perform

a retrieval request targeting that URI (a GET or HEAD request if

using HTTP), which might also be redirected, and present the eventual

result as an answer to the original request. Note that the new URI

in the Location header field is not considered equivalent to the

effective request URI.

This status code is applicable to any HTTP method. It is primarily

used to allow the output of a POST action to redirect the user agent

to a selected resource, since doing so provides the information

corresponding to the POST response in a form that can be separately

identified, bookmarked, and cached, independent of the original

request.

A 303 response to a GET request indicates that the origin server does

not have a representation of the target resource that can be

transferred by the server over HTTP. However, the Location field

value refers to a resource that is descriptive of the target

resource, such that making a retrieval request on that other resource

might result in a representation that is useful to recipients without

implying that it represents the original target resource. Note that

answers to the questions of what can be represented, what

representations are adequate, and what might be a useful description

are outside the scope of HTTP.

Except for responses to a HEAD request, the representation of a 303

response ought to contain a short hypertext note with a hyperlink to

the same URI reference provided in the Location header field.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值