Documentation ¶
Overview ¶
Package http provides functionality to create http Clients/Servers. Configuration is done via protobuf messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBadAddr is returned when an address is invalid (e.g., it includes a port). ErrBadAddr = errors.New("bad address specified") // ErrMissingPort is returned if the port is required but not specified. ErrMissingPort = errors.New("no port specified") // ErrNoTLSConfig is returned if tls_config is not specified. ErrNoTLSConfig = errors.New("tls_config must be specified") // ErrNoCertFile is returned if cert_file is not specified. ErrNoCertFile = errors.New("tls_config.cert_file must be specified") // ErrNoKeyFile is returned if key_file is not specified. ErrNoKeyFile = errors.New("tls_config.key_file must be specified") )
Functions ¶
func NewClient ¶
func NewClient(cfg *httppb.HttpTransport) (*http.Client, error)
NewClient generates an *http.Client from a config message.
func NoCache ¶
func NoCache(w http.ResponseWriter)
NoCache is a helper to send no-cache headers to an *http.ResponseWriter.
Types ¶
type HandlerFunc ¶
type HandlerFunc func(http.ResponseWriter, *http.Request)
HandlerFunc is the function signature for an HTTP handler.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a wrapper around *http.Server that enforces common settings.
func NewServer ¶
func NewServer(cfg *httppb.HttpServerOptions) (*Server, error)
NewServer generates a *Server from a proto config message.
func (*Server) HandleFunc ¶
func (s *Server) HandleFunc(pattern string, handler HandlerFunc)
HandleFunc registers the handler function for the given pattern: * Disables caching * Sets the HSTS policy, if hstsMaxAge > 0
Click to show internal directories.
Click to hide internal directories.