Documentation ¶
Index ¶
- Constants
- Variables
- func ContentDispositionAttachment(filename string) string
- func EncodePath(path string) string
- func IsCurrentUserOwner(ctx context.Context, owner *userv1beta1.UserId) bool
- func ParseDestination(baseURI, s string) (string, error)
- func ParseOverwrite(s string) (bool, error)
- func ParsePrefer(s string) map[string]string
- func RFC1123Z(ts *cs3types.Timestamp) string
- type Depth
Constants ¶
const ( HeaderAcceptRanges = "Accept-Ranges" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderContentDisposistion = "Content-Disposition" HeaderContentEncoding = "Content-Encoding" HeaderContentLength = "Content-Length" HeaderContentRange = "Content-Range" HeaderContentType = "Content-Type" HeaderETag = "ETag" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderRange = "Range" HeaderIfMatch = "If-Match" HeaderPrefer = "Prefer" HeaderPreferenceApplied = "Preference-Applied" HeaderVary = "Vary" )
Common HTTP headers.
const ( HeaderDav = "DAV" // https://datatracker.ietf.org/doc/html/rfc4918#section-10.1 HeaderDepth = "Depth" // https://datatracker.ietf.org/doc/html/rfc4918#section-10.2 HeaderDestination = "Destination" // https://datatracker.ietf.org/doc/html/rfc4918#section-10.3 HeaderIf = "If" // https://datatracker.ietf.org/doc/html/rfc4918#section-10.4 HeaderLockToken = "Lock-Token" // https://datatracker.ietf.org/doc/html/rfc4918#section-10.5 HeaderOverwrite = "Overwrite" // https://datatracker.ietf.org/doc/html/rfc4918#section-10.6 HeaderTimeout = "Timeout" // https://datatracker.ietf.org/doc/html/rfc4918#section-10.7 )
webdav headers
const ( HeaderOCFileID = "OC-FileId" HeaderOCETag = "OC-ETag" HeaderOCChecksum = "OC-Checksum" HeaderOCPermissions = "OC-Perm" HeaderTusResumable = "Tus-Resumable" HeaderTusVersion = "Tus-Version" HeaderTusExtension = "Tus-Extension" HeaderTusChecksumAlgorithm = "Tus-Checksum-Algorithm" HeaderTusUploadExpires = "Upload-Expires" HeaderUploadChecksum = "Upload-Checksum" HeaderUploadLength = "Upload-Length" HeaderUploadMetadata = "Upload-Metadata" HeaderUploadOffset = "Upload-Offset" HeaderOCMtime = "X-OC-Mtime" HeaderExpectedEntityLength = "X-Expected-Entity-Length" HeaderLitmus = "X-Litmus" HeaderTransferAuth = "TransferHeaderAuthorization" )
Non standard HTTP headers.
const ( // CtxKeyBaseURI is the key of the base URI context field CtxKeyBaseURI ctxKey = iota // NsDav is the Dav ns NsDav = "DAV:" // NsOwncloud is the owncloud ns NsOwncloud = "http://owncloud.org/ns" // NsOCS is the OCS ns NsOCS = "http://open-collaboration-services.org/ns" // RFC1123 time that mimics oc10. time.RFC1123 would end in "UTC", see https://github.com/golang/go/issues/13781 RFC1123 = "Mon, 02 Jan 2006 15:04:05 GMT" // PropQuotaUnknown is the quota unknown property PropQuotaUnknown = "-2" // PropOcFavorite is the favorite ns property PropOcFavorite = "http://owncloud.org/ns/favorite" // PropOcMetaPathForUser is the meta-path-for-user ns property PropOcMetaPathForUser = "http://owncloud.org/ns/meta-path-for-user" // DepthZero represents the webdav zero depth value DepthZero Depth = "0" // DepthOne represents the webdav one depth value DepthOne Depth = "1" // DepthInfinity represents the webdav infinity depth value DepthInfinity Depth = "infinity" )
const (
HeaderPreferReturn = "return" // eg. return=representation / return=minimal, depth-noroot
)
HTTP Prefer header values
Variables ¶
var ( // ErrInvalidHeaderValue defines an error which can occure when trying to parse a header value. ErrInvalidHeaderValue = errors.New("invalid value") )
Functions ¶
func ContentDispositionAttachment ¶ added in v2.7.1
ContentDispositionAttachment builds a ContentDisposition Attachment header with various filename encodings
func IsCurrentUserOwner ¶
func IsCurrentUserOwner(ctx context.Context, owner *userv1beta1.UserId) bool
IsCurrentUserOwner returns whether the context user is the given owner or not
func ParseDestination ¶ added in v2.1.0
ParseDestination parses the destination header value defined in https://datatracker.ietf.org/doc/html/rfc4918#section-10.3 The returned path will be relative to the given baseURI.
func ParseOverwrite ¶ added in v2.1.0
ParseOverwrite parses the overwrite header value defined in https://datatracker.ietf.org/doc/html/rfc4918#section-10.6 Valid values are "T" and "F". An empty string will be parse to true.
func ParsePrefer ¶ added in v2.11.0
ParsePrefer parses the prefer header value defined in https://datatracker.ietf.org/doc/html/rfc8144
Types ¶
type Depth ¶
type Depth string
Depth is a type representing the webdav depth header value
func ParseDepth ¶
ParseDepth parses the depth header value defined in https://tools.ietf.org/html/rfc4918#section-9.1 Valid values are "0", "1" and "infinity". An empty string will be parsed to "1". For all other values this method returns an error.