http

package
v0.0.0-...-1c9e867 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const NoSuitableAddrStr string = "no suitable address found"

NoSuitableAddrStr - the string to be used for checking the error message Since the golang net package does not export this, we have to define it here again

Variables

This section is empty.

Functions

func IsNoSuitableAddrErr

func IsNoSuitableAddrErr(err error) bool

IsNoSuitableAddrErr - the function to check 'no suitable address' for http mainly

Types

type ErrTimeout

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

ErrTimeout is the error returned when a timeout occurs. The error message will be the timeout duration that was exceeded.

func (*ErrTimeout) Error

func (e *ErrTimeout) Error() string

func (*ErrTimeout) Is

func (e *ErrTimeout) Is(err error) bool

Is the other error the same type? We do not really care about the properties

type Resp

type Resp struct {
	List          []string //list of images at given path
	BodyLength    int      // Body length in http response
	ContentLength int64    // Content length in http response
}

Resp response data from executing commands

func ExecCmd

func ExecCmd(ctx context.Context, cmd, host, remoteFile, localFile string, objSize int64,
	prgNotify types.StatsNotifChan, client *http.Client, inactivityTimeout time.Duration) (types.UpdateStats, Resp)

ExecCmd performs various commands such as "ls", "get", etc. Note that "host" needs to contain the URL in the case of a get

type TimeoutReader

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

TimeoutReader reads until a preset timeout, then returns a timeout error. The timeout is for each read.

func NewTimeoutReader

func NewTimeoutReader(timeout time.Duration, r io.Reader) *TimeoutReader

NewTimeoutReader creates a new TimeoutReader.

func (*TimeoutReader) Read

func (r *TimeoutReader) Read(p []byte) (int, error)

Read reads from the underlying reader.

Jump to

Keyboard shortcuts

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