net

package
v2.19.7 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 10 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"
	HeaderContentEncoding            = "Content-Encoding"
	HeaderContentLength              = "Content-Length"
	HeaderContentRange               = "Content-Range"
	HeaderContentType                = "Content-Type"
	HeaderETag                       = "ETag"
	HeaderLastModified               = "Last-Modified"
	HeaderLocation                   = "Location"
	HeaderRange                      = "Range"
	HeaderIfMatch                    = "If-Match"
	HeaderIfNoneMatch                = "If-None-Match"
	HeaderPrefer                     = "Prefer"
	HeaderPreferenceApplied          = "Preference-Applied"
	HeaderVary                       = "Vary"
)

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
	CtxOCM10

	// 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"
)
View Source
const (
	HeaderPreferReturn = "return" // eg. return=representation / return=minimal, depth-noroot
)

HTTP Prefer header values

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 ContentDispositionAttachment added in v2.7.1

func ContentDispositionAttachment(filename string) string

ContentDispositionAttachment builds a ContentDisposition Attachment header with various filename encodings

func EncodePath

func EncodePath(path string) string

EncodePath encodes the path of a url.

slashes (/) are treated as path-separators.

func IsCurrentUserOwnerOrManager added in v2.16.0

func IsCurrentUserOwnerOrManager(ctx context.Context, owner *userv1beta1.UserId, md *provider.ResourceInfo) bool

IsCurrentUserOwnerOrManager 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.

func ParsePrefer added in v2.11.0

func ParsePrefer(s string) map[string]string

ParsePrefer parses the prefer header value defined in https://datatracker.ietf.org/doc/html/rfc8144

func RFC1123Z added in v2.7.1

func RFC1123Z(ts *cs3types.Timestamp) string

RFC1123Z formats a CS3 Timestamp to be used in HTTP headers like Last-Modified

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