storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/cmd/gateway/s3/gateway-s3-utils.go (about)

     1  /*
     2   * MinIO Cloud Storage, (C) 2018 MinIO, Inc.
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  package s3
    18  
    19  import (
    20  	minio "storj.io/minio/cmd"
    21  )
    22  
    23  // List of header keys to be filtered, usually
    24  // from all S3 API http responses.
    25  var defaultFilterKeys = []string{
    26  	"Connection",
    27  	"Transfer-Encoding",
    28  	"Accept-Ranges",
    29  	"Date",
    30  	"Server",
    31  	"Vary",
    32  	"x-amz-bucket-region",
    33  	"x-amz-request-id",
    34  	"x-amz-id-2",
    35  	"Content-Security-Policy",
    36  	"X-Xss-Protection",
    37  
    38  	// Add new headers to be ignored.
    39  }
    40  
    41  // FromGatewayObjectPart converts ObjectInfo for custom part stored as object to PartInfo
    42  func FromGatewayObjectPart(partID int, oi minio.ObjectInfo) (pi minio.PartInfo) {
    43  	return minio.PartInfo{
    44  		Size:         oi.Size,
    45  		ETag:         minio.CanonicalizeETag(oi.ETag),
    46  		LastModified: oi.ModTime,
    47  		PartNumber:   partID,
    48  	}
    49  }