http

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package http provides all HTTP (and FTP)-related operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadTemp

func DownloadTemp(downloader aptly.Downloader, url string) (*os.File, error)

DownloadTemp starts new download to temporary file and returns File

Temporary file would be already removed, so no need to cleanup

func DownloadTempWithChecksum

func DownloadTempWithChecksum(downloader aptly.Downloader, url string, expected utils.ChecksumInfo, ignoreMismatch bool) (*os.File, error)

DownloadTempWithChecksum is a DownloadTemp with checksum verification

Temporary file would be already removed, so no need to cleanup

func DownloadTryCompression

func DownloadTryCompression(downloader aptly.Downloader, url string, expectedChecksums map[string]utils.ChecksumInfo, ignoreMismatch bool) (io.Reader, *os.File, error)

DownloadTryCompression tries to download from URL .bz2, .gz and raw extension until it finds existing file.

func NewDownloader

func NewDownloader(threads int, downLimit int64, progress aptly.Progress) aptly.Downloader

NewDownloader creates new instance of Downloader which specified number of threads and download limit in bytes/sec

Types

type FakeDownloader

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

FakeDownloader is like Downloader, but it used in tests to stub out results

func NewFakeDownloader

func NewFakeDownloader() *FakeDownloader

NewFakeDownloader creates new expected downloader

func (*FakeDownloader) Abort added in v0.9.1

func (f *FakeDownloader) Abort()

Abort does nothing

func (*FakeDownloader) AnyExpectResponse

func (f *FakeDownloader) AnyExpectResponse(url string, response string) *FakeDownloader

AnyExpectResponse installs expectation on upcoming download with response in any order (url should be unique)

func (*FakeDownloader) Download

func (f *FakeDownloader) Download(url string, filename string, result chan<- error)

Download performs fake download by matching against first expectation in the queue

func (*FakeDownloader) DownloadWithChecksum

func (f *FakeDownloader) DownloadWithChecksum(url string, filename string, result chan<- error, expected utils.ChecksumInfo, ignoreMismatch bool)

DownloadWithChecksum performs fake download by matching against first expectation in the queue or any expectation, with cheksum verification

func (*FakeDownloader) Empty

func (f *FakeDownloader) Empty() bool

Empty verifies that are planned downloads have happened

func (*FakeDownloader) ExpectError

func (f *FakeDownloader) ExpectError(url string, err error) *FakeDownloader

ExpectError installs expectation on upcoming download with error

func (*FakeDownloader) ExpectResponse

func (f *FakeDownloader) ExpectResponse(url string, response string) *FakeDownloader

ExpectResponse installs expectation on upcoming download with response

func (*FakeDownloader) GetProgress

func (f *FakeDownloader) GetProgress() aptly.Progress

GetProgress returns Progress object

func (*FakeDownloader) Pause

func (f *FakeDownloader) Pause()

Pause does nothing

func (*FakeDownloader) Resume

func (f *FakeDownloader) Resume()

Resume does nothing

func (*FakeDownloader) Shutdown

func (f *FakeDownloader) Shutdown()

Shutdown does nothing

type HTTPError added in v0.9.1

type HTTPError struct {
	Code int
	URL  string
}

HTTPError is download error connected to HTTP code

func (*HTTPError) Error added in v0.9.1

func (e *HTTPError) Error() string

Error

Jump to

Keyboard shortcuts

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