github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/cmn/cos/http_headers.go (about)

     1  // Package cos provides common low-level types and utilities for all aistore projects
     2  /*
     3   * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package cos
     6  
     7  // standard MIME types
     8  // - https://www.iana.org/assignments/media-types/media-types.xhtml
     9  // - https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
    10  const (
    11  	ContentJSON           = "application/json"
    12  	ContentJSONCharsetUTF = "application/json; charset=utf-8"
    13  	ContentMsgPack        = "application/msgpack"
    14  	ContentXML            = "application/xml"
    15  	ContentBinary         = "application/octet-stream"
    16  
    17  	// not present in IANA registry
    18  	// mozilla.org has it though, and also https://en.wikipedia.org/wiki/List_of_archive_formats
    19  	ContentTar = "application/x-tar"
    20  
    21  	// not currently used
    22  	ContentZip = "application/zip"
    23  )
    24  
    25  // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
    26  const (
    27  	// range to read:
    28  	HdrRange          = "Range" // Ref: https://www.rfc-editor.org/rfc/rfc7233#section-2.1
    29  	HdrRangeValPrefix = "bytes="
    30  	// range read response:
    31  	HdrContentRange          = "Content-Range"
    32  	HdrContentRangeValPrefix = "bytes " // Ref: https://tools.ietf.org/html/rfc7233#section-4.2
    33  	HdrAcceptRanges          = "Accept-Ranges"
    34  
    35  	// content length & type
    36  	HdrContentType        = "Content-Type"
    37  	HdrContentTypeOptions = "X-Content-Type-Options"
    38  	HdrContentLength      = "Content-Length"
    39  
    40  	// misc. gen
    41  	HdrUserAgent = "User-Agent"
    42  	HdrAccept    = "Accept"
    43  	HdrLocation  = "Location"
    44  	HdrServer    = "Server"
    45  	HdrETag      = "ETag" // Ref: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
    46  )
    47  
    48  //
    49  // provider-specific headers (=> custom props, and more)
    50  //
    51  
    52  const (
    53  	// https://cloud.google.com/storage/docs/xml-api/reference-headers
    54  	GsCksumHeader   = "x-goog-hash"
    55  	GsVersionHeader = "x-goog-generation"
    56  )
    57  
    58  const (
    59  	// https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
    60  	// https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html
    61  	S3CksumHeader   = HdrETag
    62  	S3VersionHeader = "x-amz-version-id"
    63  
    64  	// s3 api request headers
    65  	S3HdrObjSrc = "x-amz-copy-source"
    66  	S3HdrMptCnt = "x-amz-mp-parts-count"
    67  
    68  	// https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
    69  	S3UnsignedPayload  = "UNSIGNED-PAYLOAD"
    70  	S3HdrContentSHA256 = "x-amz-content-sha256"
    71  
    72  	S3HdrBckRegion = "x-amz-bucket-region"
    73  
    74  	S3ChecksumCRC32  = "x-amz-checksum-crc32"
    75  	S3ChecksumCRC32C = "x-amz-checksum-crc32c"
    76  	S3ChecksumSHA1   = "x-amz-checksum-sha1"
    77  	S3ChecksumSHA256 = "x-amz-checksum-sha256"
    78  
    79  	S3MetadataChecksumType = "x-amz-meta-ais-cksum-type"
    80  	S3MetadataChecksumVal  = "x-amz-meta-ais-cksum-val"
    81  
    82  	S3LastModified = "Last-Modified"
    83  )
    84  
    85  const (
    86  	// https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties#response-headers
    87  	AzCksumHeader   = "Content-MD5"
    88  	AzVersionHeader = HdrETag
    89  )
    90  
    91  // NOTE: for AIS headers, see api/apc/headers.go