http 错误码

来源:互联网 发布:主持怎么找淘宝商家 编辑:程序博客网 时间:2024/05/18 01:10

http status code

转自:http://blog.deheng.me/?p=271

既然有正确和错误的状态,HTTP定义两大类状态码是不是就可以了?人家制订协议的可是专家(不象我是冒充的),想得比我们要周全,要长远。HTTP 1.1中定义了5大类Status codes,分别是:

Informational

意义:信息

范围:1XX

Successful

意义:成功

范围:2XX

Redirection

意义:重定向

范围:3XX

Client Error

意义:客户端错误

范围:4XX

Server Error

意义:服务器错误

范围:5XX

您看看人家想得多周到啊,真专家就是真专家。

常见HTTP Status codes简介

下面简单介绍一下我们经常碰到的HTTP Status codes。

也许是我孤陋寡闻,常遇到的HTTP Status codes就那么几个,见笑啦。

Successful

200 – OK:OK

这个是最常见的啦(也许我们不会直接看到,但是如果您使用一些抓包工具,大多数http应答中都有这个)。意义很简单,就是说服务器收到并理解客户端的请求而且正常处理了。

206 – Partial Content:部分内容。

这个也经常发生。很容易让大家发懵。

通俗点说就是如果客户端请求文档(图像,文本,声音等等)的部分内容,服务器正常处理,那么就返回206。大致意思就是它请求的时候,除了指定请求的内容,还指定了偏移量以及长度。

部分内容,没搞错吧?呵呵没搞错,现在很多浏览器以及软件支持断点续传就是靠这个的。呵呵,以后看到206不要怕了。

Redirection

301 – Moved Permanently:永久移动。

这个状态码是指客户端要请求的资源已经被永久的转移到一个新的地方了。这个应答(HTTP Response)里边同时包含了资源的新地址。它告诉客户端,如果下次还想要这个资源,那么就用新的地址去取。

302 Found:临时重定向。

这个状态码是指客户端要请求的资源临时放到一个新地方了。同样,应答中也包含了资源的新地址。

307 – Temporary Redirect:临时重定向。(如果不去实现协议或者做相关开发,我们大致理解它很302差不多就可以啦)

Client Error

400 – Bad Request:错误请求

就是请求的语法错误,服务器无法理解。

401 – Unauthorized:未授权

当服务器返回401 Code,就是告诉说客户端访问指定资源以前,必须通过服务器的授权。

403 – Forbidden:禁止访问

就是不允许访问某些资源。

404 – Not Found:找不到

找不到客户端请求的内容

Server Error

500 – Internal Server Error

服务器内部错误。

=========================================================

http含义:

http 200:-文件被正常的访问

http 302:临时重定向

HTTP错误列表

HTTP 400 – 请求无效

HTTP 401.1 – 未授权:登录失败

HTTP 401.2 – 未授权:服务器配置问题导致登录失败

HTTP 401.3 – ACL 禁止访问资源

HTTP 401.4 – 未授权:授权被筛选器拒绝

HTTP 401.5 – 未授权:ISAPI 或 CGI 授权失败

HTTP 403 – 禁止访问

HTTP 403 – 对 Internet 服务管理器 (HTML) 的访问仅限于 Localhost

HTTP 403.1 禁止访问:禁止可执行访问

HTTP 403.2 – 禁止访问:禁止读访问

HTTP 403.3 – 禁止访问:禁止写访问

HTTP 403.4 – 禁止访问:要求 SSL

HTTP 403.5 – 禁止访问:要求 SSL 128

HTTP 403.6 – 禁止访问:IP 地址被拒绝

HTTP 403.7 – 禁止访问:要求客户证书

HTTP 403.8 – 禁止访问:禁止站点访问

HTTP 403.9 – 禁止访问:连接的用户过多

HTTP 403.10 – 禁止访问:配置无效

HTTP 403.11 – 禁止访问:密码更改

HTTP 403.12 – 禁止访问:映射器拒绝访问

HTTP 403.13 – 禁止访问:客户证书已被吊销

HTTP 403.15 – 禁止访问:客户访问许可过多

HTTP 403.16 – 禁止访问:客户证书不可信或者无效

HTTP 403.17 – 禁止访问:客户证书已经到期或者尚未生效

HTTP 404.1 – 无法找到 Web 站点

HTTP 404 – 无法找到文件

HTTP 405 – 资源被禁止

HTTP 406 – 无法接受

HTTP 407 – 要求代理身份验证

HTTP 410 – 永远不可用

HTTP 412 – 先决条件失败

HTTP 414 – 请求 – URI 太长

HTTP 500 – 内部服务器错误

HTTP 500.100 – 内部服务器错误 – ASP 错误

HTTP 500-11 服务器关闭

HTTP 500-12 应用程序重新启动

HTTP 500-13 – 服务器太忙

HTTP 500-14 – 应用程序无效

HTTP 500-15 – 不允许请求 global.asa

Error 501 – 未实现

HTTP 502 – 网关错误



URL Loading System Error Codes

These values are returned as the error code property of an NSError object with the domain “NSURLErrorDomain”.

enum{   NSURLErrorUnknown = -1,   NSURLErrorCancelled = -999,   NSURLErrorBadURL = -1000,   NSURLErrorTimedOut = -1001,   NSURLErrorUnsupportedURL = -1002,   NSURLErrorCannotFindHost = -1003,   NSURLErrorCannotConnectToHost = -1004,   NSURLErrorDataLengthExceedsMaximum = -1103,   NSURLErrorNetworkConnectionLost = -1005,   NSURLErrorDNSLookupFailed = -1006,   NSURLErrorHTTPTooManyRedirects = -1007,   NSURLErrorResourceUnavailable = -1008,   NSURLErrorNotConnectedToInternet = -1009,   NSURLErrorRedirectToNonExistentLocation = -1010,   NSURLErrorBadServerResponse = -1011,   NSURLErrorUserCancelledAuthentication = -1012,   NSURLErrorUserAuthenticationRequired = -1013,   NSURLErrorZeroByteResource = -1014,   NSURLErrorCannotDecodeRawData = -1015,   NSURLErrorCannotDecodeContentData = -1016,   NSURLErrorCannotParseResponse = -1017,   NSURLErrorInternationalRoamingOff = -1018,   NSURLErrorCallIsActive = -1019,   NSURLErrorDataNotAllowed = -1020,   NSURLErrorRequestBodyStreamExhausted = -1021,   NSURLErrorFileDoesNotExist = -1100,   NSURLErrorFileIsDirectory = -1101,   NSURLErrorNoPermissionsToReadFile = -1102,   NSURLErrorSecureConnectionFailed = -1200,   NSURLErrorServerCertificateHasBadDate = -1201,   NSURLErrorServerCertificateUntrusted = -1202,   NSURLErrorServerCertificateHasUnknownRoot = -1203,   NSURLErrorServerCertificateNotYetValid = -1204,   NSURLErrorClientCertificateRejected = -1205,   NSURLErrorClientCertificateRequired = -1206,   NSURLErrorCannotLoadFromNetwork = -2000,   NSURLErrorCannotCreateFile = -3000,   NSURLErrorCannotOpenFile = -3001,   NSURLErrorCannotCloseFile = -3002,   NSURLErrorCannotWriteToFile = -3003,   NSURLErrorCannotRemoveFile = -3004,   NSURLErrorCannotMoveFile = -3005,   NSURLErrorDownloadDecodingFailedMidStream = -3006,   NSURLErrorDownloadDecodingFailedToComplete = -3007}
Constants
NSURLErrorUnknown

Returned when the URL Loading system encounters an error that it cannot interpret.

This can occur when an error originates from a lower level framework or library. Whenever this error code is received, it is a bug, and should be reported to Apple.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCancelled

Returned when an asynchronous load is canceled.

A Web Kit framework delegate will receive this error when it performs a cancel operation on a loading resource. Note that an NSURLConnection or NSURLDownload delegate will not receive this error if the download is canceled.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorBadURL

Returned when a URL is sufficiently malformed that a URL request cannot be initiated

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorTimedOut

Returned when an asynchronous operation times out.

NSURLConnection will send this error to its delegate when the timeoutInterval in NSURLRequest expires before a load can complete.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorUnsupportedURL

Returned when a properly formed URL cannot be handled by the framework.

The most likely cause is that there is no available protocol handler for the URL.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotFindHost

Returned when the host name for a URL cannot be resolved.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotConnectToHost

Returned when an attempt to connect to a host has failed.

This can occur when a host name resolves, but the host is down or may not be accepting connections on a certain port.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorDataLengthExceedsMaximum

Returned when the length of the resource data exceeds the maximum allowed.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorNetworkConnectionLost

Returned when a client or server connection is severed in the middle of an in-progress load.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorDNSLookupFailed

See NSURLErrorCannotFindHost

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorHTTPTooManyRedirects

Returned when a redirect loop is detected or when the threshold for number of allowable redirects has been exceeded (currently 16).

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorResourceUnavailable

Returned when a requested resource cannot be retrieved.

Examples are “file not found”, and data decoding problems that prevent data from being processed correctly.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorNotConnectedToInternet

Returned when a network resource was requested, but an internet connection is not established and cannot be established automatically, either through a lack of connectivity, or by the user's choice not to make a network connection automatically.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorRedirectToNonExistentLocation

Returned when a redirect is specified by way of server response code, but the server does not accompany this code with a redirect URL.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorBadServerResponse

Returned when the URL Loading system receives bad data from the server.

This is equivalent to the “500 Server Error” message sent by HTTP servers.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorUserCancelledAuthentication

Returned when an asynchronous request for authentication is cancelled by the user.

This is typically incurred by clicking a “Cancel” button in a username/password dialog, rather than the user making an attempt to authenticate.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorUserAuthenticationRequired

Returned when authentication is required to access a resource.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorZeroByteResource

Returned when a server reports that a URL has a non-zero content length, but terminates the network connection “gracefully” without sending any data.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotDecodeRawData

Returned when content data received during an NSURLConnection request cannot be decoded for a known content encoding.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotDecodeContentData

Returned when content data received during an NSURLConnection request has an unknown content encoding.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotParseResponse

Returned when a response to an NSURLConnection request cannot be parsed.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorInternationalRoamingOff

Returned when a connection would require activating a data context while roaming, but international roaming is disabled.

Available in iOS 3.0 and later.

Declared in NSURLError.h.

NSURLErrorCallIsActive

Returned when a connection is attempted while a phone call is active on a network that does not support simultaneous phone and data communication (EDGE or GPRS).

Available in iOS 3.0 and later.

Declared in NSURLError.h.

NSURLErrorDataNotAllowed

Returned when the cellular network disallows a connection.

Available in iOS 3.0 and later.

Declared in NSURLError.h.

NSURLErrorRequestBodyStreamExhausted

Returned when a body stream is needed but the client does not provide one. This impacts clients on iOS that send a POST request using a body stream but do not implement the NSURLConnection delegate method connection:needNewBodyStream.

Available in iOS 3.0 and later.

Declared in NSURLError.h.

NSURLErrorFileDoesNotExist

Returned when a file does not exist.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorFileIsDirectory

Returned when a request for an FTP file results in the server responding that the file is not a plain file, but a directory.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorNoPermissionsToReadFile

Returned when a resource cannot be read due to insufficient permissions.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorSecureConnectionFailed

Returned when an attempt to establish a secure connection fails for reasons which cannot be expressed more specifically.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorServerCertificateHasBadDate

Returned when a server certificate has a date which indicates it has expired, or is not yet valid.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorServerCertificateUntrusted

Returned when a server certificate is signed by a root server which is not trusted.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorServerCertificateHasUnknownRoot

Returned when a server certificate is not signed by any root server.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorServerCertificateNotYetValid

Returned when a server certificate is not yet valid.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorClientCertificateRejected

Returned when a server certificate is rejected.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorClientCertificateRequired

Returned when a client certificate is required to authenticate an SSL connection during an NSURLConnection request.

Available in iOS 4.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotLoadFromNetwork

Returned when a specific request to load an item only from the cache cannot be satisfied.

This error is sent at the point when the library would go to the network accept for the fact that is has been blocked from doing so by the “load only from cache” directive.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotCreateFile

Returned when NSURLDownload object was unable to create the downloaded file on disk due to a I/O failure.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotOpenFile

Returned when NSURLDownload was unable to open the downloaded file on disk.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotCloseFile

Returned when NSURLDownload was unable to close the downloaded file on disk.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotWriteToFile

Returned when NSURLDownload was unable to write to the downloaded file on disk.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotRemoveFile

Returned when NSURLDownload was unable to remove a downloaded file from disk.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorCannotMoveFile

Returned when NSURLDownload was unable to move a downloaded file on disk.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorDownloadDecodingFailedMidStream

Returned when NSURLDownload failed to decode an encoded file during the download.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

NSURLErrorDownloadDecodingFailedToComplete

Returned when NSURLDownload failed to decode an encoded file after downloading.

Available in iOS 2.0 and later.

Declared in NSURLError.h.

Availability
  • Available in OS X v10.2 with Safari 1.0 installed.
  • Available in OS X v10.2.7 and later.
Declared In
NSURLError.h
更多0



原创粉丝点击