...

Package httpcc

import "github.com/lestrrat-go/httpcc"
Overview
Index

Overview ▾

Index ▾

Constants
type RequestDirective
    func ParseRequest(v string) (*RequestDirective, error)
    func (d *RequestDirective) Extension(s string) string
    func (d *RequestDirective) Extensions() map[string]string
    func (d *RequestDirective) MaxAge() (uint64, bool)
    func (d *RequestDirective) MaxStale() (uint64, bool)
    func (d *RequestDirective) MinFresh() (uint64, bool)
    func (d *RequestDirective) NoCache() bool
    func (d *RequestDirective) NoStore() bool
    func (d *RequestDirective) NoTransform() bool
    func (d *RequestDirective) OnlyIfCached() bool
type ResponseDirective
    func ParseResponse(v string) (*ResponseDirective, error)
    func (d *ResponseDirective) Extension(s string) string
    func (d *ResponseDirective) Extensions() map[string]string
    func (d *ResponseDirective) MaxAge() (uint64, bool)
    func (d *ResponseDirective) NoCache() []string
    func (d *ResponseDirective) NoStore() bool
    func (d *ResponseDirective) NoTransform() bool
    func (d *ResponseDirective) Private() []string
    func (d *ResponseDirective) ProxyRevalidate() bool
    func (d *ResponseDirective) Public() bool
    func (d *ResponseDirective) SMaxAge() (uint64, bool)
type TokenPair
    func ParseRequestDirective(s string) (*TokenPair, error)
    func ParseRequestDirectives(s string) ([]*TokenPair, error)
    func ParseResponseDirective(s string) (*TokenPair, error)
    func ParseResponseDirectives(s string) ([]*TokenPair, error)
type TokenValuePolicy

Package files

directives.go httpcc.go

Constants

const (
    // Request Cache-Control directives
    MaxAge       = "max-age" // used in response as well
    MaxStale     = "max-stale"
    MinFresh     = "min-fresh"
    NoCache      = "no-cache"     // used in response as well
    NoStore      = "no-store"     // used in response as well
    NoTransform  = "no-transform" // used in response as well
    OnlyIfCached = "only-if-cached"

    // Response Cache-Control directive
    MustRevalidate  = "must-revalidate"
    Public          = "public"
    Private         = "private"
    ProxyRevalidate = "proxy-revalidate"
    SMaxAge         = "s-maxage"
)

type RequestDirective

type RequestDirective struct {
    // contains filtered or unexported fields
}

func ParseRequest

func ParseRequest(v string) (*RequestDirective, error)

ParseRequest parses the content of `Cache-Control` header of an HTTP Request.

func (*RequestDirective) Extension

func (d *RequestDirective) Extension(s string) string

func (*RequestDirective) Extensions

func (d *RequestDirective) Extensions() map[string]string

func (*RequestDirective) MaxAge

func (d *RequestDirective) MaxAge() (uint64, bool)

func (*RequestDirective) MaxStale

func (d *RequestDirective) MaxStale() (uint64, bool)

func (*RequestDirective) MinFresh

func (d *RequestDirective) MinFresh() (uint64, bool)

func (*RequestDirective) NoCache

func (d *RequestDirective) NoCache() bool

func (*RequestDirective) NoStore

func (d *RequestDirective) NoStore() bool

func (*RequestDirective) NoTransform

func (d *RequestDirective) NoTransform() bool

func (*RequestDirective) OnlyIfCached

func (d *RequestDirective) OnlyIfCached() bool

type ResponseDirective

type ResponseDirective struct {
    // contains filtered or unexported fields
}

func ParseResponse

func ParseResponse(v string) (*ResponseDirective, error)

ParseResponse parses the content of `Cache-Control` header of an HTTP Response.

func (*ResponseDirective) Extension

func (d *ResponseDirective) Extension(s string) string

func (*ResponseDirective) Extensions

func (d *ResponseDirective) Extensions() map[string]string

func (*ResponseDirective) MaxAge

func (d *ResponseDirective) MaxAge() (uint64, bool)

func (*ResponseDirective) NoCache

func (d *ResponseDirective) NoCache() []string

func (*ResponseDirective) NoStore

func (d *ResponseDirective) NoStore() bool

func (*ResponseDirective) NoTransform

func (d *ResponseDirective) NoTransform() bool

func (*ResponseDirective) Private

func (d *ResponseDirective) Private() []string

func (*ResponseDirective) ProxyRevalidate

func (d *ResponseDirective) ProxyRevalidate() bool

func (*ResponseDirective) Public

func (d *ResponseDirective) Public() bool

func (*ResponseDirective) SMaxAge

func (d *ResponseDirective) SMaxAge() (uint64, bool)

type TokenPair

type TokenPair struct {
    Name  string
    Value string
}

func ParseRequestDirective

func ParseRequestDirective(s string) (*TokenPair, error)

ParseRequestDirective parses a single token.

func ParseRequestDirectives

func ParseRequestDirectives(s string) ([]*TokenPair, error)

func ParseResponseDirective

func ParseResponseDirective(s string) (*TokenPair, error)

func ParseResponseDirectives

func ParseResponseDirectives(s string) ([]*TokenPair, error)

type TokenValuePolicy

type TokenValuePolicy int
const (
    NoArgument TokenValuePolicy = iota
    TokenOnly
    QuotedStringOnly
    AnyTokenValue
)