Skip to content

Commit 25afcd9

Browse files
wxiaoguangGiteaBot
authored andcommitted
Fix SSH LFS timeout (go-gitea#34838)
Fix go-gitea#34834
1 parent 534b9b3 commit 25afcd9

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

modules/lfstransfer/backend/util.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func newInternalRequestLFS(ctx context.Context, internalURL, method string, head
132132
return nil
133133
}
134134
req := private.NewInternalRequest(ctx, internalURL, method)
135+
req.SetReadWriteTimeout(0)
135136
for k, v := range headers {
136137
req.Header(k, v)
137138
}

services/context/private.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,35 @@ func init() {
2828
})
2929
}
3030

31-
// Deadline is part of the interface for context.Context and we pass this to the request context
3231
func (ctx *PrivateContext) Deadline() (deadline time.Time, ok bool) {
3332
if ctx.Override != nil {
3433
return ctx.Override.Deadline()
3534
}
3635
return ctx.Base.Deadline()
3736
}
3837

39-
// Done is part of the interface for context.Context and we pass this to the request context
4038
func (ctx *PrivateContext) Done() <-chan struct{} {
4139
if ctx.Override != nil {
4240
return ctx.Override.Done()
4341
}
4442
return ctx.Base.Done()
4543
}
4644

47-
// Err is part of the interface for context.Context and we pass this to the request context
4845
func (ctx *PrivateContext) Err() error {
4946
if ctx.Override != nil {
5047
return ctx.Override.Err()
5148
}
5249
return ctx.Base.Err()
5350
}
5451

55-
var privateContextKey any = "default_private_context"
52+
type privateContextKeyType struct{}
53+
54+
var privateContextKey privateContextKeyType
5655

57-
// GetPrivateContext returns a context for Private routes
5856
func GetPrivateContext(req *http.Request) *PrivateContext {
5957
return req.Context().Value(privateContextKey).(*PrivateContext)
6058
}
6159

62-
// PrivateContexter returns apicontext as middleware
6360
func PrivateContexter() func(http.Handler) http.Handler {
6461
return func(next http.Handler) http.Handler {
6562
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {

0 commit comments

Comments
 (0)