mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-27 16:48:56 +00:00
parent
9a23fe131c
commit
22a84a72cd
@ -132,6 +132,7 @@ func newInternalRequestLFS(ctx context.Context, internalURL, method string, head
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
req := private.NewInternalRequest(ctx, internalURL, method)
|
req := private.NewInternalRequest(ctx, internalURL, method)
|
||||||
|
req.SetReadWriteTimeout(0)
|
||||||
for k, v := range headers {
|
for k, v := range headers {
|
||||||
req.Header(k, v)
|
req.Header(k, v)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deadline is part of the interface for context.Context and we pass this to the request context
|
|
||||||
func (ctx *PrivateContext) Deadline() (deadline time.Time, ok bool) {
|
func (ctx *PrivateContext) Deadline() (deadline time.Time, ok bool) {
|
||||||
if ctx.Override != nil {
|
if ctx.Override != nil {
|
||||||
return ctx.Override.Deadline()
|
return ctx.Override.Deadline()
|
||||||
@ -36,7 +35,6 @@ func (ctx *PrivateContext) Deadline() (deadline time.Time, ok bool) {
|
|||||||
return ctx.Base.Deadline()
|
return ctx.Base.Deadline()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done is part of the interface for context.Context and we pass this to the request context
|
|
||||||
func (ctx *PrivateContext) Done() <-chan struct{} {
|
func (ctx *PrivateContext) Done() <-chan struct{} {
|
||||||
if ctx.Override != nil {
|
if ctx.Override != nil {
|
||||||
return ctx.Override.Done()
|
return ctx.Override.Done()
|
||||||
@ -44,7 +42,6 @@ func (ctx *PrivateContext) Done() <-chan struct{} {
|
|||||||
return ctx.Base.Done()
|
return ctx.Base.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Err is part of the interface for context.Context and we pass this to the request context
|
|
||||||
func (ctx *PrivateContext) Err() error {
|
func (ctx *PrivateContext) Err() error {
|
||||||
if ctx.Override != nil {
|
if ctx.Override != nil {
|
||||||
return ctx.Override.Err()
|
return ctx.Override.Err()
|
||||||
@ -52,14 +49,14 @@ func (ctx *PrivateContext) Err() error {
|
|||||||
return ctx.Base.Err()
|
return ctx.Base.Err()
|
||||||
}
|
}
|
||||||
|
|
||||||
var privateContextKey any = "default_private_context"
|
type privateContextKeyType struct{}
|
||||||
|
|
||||||
|
var privateContextKey privateContextKeyType
|
||||||
|
|
||||||
// GetPrivateContext returns a context for Private routes
|
|
||||||
func GetPrivateContext(req *http.Request) *PrivateContext {
|
func GetPrivateContext(req *http.Request) *PrivateContext {
|
||||||
return req.Context().Value(privateContextKey).(*PrivateContext)
|
return req.Context().Value(privateContextKey).(*PrivateContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// PrivateContexter returns apicontext as middleware
|
|
||||||
func PrivateContexter() func(http.Handler) http.Handler {
|
func PrivateContexter() func(http.Handler) http.Handler {
|
||||||
return func(next http.Handler) http.Handler {
|
return func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user