etcd: go.etcd.io/etcd/pkg/httputil Index | Files

package httputil

import "go.etcd.io/etcd/pkg/httputil"

Package httputil provides HTTP utility functions.

Index

Package Files

httputil.go

func GetHostname Uses

func GetHostname(req *http.Request) string

GetHostname returns the hostname from request Host field. It returns empty string, if Host field contains invalid value (e.g. "localhost:::" with too many colons).

func GracefulClose Uses

func GracefulClose(resp *http.Response)

GracefulClose drains http.Response.Body until it hits EOF and closes it. This prevents TCP/TLS connections from closing, therefore available for reuse. Borrowed from golang/net/context/ctxhttp/cancelreq.go.

Package httputil imports 4 packages (graph) and is imported by 29 packages. Updated 2018-08-29. Refresh now. Tools for package owners.