go1.16 (#14783)
This commit is contained in:
parent
030646eea4
commit
47f6a4ec3f
947 changed files with 26119 additions and 7062 deletions
4
vendor/github.com/go-chi/chi/middleware/profiler.go
generated
vendored
4
vendor/github.com/go-chi/chi/middleware/profiler.go
generated
vendored
|
@ -23,10 +23,10 @@ func Profiler() http.Handler {
|
|||
r.Use(NoCache)
|
||||
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, r.RequestURI+"/pprof/", 301)
|
||||
http.Redirect(w, r, r.RequestURI+"/pprof/", http.StatusMovedPermanently)
|
||||
})
|
||||
r.HandleFunc("/pprof", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, r.RequestURI+"/", 301)
|
||||
http.Redirect(w, r, r.RequestURI+"/", http.StatusMovedPermanently)
|
||||
})
|
||||
|
||||
r.HandleFunc("/pprof/*", pprof.Index)
|
||||
|
|
2
vendor/github.com/go-chi/chi/middleware/route_headers.go
generated
vendored
2
vendor/github.com/go-chi/chi/middleware/route_headers.go
generated
vendored
|
@ -50,7 +50,7 @@ func RouteHeaders() HeaderRouter {
|
|||
|
||||
type HeaderRouter map[string][]HeaderRoute
|
||||
|
||||
func (hr HeaderRouter) Route(header string, match string, middlewareHandler func(next http.Handler) http.Handler) HeaderRouter {
|
||||
func (hr HeaderRouter) Route(header, match string, middlewareHandler func(next http.Handler) http.Handler) HeaderRouter {
|
||||
header = strings.ToLower(header)
|
||||
k := hr[header]
|
||||
if k == nil {
|
||||
|
|
4
vendor/github.com/go-chi/chi/middleware/strip.go
generated
vendored
4
vendor/github.com/go-chi/chi/middleware/strip.go
generated
vendored
|
@ -52,8 +52,8 @@ func RedirectSlashes(next http.Handler) http.Handler {
|
|||
} else {
|
||||
path = path[:len(path)-1]
|
||||
}
|
||||
redirectUrl := fmt.Sprintf("//%s%s", r.Host, path)
|
||||
http.Redirect(w, r, redirectUrl, 301)
|
||||
redirectURL := fmt.Sprintf("//%s%s", r.Host, path)
|
||||
http.Redirect(w, r, redirectURL, 301)
|
||||
return
|
||||
}
|
||||
next.ServeHTTP(w, r)
|
||||
|
|
2
vendor/github.com/go-chi/chi/middleware/throttle.go
generated
vendored
2
vendor/github.com/go-chi/chi/middleware/throttle.go
generated
vendored
|
@ -35,7 +35,7 @@ func Throttle(limit int) func(http.Handler) http.Handler {
|
|||
// ThrottleBacklog is a middleware that limits number of currently processed
|
||||
// requests at a time and provides a backlog for holding a finite number of
|
||||
// pending requests.
|
||||
func ThrottleBacklog(limit int, backlogLimit int, backlogTimeout time.Duration) func(http.Handler) http.Handler {
|
||||
func ThrottleBacklog(limit, backlogLimit int, backlogTimeout time.Duration) func(http.Handler) http.Handler {
|
||||
return ThrottleWithOpts(ThrottleOpts{Limit: limit, BacklogLimit: backlogLimit, BacklogTimeout: backlogTimeout})
|
||||
}
|
||||
|
||||
|
|
2
vendor/github.com/go-chi/chi/middleware/value.go
generated
vendored
2
vendor/github.com/go-chi/chi/middleware/value.go
generated
vendored
|
@ -6,7 +6,7 @@ import (
|
|||
)
|
||||
|
||||
// WithValue is a middleware that sets a given key/value in a context chain.
|
||||
func WithValue(key interface{}, val interface{}) func(next http.Handler) http.Handler {
|
||||
func WithValue(key, val interface{}) func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
r = r.WithContext(context.WithValue(r.Context(), key, val))
|
||||
|
|
29
vendor/github.com/go-chi/chi/middleware/wrap_writer.go
generated
vendored
29
vendor/github.com/go-chi/chi/middleware/wrap_writer.go
generated
vendored
|
@ -19,19 +19,16 @@ func NewWrapResponseWriter(w http.ResponseWriter, protoMajor int) WrapResponseWr
|
|||
|
||||
if protoMajor == 2 {
|
||||
_, ps := w.(http.Pusher)
|
||||
if fl && ps {
|
||||
if fl || ps {
|
||||
return &http2FancyWriter{bw}
|
||||
}
|
||||
} else {
|
||||
_, hj := w.(http.Hijacker)
|
||||
_, rf := w.(io.ReaderFrom)
|
||||
if fl && hj && rf {
|
||||
if fl || hj || rf {
|
||||
return &httpFancyWriter{bw}
|
||||
}
|
||||
}
|
||||
if fl {
|
||||
return &flushWriter{bw}
|
||||
}
|
||||
|
||||
return &bw
|
||||
}
|
||||
|
@ -110,18 +107,6 @@ func (b *basicWriter) Unwrap() http.ResponseWriter {
|
|||
return b.ResponseWriter
|
||||
}
|
||||
|
||||
type flushWriter struct {
|
||||
basicWriter
|
||||
}
|
||||
|
||||
func (f *flushWriter) Flush() {
|
||||
f.wroteHeader = true
|
||||
fl := f.basicWriter.ResponseWriter.(http.Flusher)
|
||||
fl.Flush()
|
||||
}
|
||||
|
||||
var _ http.Flusher = &flushWriter{}
|
||||
|
||||
// httpFancyWriter is a HTTP writer that additionally satisfies
|
||||
// http.Flusher, http.Hijacker, and io.ReaderFrom. It exists for the common case
|
||||
// of wrapping the http.ResponseWriter that package http gives you, in order to
|
||||
|
@ -141,10 +126,6 @@ func (f *httpFancyWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
|||
return hj.Hijack()
|
||||
}
|
||||
|
||||
func (f *http2FancyWriter) Push(target string, opts *http.PushOptions) error {
|
||||
return f.basicWriter.ResponseWriter.(http.Pusher).Push(target, opts)
|
||||
}
|
||||
|
||||
func (f *httpFancyWriter) ReadFrom(r io.Reader) (int64, error) {
|
||||
if f.basicWriter.tee != nil {
|
||||
n, err := io.Copy(&f.basicWriter, r)
|
||||
|
@ -160,7 +141,6 @@ func (f *httpFancyWriter) ReadFrom(r io.Reader) (int64, error) {
|
|||
|
||||
var _ http.Flusher = &httpFancyWriter{}
|
||||
var _ http.Hijacker = &httpFancyWriter{}
|
||||
var _ http.Pusher = &http2FancyWriter{}
|
||||
var _ io.ReaderFrom = &httpFancyWriter{}
|
||||
|
||||
// http2FancyWriter is a HTTP2 writer that additionally satisfies
|
||||
|
@ -177,4 +157,9 @@ func (f *http2FancyWriter) Flush() {
|
|||
fl.Flush()
|
||||
}
|
||||
|
||||
func (f *http2FancyWriter) Push(target string, opts *http.PushOptions) error {
|
||||
return f.basicWriter.ResponseWriter.(http.Pusher).Push(target, opts)
|
||||
}
|
||||
|
||||
var _ http.Flusher = &http2FancyWriter{}
|
||||
var _ http.Pusher = &http2FancyWriter{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue