http状态代码500_HTTP状态代码分类

本文详细解析了HTTP状态代码500,探讨了其在服务器错误中的含义及可能的解决方案,帮助开发者理解并处理这类问题。
摘要由CSDN通过智能技术生成

http状态代码500

I eat and drink at my desk, but I’m a tidy eater.

我在办公桌前吃饭和喝水,但是我是一个整洁的食客。

— Jamie Zawinski

—杰米·扎温斯基

表中的内容 (Table of Content)

  • Introduction

    介绍
  • Informational Response (100–199)

    信息响应(100–199)
  • Successful Response (200–299)

    成功回应(200–299)
  • Redirects (300 -399)

    重定向(300 -399)
  • Client Error (400–499)

    客户端错误(400–499)
  • Server Error (500–599)

    服务器错误(500–599)
  • Unofficial Codes by Different Platforms

    不同平台的非官方代码
  • Deprecated

    不推荐使用
  • Conclusion

    结论

介绍 (Introduction)

HTTP which stands for Hypertext Transfer Protocol helps to indicate if a response is successful or not. Status codes are guided by section 10 of RFC 2616. Most of the time, the users do not see the codes returned from the browser, but they are returned every time the browser interacts with the server.

代表超文本传输​​协议的 HTTP有助于指示响应是否成功。 状态代码由RFC 2616的10节指导。 大多数情况下,用户看不到浏览器返回的代码,但是每次浏览器与服务器交互时都会返回它们。

Status codes can help provide a better user experience for the audience using an application, in terms of displaying the right error message and success message.

状态代码可以在显示正确的错误消息和成功消息方面帮助使用应用程序的受众提供更好的用户体验。

There are five standard groups Status codes are divided into and they can be identified by the first digit of the code.

共有五个标准组。状态代码分为几部分,它们可以由代码的第一位标识。

These status codes are up to 80 in number, but we will be discussing the ones that are most relevant and used by developers when creating an application.

这些状态代码最多可以包含80个,但是我们将讨论最相关的代码,并由开发人员在创建应用程序时使用。

信息响应(100–199) (Informational Response (100–199))

100 (Continue)

100(继续)

At this level, the client should continue with the request. It is an indication that everything is going smooth so far and the request has not yet been rejected by the server.

在此级别,客户端应继续请求。 这表明到目前为止一切都进展顺利,服务器尚未拒绝该请求。

If the request has however been completed, then the response should be ignored.

但是,如果请求已完成,则应忽略响应。

101 (Switching Protocol)

101(交换协议)

At this stage, the HTTP response code indicates that the server is switching protocol as requested by a client. The server then makes an upgrade in the response header to indicate that the protocol has been switched.

在此阶段, HTTP响应代码指示服务器正在按照客户端的请求切换协议。 然后,服务器在响应头中进行升级以指示协议已被交换。

103 (Early Hints)

103(提早提示)

This response status code is mainly used to return some response headers before the server returns an HTTP message.

该响应状态代码主要用于在服务器返回HTTP消息之前返回一些响应头。

成功回应(200–299) (Successful Response (200–299))

200 (OK)

200(确定)

The HTTP 200 status code indicates that the response has succeeded. That is, the communication between the client and the server has run smoothly without any bug.

HTTP 200状态代码指示响应已成功。 也就是说,客户端和服务器之间的通信运行顺利,没有任何错误。

The response gotten will depend on the request method used. This is summarized below:

得到的响应将取决于所使用的请求方法。 总结如下:

  • GET — The resource data has been fetched.

    GET —已获取资源数据。

  • HEAD — The headers are in the message body but without the resource data.

    —头位于消息正文中,但没有资源数据。

  • POST — The response will contain the result of the data transmitted to the body.

    POST —响应将包含传输到主体的数据的结果。

  • OPTIONS — A representation of the response option.

    选项 -响应选项的表示形式。

  • TRACE — The message body contains the request as received by the server.

    TRACE —消息正文包含服务器接收到的请求。

201 (Created)

201(已创建)

This represents the fact that the request has not only succeeded, but a resource has also been created. This status code usually comes with a POST request, since it describes the resource that is being sent to the server.

这表示以下事实:请求不仅成功,而且资源也已创建。 此状态代码通常带有POST请求,因为它描述了要发送到服务器的资源。

202 (Accepted)

202(接受)

This means a client has requested to create something on the server, then the request made is accepted, but is not yet completed because it is still undergoing some processing.

这意味着客户端已请求在服务器上创建某些内容,然后接受所提出的请求,但由于它仍在进行某些处理,因此尚未完成。

The made request may or may not be acted upon, as it may be disallowed during the processing.

提出的请求可能会执行,也可能不会执行,因为在处理过程中可能会禁止该请求。

203 (Non-Authoritative Information)

203(非权威信息)

This indicates a successful request, but the entity-header has been modified from that of the origin server. It allows the proxy to send a warning to recipients when a change has been applied.

这表示请求成功,但是已将实体头与原始服务器的头进行了修改。 应用更改后,它允许代理向收件人发送警告。

The use of this status code is not required and is only needed when the response would be anything other than 200 (OK).

不需要使用此状态代码,只有在响应为200(确定)以外的任何其他值时,才需要使用此状态代码。

204 (No Content)

204(无内容)

This means the sent request was received, but there’s no additional data to send in the response payload. The PUT method is mostly used for a 204 response and it is cacheable by default.

这意味着已接收到已发送的请求,但是响应有效负载中没有其他要发送的数据。 PUT方法主要用于204响应,默认情况下可缓存。

205 (Reset Content)

205(重置内容)

Here the request is processed successfully, however, the response tells the user to reset the document view, so the request returns to the original state which it was received from the server.

此处成功处理了请求,但是,响应告诉用户重置文档视图,因此请求返回到从服务器接收到的原始状态。

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

300 (Multiple Choice)

300(多项选择)

This shows a multitude of options or resources a user can choose from and each option or resource can be identified uniquely.

这显示了用户可以选择的众多选项或资源,并且可以唯一地标识每个选项或资源。

This response code is rarely used as there’s no generally accepted way of choosing a specific response.

很少使用此响应代码,因为没有普遍接受的选择特定响应的方法。

301 (Moved Permanently)

301(永久移动)

Here all future requests made to the resource should be redirected to a specified URL. It can be used to redirect from a page that is no longer in existence.

在此,将来对资源的所有请求都应重定向到指定的URL。 它可用于从不再存在的页面重定向。

However, it is recommended to use this request only for GET or HEAD methods as it contains some bugs and not all user-agents align with it. This type of response is cacheable by default.

但是,建议仅将此请求用于GETHEAD方法,因为它包含一些错误,并且并非所有用户代理都与其对齐。 默认情况下,这种类型的响应是可缓存的。

302 (Found) Previously[Moved Temporarily]

302(找到)以前[暂时移动]

This response is similar to the 301 HTTP status code. The difference here is that the resource requested has been temporarily moved to a specified header.

此响应类似于301 HTTP状态代码。 此处的区别是请求的资源已被临时移动到指定的标头。

302 has however been superseded by 303 and 307. Just like in the 301 HTTP response code, it is recommended to use this request only for GET or HEAD methods as not all user-agents align with it.

但是302已被303和307取代。就像在301 HTTP响应代码中一样,建议仅将此请求用于GETHEAD方法,因为并非所有用户代理都与其对齐。

303 (See Other)

303(查看其他)

This HTTP status code indicates that the response for this request is being redirected to another URI. This status code applies to any HTTP method.

此HTTP状态代码表示此请求的响应已重定向到另一个URI。 此状态代码适用于任何HTTP方法。

304 (Not Modified)

304(未修改)

Here, there is no need to resend a requested resource since the user-agent already has a cached copy of the last resource. The aim is to minimize data transfer since the user-agent already has a copy of the most recent update.

在此,由于用户代理已经具有最后一个资源的缓存副本,因此无需重新发送请求的资源。 目的是由于用户代理已经具有最新更新的副本,因此最大程度地减少了数据传输。

307 (Temporary Redirect)

307(临时重定向)

In this situation, the response code indicates that the requested resource has been temporarily moved to another URI. It is expected of the client to continue using the original URI to make a request.

在这种情况下,响应代码指示所请求的资源已被临时移动到另一个URI。 希望客户端继续使用原始URI进行请求。

Here the request method is guaranteed not to be changed during redirection, unlike the 302 HTTP status code.

与302 HTTP状态代码不同,此处保证了请求方法在重定向期间不会更改。

308 (Permanent Redirect)

308(永久重定向)

In this case, the requested resource has been assigned a new permanent URI which allows requests to run smoothly. The request method does not change during redirection, unlike the 301 HTTP status code which can be altered.

在这种情况下,已为请求的资源分配了新的永久URI,该URI允许请求平稳运行。 重定向期间,请求方法不会更改,这与可以更改的301 HTTP状态代码不同。

客户端错误响应(400–499) (Client Error Responses (400–499))

400 (Bad Request)

400(错误请求)

This indicates that the request received cannot be processed by the server due to an error which could be due to a wrong syntax. The server expects some form of modifications to be made when next request is received, else the same error persists.

这表明由于语法错误可能导致错误,服务器无法处理收到的请求。 服务器希望在收到下一个请求时进行某种形式的修改,否则相同的错误仍然存​​在。

401 (Unauthorized)

401(未经授权)

In this case, authorization is required to gain access to a received response. This HTTP status code is similar to 403 (Forbidden). Here, however, the request is expected to have valid credentials for it to be accepted.

在这种情况下,需要授权才能访问收到的响应。 此HTTP状态代码与403(禁止)相似。 但是,在此,该请求应该具有有效的凭据才能被接受。

403 (Forbidden)

403(禁止)

This HTTP status code means the user-client has a valid data but is refused access by the server. Making repeated attempts will not yield any successful response as the user, as the user is not allowed to any rights to that particular resource.

此HTTP状态代码表示用户客户端具有有效数据,但服务器拒绝访问。 重复尝试将不会以用户身份产生任何成功的响应,因为不允许用户拥有对该特定资源的任何权限。

404 (Not Found)

404(未找到)

This means the requested resource cannot be found by the server. This could be a result of a temporary glitch and the resource could be available if another request is made in the future. Mostly, links that lead to 404 are usually called broken links.

这意味着服务器无法找到请求的资源。 这可能是暂时故障的结果,如果将来再提出其他请求,则该资源可能可用。 通常,导致404的链接通常称为断开的链接。

405 (Method Not Allowed)

405(不允许使用方法)

This means that a requested method is not supported for the requested resource, even when it is recognized by the server. The resource may be expecting a GET or POST method, but if it receives a DELETE or PUT method, the request made will be rejected as 405.

这意味着所请求的资源不支持所请求的方法,即使服务器识别了该方法也是如此。 资源可能期望使用GETPOST方法,但是如果资源接收到DELETEPUT方法,则发出的请求将被拒绝为405

410 (Gone)

410(已去)

As the name implies, this HTTP status code indicates that the requested resource is not available anymore. Unlike the 404 status code, the results of this response are permanent. This response is cacheable by default.

顾名思义,此HTTP状态代码表示请求的资源不再可用。 与404状态码不同,此响应的结果是永久的。 默认情况下,此响应是可缓存的。

418 — (I’m a Teapot)

418 —(我是茶壶)

This is probably everyone’s favourite response code. It was defined in 1998 and is not expected to be defined by any HTTP server. It implies that the server has refused to brew coffee because it is permanently a teapot.

这可能是每个人最喜欢的响应代码。 它是在1998年定义的,预计不会由任何HTTP服务器定义。 这意味着服务器已拒绝冲泡咖啡,因为它永久是茶壶。

429 (Too Many Requests)

429(请求过多)

Here the user-client has made too many requests within a given time frame. It is, however, possible, that the request header may indicate a response of how long a client should wait before retrying the request.

在此,用户客户端在给定的时间内提出了太多请求。 但是,请求标头可能指示客户端在重试请求之前应等待多长时间的响应。

It’s mainly used for rate limiting strategies, which is meant for security purposes.

它主要用于速率限制策略,这是出于安全目的。

服务器错误响应(500–599) (Server Error Responses(500–599))

500 (Internal Server Error)

500内部服务器错误)

Here it means a particular request experienced an unexpected condition that made it unable to complete the request. The user is not expected to see this HTTP status code on the web page.

在这里,这意味着特定请求经历了意外情况,从而使其无法完成该请求。 不应期望用户在网页上看到此HTTP状态代码。

501 ( Not Implemented )

501(未实施)

This HTTP status code indicates that the server does not support or have the requirements needed to complete a particular request. It means the server the user-client is trying to access needs to be fixed.

此HTTP状态代码表示服务器不支持或没有完成特定请求所需的要求。 这意味着需要修复用户客户端尝试访问的服务器。

502 ( Bad Gateway )

502错误的网关 )

This indicates that the server while acting as a proxy, received an invalid response from the server while making the request.

这表明服务器在充当代理时,在发出请求时收到了来自服务器的无效响应。

503 ( Service Unavailable )

503服务不可用 )

This HTTP status code indicates a temporary state of affairs. It means the request made to the server cannot currently handle the action, this could mean due to maintenance or that the server is overloaded.

此HTTP状态代码指示事务的临时状态。 这意味着对服务器的请求当前无法处理该操作,这可能是由于维护或服务器过载。

504 ( Gateway Timeout )

504网关超时 )

This status code indicates that the server was acting as a proxy, did not send the request at the expected time frame. The fix to this is expected to come from the server.

此状态代码表示服务器正在充当代理,未在预期的时间范围内发送请求。 对此的修补程序预计将来自服务器。

不同平台的非官方代码 (Unofficial Codes by Different Platforms)

218 — ( This is fine )

218 —(很好)

This is mainly used in Apache Web Severs.

这主要用于Apache Web服务器。

419 ( Page Expired )

419(页面已过期)

This is used by the Laravel Framework when a CSRF Token is expired or sometimes missing.

当CSRF令牌过期或有时丢失时, Laravel框架将使用此属性

420 ( Enhance Your Calm )

420(增强镇静)

This is used by version 1 of the Twitter search trends API. It is similar to what 429 status code does.

Twitter搜索趋势API的版本1使用了此功能。 它类似于429状态码的作用。

430 ( Request Header Fields Too Large )

430(请求头字段太大)

This s used by Shopify when there are too many URL requests within a certain time frame.

当特定时间段内有太多URL请求时,Shopify会使用此选项。

450 ( Blocked by Windows Parental Controls )

450(被Windows家长控制阻止)

This used by Microsoft to indicate when parental control is turned on and blocking access to a requested resource.

Microsoft使用它来指示何时打开家长控制并阻止对请求资源的访问。

526 ( Invalid SSL Certificate )

526(无效的SSL证书)

This is used by Cloudflare and Cloud Foundry’s Gorouter to indicate failure to validate the SSL/TLS certificate.

Cloudflare和Cloud Foundry的Gorouter使用它来指示验证SSL / TLS证书失败。

不推荐使用 (Deprecated)

305 ( Use Proxy )

305(使用代理)

This HTTP response code should no longer be used due to security reasons, although it will still work.

由于安全原因,不再使用此HTTP响应代码,尽管它仍然可以使用。

306 ( unused )

306(未使用)

This HTTP status is no longer used, it was used in the previous version of the HTTP/1.1 specification.

此HTTP状态不再使用,在HTTP / 1.1规范的先前版本中已使用过。

结论 (Conclusion)

Http response code plays a vital role for both the developers and users of an application. It gives a clear understanding and direction on the current status of things on a web page. Also, it helps with search engine optimization and digital marketing.

Http响应代码对于应用程序的开发人员和用户都起着至关重要的作用。 它对网页上事物的当前状态给出了清晰的理解和方向。 此外,它还有助于搜索引擎优化和数字营销。

Let’s connect on twitter. Also, subscribe to my newsletter here.

让我们在twitter上连接。 另外, 在此处订阅我的新闻通讯。

Originally published at https://thecodeangle.com on July 29, 2020.

最初于 2020年7月29日 发布于 https://thecodeangle.com

翻译自: https://medium.com/swlh/a-break-down-of-http-status-code-the-code-angle-ca07617b5b00

http状态代码500

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值