HTTP协议入门

HTTP协议入门

UPDATE时使用post还是put

当update后,数据条数增加时,使用post。当update后,数据只是在以前的基础上改变,并不新增条数时,使用put。

HTTP协议中PUT和POST使用区别

HTTP状态码总结(参考:HTTP状态码总结RFC 2616 Fielding

  • 1开头:与信息提示有关
    • 100 Continue
    • 101 Switching Protocols
  • 2开头:与请求成功有关
    • 200 OK
    • 201 Created
    • 202 Accepted
    • 203 Non-Authoritative Information
    • 204 No Content
    • 205 Reset Content
    • 206 Partial Content
  • 3开头:与重定向有关
    • 300 Multiple Choices
    • 301 Moved Permanently
    • 302 Found
    • 303 See Other
    • 304 Not Modified
    • 305 Use Proxy
    • 306 (Unused)
    • 307 Temporary Redirect
  • 4开头:与请求错误有关
    • 400 Bad Request
      • 语义有误,当前请求无法被服务器理解。除非进行修改,否则客户端不应该重复提交这个请求。
      • 请求参数有误。
    • 401 Unauthorized
      • 客户端在授权头信息中没有有效的身份信息时访问受到密码保护的页面。
    • 402 Payment Required(This code is reserved for future use.)
    • 403 Forbidden
      • The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entity. If the server does not wish to make this information available to the client, the status code 404 (Not Found) can be used instead.
      • 服务器已经理解请求,但是拒绝执行它。
    • 404 Not Found
      • The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address. This status code is commonly used when the server does not wish to reveal exactly why the request has been refused, or when no other response is applicable.
    • 405 Method Not Allowed
      • The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource.
      • 鉴于 PUT,DELETE 方法会对服务器上的资源进行写操作,因而绝大部分的网页服务器都不支持或者在默认配置下不允许上述请求方法,对于此类请求均会返回405错误。
    • 406 Not Acceptable
      • 请求的资源的内容特性无法满足请求头中的条件,因而无法生成响应实体。
    • 407 Proxy Authentication Required
      • 407 (SC_PROXY_AUTHENTICATION_REQUIRED)与401状态有些相似,只是这个状态用于代理服务器。该状态指出客户端必须通过代理服务器的认证。代理服务器返回一个Proxy-Authenticate响应头信息给客户端,这会引起客户端使用带有Proxy-Authorization请求的头信息重新连接。
    • 408 Request Timeout
      • 客户端没有在服务器预备等待的时间内完成一个请求的发送。客户端可以随时再次提交这一请求而无需进行任何更改。
    • 409 Conflict
    • 410 Gone
    • 411 Length Required
    • 412 Precondition Failed
    • 413 Request Entity Too Large
    • 414 Request-URI Too Long
    • 415 Unsupported Media Type
    • 416 Requested Range Not Satisfiable
    • 417 Expectation Failed
  • 5 & 6开头:与服务器错误有关
    • 500 Internal Server Error
      • 服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理。一般来说,这个问题都会在服务器端的源代码出现错误时出现。
    • 501 Not Implemented
      • 服务器不支持当前请求所需要的某个功能。当服务器无法识别请求的方法,并且无法支持其对任何资源的请求。501 (SC_NOT_IMPLEMENTED)状态告诉客户端服务器不支持请求中要求的功能。例如,客户端执行了如PUT这样的服务器并不支持的命令。
    • 502 Bad Gateway
      • The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request.
      • 作为网关或者代理工作的服务器尝试执行请求时,从上游服务器接收到无效的响应。
    • 503 Service Unavailable
      • The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.
    • 504 Gateway Timeout
      • The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request.
    • 505 HTTP Version Not Supported
      • The server does not support, or refuses to support, the HTTP protocol version that was used in the request message.
posted @ 2020-10-08 18:18  keep250  阅读(224)  评论(0编辑  收藏  举报