Fix timeout for HTTP-01, bug in HTTP challenge response & only count domains towards user limit after acquiring locks

This commit is contained in:
Moritz Marquardt 2021-11-20 21:39:40 +01:00
parent f22cd6c4e0
commit eae4513b96
No known key found for this signature in database
GPG key ID: D5788327BEE388B6
2 changed files with 13 additions and 12 deletions

View file

@ -91,7 +91,7 @@ func main() {
MaxRequestBodySize: 0,
NoDefaultServerHeader: true,
NoDefaultDate: true,
ReadTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second, // needs to be this high for ACME certificates with ZeroSSL & HTTP-01 challenge
Concurrency: 1024 * 32, // TODO: adjust bottlenecks for best performance with Gitea!
MaxConnsPerIP: 100,
}
@ -110,7 +110,7 @@ func main() {
err := fasthttp.ListenAndServe("[::]:80", func(ctx *fasthttp.RequestCtx) {
if bytes.HasPrefix(ctx.Path(), challengePath) {
challenge, ok := challengeCache.Get(string(TrimHostPort(ctx.Host())) + "/" + string(bytes.TrimPrefix(ctx.Path(), challengePath)))
if !ok {
if !ok || challenge == nil {
ctx.SetStatusCode(http.StatusNotFound)
ctx.SetBodyString("no challenge for this token")
}