hsruntime

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package hsruntime provides HTTPScript-specific program runtime context, such as config loading, cookie loading, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Globals scope.ScopedBindings
	Funcs   *scope.FuncTable

	DefaultHost  string
	HostAliasing HostAliasFn
	Client       *http.Client
}

func NewContext

func NewContext() *Context

func NewDefaultContext

func NewDefaultContext(opts Options) (ctx *Context, err error)

NewDefaultContext returns a default setup of Context, binding standard funcs, loading config, etc.

type DeferredLoadCookieJar added in v0.1.5

type DeferredLoadCookieJar struct {
	LoadFn func() (http.CookieJar, error)
	// contains filtered or unexported fields
}

DeferredLoadCookieJar is an http.CookieJar that only constructs its underlying jar (using LoadFn) on use.

func (*DeferredLoadCookieJar) Cookies added in v0.1.5

func (d *DeferredLoadCookieJar) Cookies(u *url.URL) []*http.Cookie

func (*DeferredLoadCookieJar) SetCookies added in v0.1.5

func (d *DeferredLoadCookieJar) SetCookies(u *url.URL, cookies []*http.Cookie)

type HostAliasFn

type HostAliasFn func(hostname string) (newHostname string)

HostAliasFn applies host aliasing rules, returning a new hostname (or "" if no aliasing is applied).

func ComposeHostAliasing

func ComposeHostAliasing(base, next HostAliasFn) HostAliasFn

type Options

type Options struct {
	CookieSpecs []string
}

type SimpleHostAliases

type SimpleHostAliases map[string]string

func (SimpleHostAliases) GetAlias

func (sha SimpleHostAliases) GetAlias(hostname string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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