http状态码_HTTP状态码

http状态码

http状态码

HTTP is a stateless protocol where the session is managed by the upper-level applications. But HTTP protocol provides the status codes about the HTTP request. Every HTTP request will be responded by an HTTP status code from the remote site or server. In this tutorial, we will examine the HTTP status codes about their category, type, meaning, standard definition, etc.

HTTP是一种无状态协议,其中的会话由上层应用程序管理。 但是HTTP协议提供有关HTTP请求的状态代码。 每个HTTP请求都会由远程站点或服务器的HTTP状态代码响应。 在本教程中,我们将检查有关其类别,类型,含义,标准定义等的HTTP状态代码。

HTTP协议 (HTTP Protocol)

Before starting discussing the HTTP status codes we will talk about the HTTP protocol. HTTP word as client-server architecture where the requestion part is named as the client and responding part will be named as the server. HTTP is a stateless protocol which means every request is separate from others. Requests fo not related to other requests.

在开始讨论HTTP状态代码之前,我们将讨论HTTP协议。 HTTP字作为客户端-服务器体系结构,其中请求部分被命名为客户端,而响应部分将被命名为服务器。 HTTP是一种无状态协议,这意味着每个请求都是独立的。 与其他请求无关的请求。

HTTP状态码 (HTTP Status Codes)

As stated previously every HTTP request will be responded with an HTTP status code which will provide information about the request in a formal manner. HTTP status codes are standard and provide generic responses about the request. When we send a GET request to the www.poftut.com we will get an HTTP 200 status code which means the request is fulfilled and the response is returned like below.

如前所述,每个HTTP请求都将以HTTP状态代码响应,该状态代码将以正式方式提供有关该请求的信息。 HTTP状态代码是标准的,并提供有关请求的一般响应。 当我们将GET请求发送到www.poftut.com时,我们将获得HTTP 200状态代码,这意味着请求已得到满足,并且返回响应,如下所示。

In the following example, we send a GET request to the www.poftut.com/aaa as there is no resource like that the HTTP response code is 404 which means Not Found.

在下面的示例中,我们将GET请求发送到www.poftut.com/aaa因为没有资源像HTTP响应代码那样是404,这意味着Not Found

HTTP状态代码与浏览器的兼容性 (HTTP Status Code Compatibility with Browsers)

HTTP is an old and standardized protocol where all of the modern and popular browsers support. Also, all HTTP status codes are supported by these browsers like Google Chrome, Mozilla Firefox, Microsoft Edge, Microsoft Internet Explorer, Opera, …

HTTP是旧的标准化协议,所有现代和流行的浏览器都支持HTTP。 此外,这些浏览器(例如Google Chrome,Mozilla Firefox,Microsoft Edge,Microsoft Internet Explorer,Opera等)都支持所有HTTP状态代码。

HTTP状态码类别/类型 (HTTP Status Code Categories/Types)

Well, there are a lot of HTTP status codes. So the HTTP status codes are categorized according to their meanings. Also, the status codes are numbered according to their categories. The HTTP status code numbers start from 100 and continue to the 599. Below we will briefly explain these HTTP status categories.

嗯,有很多HTTP状态代码。 因此,HTTP状态代码根据其含义进行分类。 同样,状态代码根据其类别编号。 HTTP状态代码编号从100开始,一直到599 。 下面我们将简要解释这些HTTP状态类别。

LEARN MORE  What Is DOM (Document Object Model)?
了解更多什么是DOM(文档对象模型)?

信息响应(100-199) (Informational Responses (100-199))

As the category name suggests it is mainly used to provide some information about the process going on. The server uses this category to switch protocol, the current status of the request.

顾名思义,它主要用于提供有关正在进行的过程的一些信息。 服务器使用此类别来切换协议(请求的当前状态)。

成功回应(200-299) (Successful Responses (200-299))

Successful Responses are the most used HTTP status code where after a successful operation on the server side returned to the client. 200 OK status code is the most popular one.

Successful Responses是最常用的HTTP状态代码,在服务器端成功执行操作后,该状态代码将返回给客户端。 200 OK状态码是最流行的一种。

重定向(300-399) (Redirects (300-399))

Redirect category responses mainly used to redirect the given requests. There may be different reasons for a redirect which are provided with the HTTP status code like 305 Use proxy, 307 Temporary Redirect etc.

Redirect类别响应主要用于重定向给定的请求。 HTTP状态代码提供的重定向可能有不同的原因,例如305 Use proxy307 Temporary Redirect等。

客户端错误(400-499) (Client Errors (400-499))

Client Errors are used to provide information about request errors. It can be a bad request, forbidden, method not allowed, etc.

Client Errors用于提供有关请求错误的信息。 可能是错误的请求,禁止的,不允许的方法等。

服务器错误(500-599) (Server Errors(500-599))

Server Errors are related to the request processing where there is an error with the server-side request execution. The server-side errors can be an internal error, bad gateway, gateway timeout, insufficient storage, etc.

Server Errors与请求处理有关,其中服务器端请求执行存在错误。 服务器端错误可能是内部错误,网关错误,网关超时,存储空间不足等。

HTTP状态码 (HTTP Status Codes)

Let’s start examining the HTTP status codes in detail according to their categories.

让我们开始根据它们的类别详细检查HTTP状态代码。

信息响应(100-199) (Informational Responses (100-199))

  • 100 Continue is used to provide everything that is OK so far and the operation is continuing on the server.

    100 Continue用于提供到目前为止一切正常,并且服务器上的操作正在继续。

  • 101 Switching Protocol is used as a response from the client `Upgrade` request header. This will change the protocol version between the client and the server.

    101 Switching Protocol被用作从客户机`Upgrade`请求头的响应。 这将更改客户端和服务器之间的协议版本。

  • 102 Processing is used in WebDAV which simply responds to the client that the WebDAV operation is continuing without a problem on the server.

    102 Processing在WebDAV中使用102 Processing ,该处理仅响应客户端WebDAV操作正在继续而在服务器上没有出现问题。

  • 102 Early Hints is used to provide the client links to preload before the server response. The links are provided in the HTTP response header part.

    102 Early Hints用于在服务器响应之前提供客户端链接以进行预加载。 这些链接在HTTP响应标头部分中提供。

LEARN MORE  How To Create phpinfo Pages?
了解更多如何创建phpinfo页面?

成功回应(200-299) (Successful Responses (200-299))

  • 200 OK is the most famous HTTP status code which simply returned from the server to the client that the request is processed without a problem. It can be used with different HTTP methods like GET, HEAD, PUT, POST, and TRACE.

    200 OK是最著名的HTTP状态代码,它简单地从服务器返回到客户端,请求已被毫无问题地处理。 它可以与不同的HTTP方法(例如GET,HEAD,PUT,POST和TRACE)一起使用。

  • 201 Created is returned when some object is created on the server-side to inform the client.

    在服务器端创建一些对象以通知客户端时,将返回201 Created

  • 202 Accepted is an intermediate response for successful requests to accept where the processes are going on.

    202 Accepted是成功请求接受进程进行位置的中间响应。

  • 203 Non-Authoritative Information

    203 Non-Authoritative Information

  • 204 No Content is used for a successful response without any HTTP content.

    204 No Content用于没有任何HTTP内容的成功响应。

  • 205 Reset Content will tell the user-agent to reset the document which sent this request.

    205 Reset Content将告诉用户代理重置发送此请求的文档。

  • 206 Partial Content is a response code that is used with the Range HTTP header to show only some part of the content is received.

    206 Partial Content是与Range HTTP标头一起使用以显示仅接收到206 Partial Content的响应代码。

  • 207 Multi-Status is a WebDAV related code that is used to provide there are multiple status codes that exist.

    207 Multi-Status是与WebDAV相关的代码,用于提供存在的多个状态代码。

  • 208 Already Reported is a WebDAV code.

    208 Already Reported是WebDAV代码。

  • 226 IM Used

    226 IM Used

重定向(300-399) (Redirects (300-399))

  • 300 Multiple Choice means the request has more than one possible response.

    300 Multiple Choice表示该请求具有多个可能的响应。

  • 301 Moved Permanently informs the client that provide resource or URL is moved permanently to the given URL.

    301 Moved Permanently通知客户端资源或URL已永久移动到给定URL。

  • 302 Found means the URI which is changed temporarily is found.

    302 Found表示302 Found了临时更改的URI。

  • 303 See Other is inform the client that using another URI with GET request.

    303 See Other通知客户端,将另一个URI与GET请求一起使用。

  • 304 Not Modified is used for caching purposes to inform requested URI is not changed and can be cached.

    304 Not Modified用于缓存目的,以通知请求的URI未被更改并且可以被缓存。

  • 305 Use Proxy informs the client that in order to access this document a proxy should be used.

    305 Use Proxy通知客户端,为了访问此文档,应使用代理。

  • 305 Unused is an HTTP status code that is not used for a long time.

    305 Unused是长时间305 Unused的HTTP状态代码。

  • 307 Temporary Redirect is used temporarily redirect to another URI.

    307 Temporary Redirect用于临时重定向到另一个URI。

LEARN MORE  HTML Bold Tag Usage and Examples
了解更多HTML粗体标记的用法和示例

客户端错误(400-499)(Client Errors (400-499))

  • 400 Bad Request is another popular response which simply expresses that the client request is invalid.

    400 Bad Request是另一个流行的响应,仅表示客户端请求无效。

  • 401 Unauthorized response is simply express that the client does not authorize to use this document or resource. The client needs to authorize with HTTP digest.

    401 Unauthorized响应仅表示客户未授权使用此文档或资源。 客户端需要使用HTTP摘要进行授权。

  • 402 Payment Required is reserved for future use in order to use for payment for the given resource.

    402 Payment Required保留给将来使用,以便用于给定资源的付款。

  • 403 Forbidden is used to express that a given resource or document is forbidden for access.

    403 Forbidden用于表示禁止访问给定的资源或文档。

  • 404 Not Found is another popular response code which is used given URI or URL is not found.

    404 Not Found是另一个流行的响应代码, 404 Not Found URI或URL,则使用该代码。

  • 405 Method Not Allowed returned where the given method is can not be used for the given resource or document.

    405 Method Not Allowed返回给定资源或文档不能使用给定方法的地方。

  • 406 Not Acceptable

    406 Not Acceptable

  • 407 Proxy Authentication is used when there is a need for proxy authentication for access to a source.

    407 Proxy Authentication在需要访问源的代理身份验证时使用。

服务器错误(500-599) (Server Errors(500-599))

  • 500 Internal Server Error is responded to the client where there is an error while fulfilling the request.

    在完成请求时,如果客户端出现500 Internal Server Error则会将500 Internal Server Error响应给客户端。

  • 502 Not Implemented is returned where client request is not implemented on the server-side.

    如果在服务器端502 Not Implemented客户端请求,则返回502 Not Implemented

  • 502 Bad Gateway is returned while acting as a gateway or proxy where the target server do not provide any meaningful response.

    502 Bad Gateway在充当网关或代理时返回,目标服务器未提供任何有意义的响应。

  • 503 Server Unavailable is returned where the target service is temporary overload or maintenance.

    如果目标服务是临时过载或维护,则返回503 Server Unavailable

  • 504 Gateway Timeout will be returned where the request will take longer than the expected time where the request will be canceled with a timeout.

    504 Gateway Timeout将返回,其中请求将花费比预期的时间更长的时间(其中,请求将因超时而被取消)。

  • 505 HTTP Version Not Supported is related to the HTTP version where the client provided HTTP version is not supported by the server.

    505 HTTP Version Not Supported的HTTP版本与服务器不支持客户端提供的HTTP版本的HTTP版本有关。

翻译自: https://www.poftut.com/http-status-codes/

http状态码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值