nazahttp

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: MIT Imports: 7 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHTTPHeader = errors.New("nazahttp: fxxk")

Functions

func DownloadHTTPFile added in v0.13.0

func DownloadHTTPFile(url string, saveTo string, timeoutMSec int) (int64, error)

获取http文件保存至本地

func GetHTTPFile added in v0.13.0

func GetHTTPFile(url string, timeoutMSec int) ([]byte, error)

获取http文件保存至字节切片

func ParseHTTPRequestLine added in v0.13.0

func ParseHTTPRequestLine(line string) (method string, uri string, version string, err error)

Request-Line = Method SP URI SP Version CRLF

func ParseHTTPStatusLine added in v0.13.0

func ParseHTTPStatusLine(line string) (version string, statusCode string, reason string, err error)

Status-Line = Version SP Status-Code SP Reason CRLF

func ReadHTTPHeader added in v0.13.0

func ReadHTTPHeader(r LineReader) (firstLine string, headers map[string]string, err error)

@return firstLine: request的request line或response的status line @return headers: request header fileds的键值对

Types

type LineReader added in v0.13.0

type LineReader interface {
	ReadLine() (line []byte, isPrefix bool, err error)
}

Jump to

Keyboard shortcuts

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