mirror of
https://github.com/rancher/norman.git
synced 2025-09-26 07:12:30 +00:00
Update vendor
This commit is contained in:
2
vendor/k8s.io/apiserver/pkg/registry/generic/rest/BUILD
generated
vendored
2
vendor/k8s.io/apiserver/pkg/registry/generic/rest/BUILD
generated
vendored
@@ -17,6 +17,8 @@ go_test(
|
||||
"//staging/src/k8s.io/api/core/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/assert:go_default_library",
|
||||
"//vendor/github.com/stretchr/testify/require:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
14
vendor/k8s.io/apiserver/pkg/registry/generic/rest/streamer.go
generated
vendored
14
vendor/k8s.io/apiserver/pkg/registry/generic/rest/streamer.go
generated
vendored
@@ -18,6 +18,7 @@ package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -29,13 +30,14 @@ import (
|
||||
)
|
||||
|
||||
// LocationStreamer is a resource that streams the contents of a particular
|
||||
// location URL
|
||||
// location URL.
|
||||
type LocationStreamer struct {
|
||||
Location *url.URL
|
||||
Transport http.RoundTripper
|
||||
ContentType string
|
||||
Flush bool
|
||||
ResponseChecker HttpResponseChecker
|
||||
RedirectChecker func(req *http.Request, via []*http.Request) error
|
||||
}
|
||||
|
||||
// a LocationStreamer must implement a rest.ResourceStreamer
|
||||
@@ -59,7 +61,10 @@ func (s *LocationStreamer) InputStream(ctx context.Context, apiVersion, acceptHe
|
||||
if transport == nil {
|
||||
transport = http.DefaultTransport
|
||||
}
|
||||
client := &http.Client{Transport: transport}
|
||||
client := &http.Client{
|
||||
Transport: transport,
|
||||
CheckRedirect: s.RedirectChecker,
|
||||
}
|
||||
req, err := http.NewRequest("GET", s.Location.String(), nil)
|
||||
// Pass the parent context down to the request to ensure that the resources
|
||||
// will be release properly.
|
||||
@@ -87,3 +92,8 @@ func (s *LocationStreamer) InputStream(ctx context.Context, apiVersion, acceptHe
|
||||
stream = resp.Body
|
||||
return
|
||||
}
|
||||
|
||||
// PreventRedirects is a redirect checker that prevents the client from following a redirect.
|
||||
func PreventRedirects(_ *http.Request, _ []*http.Request) error {
|
||||
return errors.New("redirects forbidden")
|
||||
}
|
||||
|
Reference in New Issue
Block a user