Documentation ¶
Index ¶
- Constants
- func AppendURL(u, v *url.URL) *url.URL
- func ClientTLSConfig(cl *http.Client) *tls.Config
- func CopyHeaders(w http.ResponseWriter, r *http.Response)
- func CopyURL(u *url.URL) (ret *url.URL)
- func EncodeQuotedString(s string) string
- func ForwardResponse(w http.ResponseWriter, r *http.Response)
- func GzipHandler(h http.Handler) http.Handler
- func NukeCookie(w http.ResponseWriter, r *http.Request, name, path string)
- func OriginatingProtocol(r *http.Request) string
- func RedirectedRequest(r *http.Request, newUrl string) (ret *http.Request, err error)
- func RequestIsForLocalhost(r *http.Request) bool
- func RequestIsFromLocalhost(r *http.Request) bool
- func RequestedURL(r *http.Request) (ret *url.URL)
- func ReverseProxy(w http.ResponseWriter, r *http.Request, originUrl string, client *http.Client) (err error)
- func ReverseProxyUpgrade(w http.ResponseWriter, r *http.Request, originUrl string) (err error)
- func RoundTripHandler(req *http.Request, h http.Handler) (*http.Response, error)
- func SetOriginRequestForwardingHeaders(o, f *http.Request)
- type AcceptDirective
- type AcceptDirectives
- type BytesContentRange
- type BytesRange
- type CacheControlHeader
- type InProcRoundTripper
- type JustFilesFilesystem
- type Visibility
Constants ¶
const ( Default = 0 Public = 1 Private = 2 )
const StatusClientCancelledRequest = 499
Variables ¶
This section is empty.
Functions ¶
func AppendURL ¶
Return the first URL extended with elements of the second, in the manner that occurs throughout my projects. Noteworthy difference from url.URL.ResolveReference is that if the reference has a scheme, the base is not completely ignored.
func ClientTLSConfig ¶
Returns the http.Client's TLS Config, traversing and generating any defaults along the way to get it.
func CopyHeaders ¶
func CopyHeaders(w http.ResponseWriter, r *http.Response)
func CopyURL ¶
Deep copies a URL. I could call it DeepCopyURL, but what else would you be copying when you have a *url.URL? Of note is that the Userinfo is deep copied. The returned URL shares no references with the original.
func EncodeQuotedString ¶
Performs quoted-string from http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html
func ForwardResponse ¶
func ForwardResponse(w http.ResponseWriter, r *http.Response)
func GzipHandler ¶
Gzips response body if the request says it'll allow it.
func NukeCookie ¶
func NukeCookie(w http.ResponseWriter, r *http.Request, name, path string)
Clears the named cookie for every domain that leads to the current one.
func OriginatingProtocol ¶
func RedirectedRequest ¶
Takes a request, and alters its destination fields, for proxying.
func RequestIsForLocalhost ¶
Request is intended for localhost, either with a localhost name, or loopback IP.
func RequestIsFromLocalhost ¶
Request originated from a loopback IP.
func RequestedURL ¶
Reconstructs the URL that would have produced the given Request. Request.URLs are not fully populated in http.Server handlers.
func ReverseProxy ¶
func ReverseProxyUpgrade ¶
w is for the client response. r is the request to send to the origin (already "forwarded"). originUrl is where to send the request.
func RoundTripHandler ¶
Types ¶
type AcceptDirective ¶
type AcceptDirectives ¶
type AcceptDirectives []AcceptDirective
func ParseAccept ¶
func ParseAccept(line string) (parsed AcceptDirectives, err error)
type BytesContentRange ¶
type BytesContentRange struct {
First, Last, Length int64
}
func ParseBytesContentRange ¶
func ParseBytesContentRange(s string) (ret BytesContentRange, ok bool)
type BytesRange ¶
type BytesRange struct {
First, Last int64
}
func ParseBytesRange ¶
func ParseBytesRange(s string) (ret BytesRange, ok bool)
func (BytesRange) String ¶
func (me BytesRange) String() string
type CacheControlHeader ¶
type CacheControlHeader struct { MaxAge time.Duration Caching Visibility NoStore bool }
func (CacheControlHeader) String ¶
func (me CacheControlHeader) String() string
type InProcRoundTripper ¶
type JustFilesFilesystem ¶
type JustFilesFilesystem struct {
Fs http.FileSystem
}
Wraps a http.FileSystem, disabling directory listings, per the commonly requested feature at https://groups.google.com/forum/#!topic/golang- nuts/bStLPdIVM6w .
type Visibility ¶
type Visibility int