GCDWebServerHTTPStatusCodes.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. Copyright (c) 2012-2015, Pierre-Olivier Latour
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * The name of Pierre-Olivier Latour may not be used to endorse
  12. or promote products derived from this software without specific
  13. prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL PIERRE-OLIVIER LATOUR BE LIABLE FOR ANY
  18. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. // http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
  26. // http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
  27. #import <Foundation/Foundation.h>
  28. /**
  29. * Convenience constants for "informational" HTTP status codes.
  30. */
  31. typedef NS_ENUM(NSInteger, GCDWebServerInformationalHTTPStatusCode) {
  32. kGCDWebServerHTTPStatusCode_Continue = 100,
  33. kGCDWebServerHTTPStatusCode_SwitchingProtocols = 101,
  34. kGCDWebServerHTTPStatusCode_Processing = 102
  35. };
  36. /**
  37. * Convenience constants for "successful" HTTP status codes.
  38. */
  39. typedef NS_ENUM(NSInteger, GCDWebServerSuccessfulHTTPStatusCode) {
  40. kGCDWebServerHTTPStatusCode_OK = 200,
  41. kGCDWebServerHTTPStatusCode_Created = 201,
  42. kGCDWebServerHTTPStatusCode_Accepted = 202,
  43. kGCDWebServerHTTPStatusCode_NonAuthoritativeInformation = 203,
  44. kGCDWebServerHTTPStatusCode_NoContent = 204,
  45. kGCDWebServerHTTPStatusCode_ResetContent = 205,
  46. kGCDWebServerHTTPStatusCode_PartialContent = 206,
  47. kGCDWebServerHTTPStatusCode_MultiStatus = 207,
  48. kGCDWebServerHTTPStatusCode_AlreadyReported = 208
  49. };
  50. /**
  51. * Convenience constants for "redirection" HTTP status codes.
  52. */
  53. typedef NS_ENUM(NSInteger, GCDWebServerRedirectionHTTPStatusCode) {
  54. kGCDWebServerHTTPStatusCode_MultipleChoices = 300,
  55. kGCDWebServerHTTPStatusCode_MovedPermanently = 301,
  56. kGCDWebServerHTTPStatusCode_Found = 302,
  57. kGCDWebServerHTTPStatusCode_SeeOther = 303,
  58. kGCDWebServerHTTPStatusCode_NotModified = 304,
  59. kGCDWebServerHTTPStatusCode_UseProxy = 305,
  60. kGCDWebServerHTTPStatusCode_TemporaryRedirect = 307,
  61. kGCDWebServerHTTPStatusCode_PermanentRedirect = 308
  62. };
  63. /**
  64. * Convenience constants for "client error" HTTP status codes.
  65. */
  66. typedef NS_ENUM(NSInteger, GCDWebServerClientErrorHTTPStatusCode) {
  67. kGCDWebServerHTTPStatusCode_BadRequest = 400,
  68. kGCDWebServerHTTPStatusCode_Unauthorized = 401,
  69. kGCDWebServerHTTPStatusCode_PaymentRequired = 402,
  70. kGCDWebServerHTTPStatusCode_Forbidden = 403,
  71. kGCDWebServerHTTPStatusCode_NotFound = 404,
  72. kGCDWebServerHTTPStatusCode_MethodNotAllowed = 405,
  73. kGCDWebServerHTTPStatusCode_NotAcceptable = 406,
  74. kGCDWebServerHTTPStatusCode_ProxyAuthenticationRequired = 407,
  75. kGCDWebServerHTTPStatusCode_RequestTimeout = 408,
  76. kGCDWebServerHTTPStatusCode_Conflict = 409,
  77. kGCDWebServerHTTPStatusCode_Gone = 410,
  78. kGCDWebServerHTTPStatusCode_LengthRequired = 411,
  79. kGCDWebServerHTTPStatusCode_PreconditionFailed = 412,
  80. kGCDWebServerHTTPStatusCode_RequestEntityTooLarge = 413,
  81. kGCDWebServerHTTPStatusCode_RequestURITooLong = 414,
  82. kGCDWebServerHTTPStatusCode_UnsupportedMediaType = 415,
  83. kGCDWebServerHTTPStatusCode_RequestedRangeNotSatisfiable = 416,
  84. kGCDWebServerHTTPStatusCode_ExpectationFailed = 417,
  85. kGCDWebServerHTTPStatusCode_UnprocessableEntity = 422,
  86. kGCDWebServerHTTPStatusCode_Locked = 423,
  87. kGCDWebServerHTTPStatusCode_FailedDependency = 424,
  88. kGCDWebServerHTTPStatusCode_UpgradeRequired = 426,
  89. kGCDWebServerHTTPStatusCode_PreconditionRequired = 428,
  90. kGCDWebServerHTTPStatusCode_TooManyRequests = 429,
  91. kGCDWebServerHTTPStatusCode_RequestHeaderFieldsTooLarge = 431
  92. };
  93. /**
  94. * Convenience constants for "server error" HTTP status codes.
  95. */
  96. typedef NS_ENUM(NSInteger, GCDWebServerServerErrorHTTPStatusCode) {
  97. kGCDWebServerHTTPStatusCode_InternalServerError = 500,
  98. kGCDWebServerHTTPStatusCode_NotImplemented = 501,
  99. kGCDWebServerHTTPStatusCode_BadGateway = 502,
  100. kGCDWebServerHTTPStatusCode_ServiceUnavailable = 503,
  101. kGCDWebServerHTTPStatusCode_GatewayTimeout = 504,
  102. kGCDWebServerHTTPStatusCode_HTTPVersionNotSupported = 505,
  103. kGCDWebServerHTTPStatusCode_InsufficientStorage = 507,
  104. kGCDWebServerHTTPStatusCode_LoopDetected = 508,
  105. kGCDWebServerHTTPStatusCode_NotExtended = 510,
  106. kGCDWebServerHTTPStatusCode_NetworkAuthenticationRequired = 511
  107. };