http

package
v1.16.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultUserAgent is the default User-Agent header value used in HTTP requests.
	DefaultUserAgent string

	// ReqHeaderProc is a callback function that allows users to modify
	// the HTTP request headers before sending the request.
	ReqHeaderProc func(req *http.Request)

	Client = &http.Client{
		Timeout: 30 * time.Second,
	}
)

Functions

func Get

func Get(url string) (resp *http.Response, err error)

Get sends a GET request to the specified URL.

Security: Server-Side Request Forgery (SSRF) The function accepts arbitrary URLs without validation. An attacker can provide URLs to internal network resources (e.g., http://localhost:6379, http://169.254.169.254/latest/meta-data/) to scan internal networks, access cloud metadata services, or interact with internal APIs.

func Open

func Open(url string) (io.ReadCloser, error)

Open opens the URL and returns the response body as an io.ReadCloser.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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