protocol

package
v0.0.0-...-d9938a3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcceptsJSON

func AcceptsJSON(accept string) bool

Example: "text/html, application/json;q=0.9, */*;q=0.8"

Noteworthy information: - quality values are ignored (simply checks for "application/json" presence) - wildcards (*/*) are not treated as JSON (intentionally defaults to XML for backward compatibility)

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept

func DetectProtocolVersion

func DetectProtocolVersion(data []byte, contentType string) (string, error)

DetectProtocolVersion attempts to detect the protocol version from the request Supported protocol versions are implemented in version-specific packages (e.g., v3)

func IsJSONContentType

func IsJSONContentType(contentType string) bool

Example: "application/json; charset=utf-8"

See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Type

func IsPingbackRequest

func IsPingbackRequest(body []byte, contentType string) bool

IsPingbackRequest checks if the request body is a pingback. For now, it only checks JSON requests for an "events" field. Uses streaming token parsing for performance - avoids full unmarshal.

Types

type Protocol

type Protocol interface {
	// GetVersion returns the protocol version string
	GetVersion() string

	// ParseRequest parses an update request according to this protocol version
	// It returns an UpdateRequest with extensions and metadata
	ParseRequest([]byte, string) (*extension.UpdateRequest, error)

	// FormatUpdateResponse formats a standard update response based on content type
	FormatUpdateResponse(extension.Extensions, string) ([]byte, error)

	// FormatWebStoreResponse formats a web store response based on content type
	FormatWebStoreResponse(extension.Extensions, string) ([]byte, error)
}

Protocol defines the interface for different Omaha protocol versions

Jump to

Keyboard shortcuts

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