Documentation ¶
Index ¶
- Constants
- Variables
- func DumpResponseBody(resp *http.Response) []byte
- func ExtractAccessKey(req *http.Request) string
- func ExtractBucketAndKey(requestPath string) (string, string)
- func ExtractBucketFrom(requestPath string) string
- func ExtractMultiPartUploadIDFrom(response *http.Response) (string, error)
- func GetRequestProcessingMetadata(req *http.Request, key string) string
- func IsBucketPath(path string) bool
- func IsInitiateMultiPartUploadRequest(request *http.Request) bool
- func IsMultiPartUploadRequest(request *http.Request) bool
- func IsObjectPath(path string) bool
- func PutResponseHeaderToContext(context context.Context, contextValueName log.ContextKey, resp *http.Response, ...)
- func ReadRequestBody(request *http.Request) ([]byte, error)
- func ReplicateRequest(request *http.Request) (*http.Request, error)
- func RequestID(req *http.Request) string
- func ResponseForbidden(req *http.Request) *http.Response
- func SetRequestProcessingMetadata(req *http.Request, key, value string)
- type BackendError
- type ContextKey
- type ParsedAuthorizationHeader
Constants ¶
const ( //SignV2Algorithm is a prefix for v2 auth header SignV2Algorithm = "AWS" //SignV4Algorithm indicates a v4 SignV4Algorithm = "AWS4-HMAC-SHA256" //RegexV2Algorithm is a regexp for parsing v2 auth headers RegexV2Algorithm = "AWS +(?P<access_key>[a-zA-Z0-9_-]+):(?P<Signature>(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?)" //RegexV4Algorithm is a regexp for parsing v4 auth headers RegexV4Algorithm = "" /* 213-byte string literal not displayed */ )
Variables ¶
var ErrNoAuthHeader = fmt.Errorf("cannot find correct authorization header")
ErrNoAuthHeader indicates that no authorization header was found in the request
var ReqMetadataKey = ContextKey("ContextReqHost")
Functions ¶
func DumpResponseBody ¶
func ExtractAccessKey ¶
ExtractAccessKey extracts s3 auth key from header
func ExtractBucketAndKey ¶
ExtractBucketAndKey extract object's bucket and key from request URL
func ExtractBucketFrom ¶
ExtractBucketFrom extract bucket's name from request's path, if no bucket name is found, empty string is returned
func ExtractMultiPartUploadIDFrom ¶
ExtractMultiPartUploadIDFrom extract multipart upload id from http response
func IsBucketPath ¶
IsBucketPath check if a given path is a bucket path
func IsInitiateMultiPartUploadRequest ¶
IsInitiateMultiPartUploadRequest checks if a request is an initiate multipart upload request
func IsMultiPartUploadRequest ¶
TODO Query() parses the query string every time it's called... this can (and should!) be optimized IsMultiPartUploadRequest checks if a request is a multipart upload request
func IsObjectPath ¶
IsObjectPath check if a given path is an object path
func PutResponseHeaderToContext ¶
func PutResponseHeaderToContext(context context.Context, contextValueName log.ContextKey, resp *http.Response, headerName string)
PutResponseHeaderToContext extracts the header value from the response and puts it into the context under the specified key
func ReadRequestBody ¶
ReadRequestBody returns the bytes of the request body or nil of body is not present
func ReplicateRequest ¶
ReplicateRequest makes a copy of the provided request
Types ¶
type BackendError ¶
BackendError interface helps logging inconsistencies
type ContextKey ¶
type ContextKey string
type ParsedAuthorizationHeader ¶
type ParsedAuthorizationHeader struct { Version string AccessKey string Signature string SignedHeaders string Region string Service string }
ParsedAuthorizationHeader holds the parsed "Authorization" header content
func ParseAuthorizationHeader ¶
func ParseAuthorizationHeader(authorizationHeader string) (authHeader ParsedAuthorizationHeader, err error)
ParseAuthorizationHeader - extract S3 authorization header details