response_codes.cc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
  2. *
  3. * Gearmand client and server library.
  4. *
  5. * Copyright (C) 2012 Data Differential, http://datadifferential.com/
  6. * All rights reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions are
  10. * met:
  11. *
  12. * * Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * * Redistributions in binary form must reproduce the above
  16. * copyright notice, this list of conditions and the following disclaimer
  17. * in the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * * The names of its contributors may not be used to endorse or
  21. * promote products derived from this software without specific prior
  22. * written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. */
  37. #include "gear_config.h"
  38. #include <libgearman-server/plugins/protocol/http/response_codes.h>
  39. namespace gearmand {
  40. namespace protocol {
  41. namespace httpd {
  42. const char *response(response_t arg)
  43. {
  44. switch (arg)
  45. {
  46. case HTTP_CONTINUE: return "CONTINUE";
  47. case HTTP_SWITCHING_PROTOCOLS: return "SWITCHING_PROTOCOLS";
  48. case HTTP_PROCESSING: return "PROCESSING";
  49. case HTTP_OK: return "OK";
  50. case HTTP_CREATED: return "CREATED";
  51. case HTTP_ACCEPTED: return "ACCEPTED";
  52. case HTTP_NON_AUTHORITATIVE: return "NON_AUTHORITATIVE";
  53. case HTTP_NO_CONTENT: return "NO_CONTENT";
  54. case HTTP_RESET_CONTENT: return "RESET_CONTENT";
  55. case HTTP_PARTIAL_CONTENT: return "PARTIAL_CONTENT";
  56. case HTTP_MULTI_STATUS: return "MULTI_STATUS";
  57. case HTTP_MULTIPLE_CHOICES: return "MULTIPLE_CHOICES";
  58. case HTTP_MOVED_PERMANENTLY: return "MOVED_PERMANENTLY";
  59. case HTTP_MOVED_TEMPORARILY: return "MOVED_TEMPORARILY";
  60. case HTTP_SEE_OTHER: return "SEE_OTHER";
  61. case HTTP_NOT_MODIFIED: return "NOT_MODIFIED";
  62. case HTTP_USE_PROXY: return "USE_PROXY";
  63. case HTTP_TEMPORARY_REDIRECT: return "TEMPORARY_REDIRECT";
  64. case HTTP_BAD_REQUEST: return "BAD_REQUEST";
  65. case HTTP_UNAUTHORIZED: return "UNAUTHORIZED";
  66. case HTTP_PAYMENT_REQUIRED: return "PAYMENT_REQUIRED";
  67. case HTTP_FORBIDDEN: return "FORBIDDEN";
  68. case HTTP_NOT_FOUND: return "NOT_FOUND";
  69. case HTTP_METHOD_NOT_ALLOWED: return "METHOD_NOT_ALLOWED";
  70. case HTTP_NOT_ACCEPTABLE: return "NOT_ACCEPTABLE";
  71. case HTTP_PROXY_AUTHENTICATION_REQUIRED: return "PROXY_AUTHENTICATION_REQUIRED";
  72. case HTTP_REQUEST_TIME_OUT: return "REQUEST_TIME_OUT";
  73. case HTTP_CONFLICT: return "CONFLICT";
  74. case HTTP_GONE: return "GONE";
  75. case HTTP_LENGTH_REQUIRED: return "LENGTH_REQUIRED";
  76. case HTTP_PRECONDITION_FAILED: return "PRECONDITION_FAILED";
  77. case HTTP_REQUEST_ENTITY_TOO_LARGE: return "REQUEST_ENTITY_TOO_LARGE";
  78. case HTTP_REQUEST_URI_TOO_LARGE: return "REQUEST_URI_TOO_LARGE";
  79. case HTTP_UNSUPPORTED_MEDIA_TYPE: return "UNSUPPORTED_MEDIA_TYPE";
  80. case HTTP_RANGE_NOT_SATISFIABLE: return "RANGE_NOT_SATISFIABLE";
  81. case HTTP_EXPECTATION_FAILED: return "EXPECTATION_FAILED";
  82. case HTTP_UNPROCESSABLE_ENTITY: return "UNPROCESSABLE_ENTITY";
  83. case HTTP_LOCKED: return "LOCKED";
  84. case HTTP_FAILED_DEPENDENCY: return "FAILED_DEPENDENCY";
  85. case HTTP_UPGRADE_REQUIRED: return "UPGRADE_REQUIRED";
  86. case HTTP_NOT_IMPLEMENTED: return "NOT_IMPLEMENTED";
  87. case HTTP_BAD_GATEWAY: return "BAD_GATEWAY";
  88. case HTTP_SERVICE_UNAVAILABLE: return "SERVICE_UNAVAILABLE";
  89. case HTTP_GATEWAY_TIME_OUT: return "GATEWAY_TIME_OUT";
  90. case HTTP_VERSION_NOT_SUPPORTED: return "VERSION_NOT_SUPPORTED";
  91. case HTTP_VARIANT_ALSO_VARIES: return "VARIANT_ALSO_VARIES";
  92. case HTTP_INSUFFICIENT_STORAGE: return "INSUFFICIENT_STORAGE";
  93. case HTTP_NOT_EXTENDED: return "NOT_EXTENDED";
  94. case HTTP_INTERNAL_SERVER_ERROR:
  95. default:
  96. break;
  97. }
  98. return "INTERNAL_SERVER_ERROR";
  99. }
  100. } // namespace http
  101. } // namespace protocol
  102. } // namespace gearmand