mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 09:21:13 -05:00
Configure client against DOS
This commit is contained in:
parent
ecf391dcbf
commit
87bfa79f71
2 changed files with 3 additions and 5 deletions
|
@ -85,8 +85,10 @@ func NewClient(ctx context.Context, user *user_model.User, pubID string) (c *Cli
|
||||||
c = &Client{
|
c = &Client{
|
||||||
client: &http.Client{
|
client: &http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
Proxy: proxy.Proxy(),
|
Proxy: proxy.Proxy(),
|
||||||
|
MaxConnsPerHost: 20,
|
||||||
},
|
},
|
||||||
|
Timeout: time.Duration(5 * time.Second),
|
||||||
},
|
},
|
||||||
algs: setting.HttpsigAlgs,
|
algs: setting.HttpsigAlgs,
|
||||||
digestAlg: httpsig.DigestAlgorithm(setting.Federation.DigestAlgorithm),
|
digestAlg: httpsig.DigestAlgorithm(setting.Federation.DigestAlgorithm),
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
"code.gitea.io/gitea/models/forgefed"
|
"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)
|
ctx.Status(http.StatusNoContent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue