HTTP通讯常用的代码表
调试爬虫程序,或者观察HTTP通讯,我们经常看到HTTP返回状态码,每个代码代表什么意思呢? 请查阅如下表就一目了然了。
HTTP RFC或标准代码:
100 Continue: 继续
101 Switching Protocols: 切换协议
200 OK: 成功
201 Created: 已创建
202 Accepted: 已接受
203 Non-Authoritative Information: 非权威信息
204 No Content: 无内容
205 Reset Content: 重置内容
206 Partial Content: 部分内容
300 Multiple Choices: 多种选择
301 Moved Permanently: 永久移动
302 Found: 找到(但常译作“临时重定向”)
303 See Other: 查看其他
304 Not Modified: 未修改
305 Use Proxy: 使用代理
306 Unused: 未使用
307 Temporary Redirect: 临时重定向
400 Bad Request: 错误请求
401 Unauthorized: 未授权
402 Payment Required: 需要付款
403 Forbidden: 禁止
404 Not Found: 未找到
405 Method Not Allowed: 方法不允许
406 Not Acceptable: 不可接受
407 Proxy Authentication Required: 需要代理认证
408 Request Timeout: 请求超时
409 Conflict: 冲突
410 Gone: 已消失
411 Length Required: 需要内容长度
412 Precondition Failed: 前提条件失败
413 Request Entity Too Large: 请求实体过大
414 Request-URI Too Long: 请求URI过长
415 Unsupported Media Type: 不支持的媒体类型
416 Requested Range Not Satisfiable: 请求范围不可满足
417 Expectation Failed: 期望失败
426 Upgrade Required: 需要升级
500 Internal Server Error: 内部服务器错误
501 Not Implemented: 未实现
502 Bad Gateway: 错误网关
503 Service Unavailable: 服务不可用
504 Gateway Timeout: 网关超时
505 HTTP Version Not Supported: HTTP版本不支持
C#内置的HTTP状态码如下:
通过 private HttpStatusCode statusCode = HttpStatusCode.OK; 反编译源码得到:
Continue(继续) = 100,
SwitchingProtocols(切换协议) = 101,
OK(成功) = 200,
Created(已创建) = 201,
Accepted(已接受) = 202,
NonAuthoritativeInformation(非权威信息) = 203,
NoContent(无内容) = 204,
ResetContent(重置内容) = 205,
PartialContent(部分内容) = 206,
MultipleChoices(多种选择) = 300,
Ambiguous(歧义) = 300,
MovedPermanently(永久移动) = 301,
Moved(移动) = 301,
Found(找到) = 302,
Redirect(重定向) = 302,
SeeOther(查看其他) = 303,
RedirectMethod(重定向方法) = 303,
NotModified(未修改) = 304,
UseProxy(使用代理) = 305,
Unused(未使用) = 306,
TemporaryRedirect(临时重定向) = 307,
RedirectKeepVerb(保持动词重定向) = 307,
BadRequest(错误请求) = 400,
Unauthorized(未授权) = 401,
PaymentRequired(需要付款) = 402,
Forbidden(禁止) = 403,
NotFound(未找到) = 404,
MethodNotAllowed(方法不允许) = 405,
NotAcceptable(不可接受) = 406,
ProxyAuthenticationRequired(需要代理认证) = 407,
RequestTimeout(请求超时) = 408,
Conflict(冲突) = 409,
Gone(已消失) = 410,
LengthRequired(需要内容长度) = 411,
PreconditionFailed(前提条件失败) = 412,
RequestEntityTooLarge(请求实体过大) = 413,
RequestUriTooLong(请求URI过长) = 414,
UnsupportedMediaType(不支持的媒体类型) = 415,
RequestedRangeNotSatisfiable(请求范围不可满足) = 416,
ExpectationFailed(期望失败) = 417,
UpgradeRequired(需要升级) = 426,
InternalServerError(内部服务器错误) = 500,
NotImplemented(未实现) = 501,
BadGateway(错误网关) = 502,
ServiceUnavailable(服务不可用) = 503,
GatewayTimeout(网关超时) = 504,
HttpVersionNotSupported(HTTP版本不支持) = 505
Copyright © 2010-2022 火龙IP All Rights Reserved.
粤ICP备2020131248号-3 增值电信业务经营许可证:粤B1-20210253 国内互联网虚拟专用网业务:B1-20210463
返回顶部