0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 23:33:15 -05:00

Configure client against DOS

This commit is contained in:
bom 2024-01-12 12:29:00 +01:00 committed by Michael Jerger
parent ecf391dcbf
commit 87bfa79f71
2 changed files with 3 additions and 5 deletions

View file

@ -85,8 +85,10 @@ func NewClient(ctx context.Context, user *user_model.User, pubID string) (c *Cli
c = &Client{
client: &http.Client{
Transport: &http.Transport{
Proxy: proxy.Proxy(),
Proxy: proxy.Proxy(),
MaxConnsPerHost: 20,
},
Timeout: time.Duration(5 * time.Second),
},
algs: setting.HttpsigAlgs,
digestAlg: httpsig.DigestAlgorithm(setting.Federation.DigestAlgorithm),

View file

@ -10,7 +10,6 @@ import (
"fmt"
"net/http"
"strings"
"time"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/forgefed"
@ -160,9 +159,6 @@ func RepositoryInbox(ctx *context.APIContext) {
}
}
// wait 5 sec.
time.Sleep(5 * time.Second)
ctx.Status(http.StatusNoContent)
}