net

package
v2.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
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.

webdav headers

View Source
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.

View Source
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"
)

Variables

View Source
var (
	// ErrInvalidHeaderValue defines an error which can occure when trying to parse a header value.
	ErrInvalidHeaderValue = errors.New("invalid value")
)

Functions

func EncodePath

func EncodePath(path string) string

EncodePath encodes the path of a url.

slashes (/) are treated as path-separators.

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

func ParseDestination(baseURI, s string) (string, error)

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

func ParseOverwrite(s string) (bool, error)

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

func ParseDepth(s string) (Depth, error)

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.

func (Depth) String

func (d Depth) String() string

String returns the string representation of the webdav depth value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL