Documentation ¶
Index ¶
Constants ¶
const ( HeaderAcceptRanges = "Accept-Ranges" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderContentDisposistion = "Content-Disposition" HeaderContentLength = "Content-Length" HeaderContentRange = "Content-Range" HeaderContentType = "Content-Type" HeaderETag = "ETag" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderRange = "Range" HeaderIfMatch = "If-Match" )
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" )
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" // 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" )
Variables ¶
var ( // ErrInvalidHeaderValue defines an error which can occure when trying to parse a header value. ErrInvalidHeaderValue = errors.New("invalid value") )
Functions ¶
func EncodePath ¶
EncodePath encodes the path of a url.
slashes (/) are treated as path-separators. ported from https://github.com/sabre-io/http/blob/bb27d1a8c92217b34e778ee09dcf79d9a2936e84/lib/functions.php#L369-L379
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.
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.