http_headers.py 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # Copyright 2014 Baidu, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License") you may not use this file
  4. # except in compliance with the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the
  9. # License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  10. # either express or implied. See the License for the specific language governing permissions
  11. # and limitations under the License.
  12. """
  13. This module defines string constants for HTTP headers
  14. """
  15. # Standard HTTP Headers
  16. AUTHORIZATION = b"Authorization"
  17. CACHE_CONTROL = b"Cache-Control"
  18. CONTENT_DISPOSITION = b"Content-Disposition"
  19. CONTENT_ENCODING = b"Content-Encoding"
  20. CONTENT_LENGTH = b"Content-Length"
  21. CONTENT_MD5 = b"Content-MD5"
  22. CONTENT_RANGE = b"Content-Range"
  23. CONTENT_TYPE = b"Content-Type"
  24. DATE = b"Date"
  25. ETAG = b"ETag"
  26. EXPIRES = b"Expires"
  27. HOST = b"Host"
  28. LAST_MODIFIED = b"Last-Modified"
  29. RANGE = b"Range"
  30. SERVER = b"Server"
  31. USER_AGENT = b"User-Agent"
  32. # BCE Common HTTP Headers
  33. BCE_PREFIX = b"x-bce-"
  34. BCE_ACL = b"x-bce-acl"
  35. BCE_CONTENT_SHA256 = b"x-bce-content-sha256"
  36. BCE_COPY_METADATA_DIRECTIVE = b"x-bce-metadata-directive"
  37. BCE_COPY_SOURCE = b"x-bce-copy-source"
  38. BCE_COPY_SOURCE_IF_MATCH = b"x-bce-copy-source-if-match"
  39. BCE_COPY_SOURCE_IF_MODIFIED_SINCE = b"x-bce-copy-source-if-modified-since"
  40. BCE_COPY_SOURCE_IF_NONE_MATCH = b"x-bce-copy-source-if-none-match"
  41. BCE_COPY_SOURCE_IF_UNMODIFIED_SINCE = b"x-bce-copy-source-if-unmodified-since"
  42. BCE_COPY_SOURCE_RANGE = b"x-bce-copy-source-range"
  43. BCE_DATE = b"x-bce-date"
  44. BCE_USER_METADATA_PREFIX = b"x-bce-meta-"
  45. BCE_REQUEST_ID = b"x-bce-request-id"
  46. # BOS HTTP Headers START
  47. BOS_DEBUG_ID = b"x-bce-bos-debug-id"
  48. BOS_STORAGE_CLASS = b"x-bce-storage-class"
  49. BOS_GRANT_READ = b'x-bce-grant-read'
  50. BOS_GRANT_FULL_CONTROL = b'x-bce-grant-full-control'
  51. BOS_FETCH_SOURCE = b"x-bce-fetch-source"
  52. BOS_FETCH_MODE = b"x-bce-fetch-mode"
  53. BOS_SERVER_SIDE_ENCRYPTION = b"x-bce-server-side-encryption"
  54. BOS_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY = b"x-bce-server-side-encryption-customer-key"
  55. BOS_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5 = b"x-bce-server-side-encryption-customer-key-md5"
  56. BOS_RESTORE_TIER = b"x-bce-restore-tier"
  57. BOS_RESTORE_DAYS = b"x-bce-restore-days"
  58. BOS_SYMLINK_TARGET = b"x-bce-symlink-target"
  59. BOS_SYMLINK_BUCKET = b"x-bce-symlink-bucket"
  60. BOS_FORBID_OVERWRITE = b"x-bce-forbid-overwrite"
  61. BOS_TRAFFIC_LIMIT = b"x-bce-traffic-limit"
  62. BOS_VERSIONING = b"x-bce-versioning"
  63. BOS_OBJECT_EXPIRES = b"x-bce-object-expires"
  64. BOS_TAGGING = b"x-bce-tagging"
  65. BOS_PROCESS = b"x-bce-process"
  66. BOS_BASE_ALLOW_HEADERS = set([BOS_TRAFFIC_LIMIT, BOS_VERSIONING, BOS_TAGGING, BOS_PROCESS, BOS_OBJECT_EXPIRES])
  67. BOS_IF_MATCH = b"If-Match"
  68. BOS_IF_NONE_MATCH = b"If-None-Match"
  69. BOS_IF_MODIFIED_SINCE = b"If-Modified-Since"
  70. BOS_IF_UNMODIFIED_SINCE = b"If-Unmodified-Since"
  71. BOS_COND_READ_WRITE_HEADERS = set([BOS_IF_UNMODIFIED_SINCE, BOS_IF_MATCH, BOS_IF_NONE_MATCH])
  72. # BOS HTTP Headers END
  73. # STS HTTP Headers
  74. STS_SECURITY_TOKEN = b"x-bce-security-token"
  75. # BTS HTTP Headers
  76. BTS_METHOD_HEADER = b"x-bce-bts-method"