mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 12:55:55 +00:00
Fix socket server compilation errors.
This commit is contained in:
parent
7e6a08ad1d
commit
2ec26f2cdc
2 changed files with 5 additions and 5 deletions
|
@ -13,7 +13,6 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -140,14 +141,14 @@ func HTTPBackendDropBacklog(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func rateLimitFromFormData(formData *url.Values) (rate.Limiter, error) {
|
||||
rateCount := formData.get("rateCount")
|
||||
func rateLimitFromFormData(formData url.Values) (rate.Limiter, error) {
|
||||
rateCount := formData.Get("rateCount")
|
||||
if rateCount != "" {
|
||||
c, err := strconv.ParseInt(rateCount, 10, 32)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "rateCount")
|
||||
}
|
||||
d, err := time.ParseDuration(formData.get("rateTime"))
|
||||
d, err := time.ParseDuration(formData.Get("rateTime"))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "rateTime")
|
||||
}
|
||||
|
@ -254,7 +255,7 @@ func HTTPBackendUncachedPublish(w http.ResponseWriter, r *http.Request) {
|
|||
fmt.Fprint(w, "Error: channel must be specified")
|
||||
return
|
||||
}
|
||||
rl, err := rateLimitFromRequest(r)
|
||||
rl, err := rateLimitFromFormData(formData)
|
||||
if err != nil {
|
||||
w.WriteHeader(422)
|
||||
fmt.Fprintf(w, "error parsing ratelimit: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue