http_status_code.h 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef NET_HTTP_HTTP_STATUS_CODE_H_
  5. #define NET_HTTP_HTTP_STATUS_CODE_H_
  6. #include "net/base/net_export.h"
  7. namespace net {
  8. // HTTP status codes.
  9. enum HttpStatusCode {
  10. #define HTTP_STATUS_ENUM_VALUE(label, code, reason) HTTP_##label = code,
  11. #include "net/http/http_status_code_list.h"
  12. #undef HTTP_STATUS_ENUM_VALUE
  13. };
  14. // Returns the corresponding HTTP status description to use in the Reason-Phrase
  15. // field in an HTTP response for given |code|. It's based on the IANA HTTP
  16. // Status Code Registry.
  17. // http://www.iana.org/assignments/http-status-codes/http-status-codes.xml
  18. //
  19. // This function may not cover all codes defined in the IANA registry. It
  20. // returns an empty string (or crash in debug build) for status codes which are
  21. // not yet covered or just invalid. Please extend it when needed.
  22. NET_EXPORT const char* GetHttpReasonPhrase(HttpStatusCode code);
  23. } // namespace net
  24. #endif // NET_HTTP_HTTP_STATUS_CODE_H_