netutils

package
v0.0.0-...-e5281c0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2013 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MEMORY_BUFFER_LIMIT = 1048576

Variables

This section is empty.

Functions

func CopyHeaders

func CopyHeaders(dst, src http.Header)

Copies http headers from source to destination does not overide, but adds multiple headers

func CopyUrl

func CopyUrl(in *url.URL) *url.URL

Provides update safe copy by avoiding shallow copying certain fields (like user data)

func HasHeaders

func HasHeaders(names []string, headers http.Header) bool

Determines whether any of the header names is present in the http headers

func MultiReaderSeeker

func MultiReaderSeeker(cleanup CleanupFunc, readers ...io.ReadSeeker) *multiReaderSeek

func NewBodyBuffer

func NewBodyBuffer(input io.Reader) (*multiReaderSeek, error)

func ParseUrl

func ParseUrl(inUrl string) (*url.URL, error)

Standard parse url is very generous, parseUrl wrapper makes it more strict and demands scheme and host to be set

func RemoveHeaders

func RemoveHeaders(names []string, headers http.Header)

Removes the header with the given names from the headers map

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func ParseAuthHeader

func ParseAuthHeader(header string) (*BasicAuth, error)

type CleanupFunc

type CleanupFunc func() error

type HttpError

type HttpError struct {
	StatusCode int
	Body       []byte
}

func NewHttpError

func NewHttpError(statusCode int) *HttpError

func (*HttpError) Error

func (r *HttpError) Error() string

Jump to

Keyboard shortcuts

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