mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +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"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"regexp"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -140,14 +141,14 @@ func HTTPBackendDropBacklog(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func rateLimitFromFormData(formData *url.Values) (rate.Limiter, error) {
|
func rateLimitFromFormData(formData url.Values) (rate.Limiter, error) {
|
||||||
rateCount := formData.get("rateCount")
|
rateCount := formData.Get("rateCount")
|
||||||
if rateCount != "" {
|
if rateCount != "" {
|
||||||
c, err := strconv.ParseInt(rateCount, 10, 32)
|
c, err := strconv.ParseInt(rateCount, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "rateCount")
|
return nil, errors.Wrap(err, "rateCount")
|
||||||
}
|
}
|
||||||
d, err := time.ParseDuration(formData.get("rateTime"))
|
d, err := time.ParseDuration(formData.Get("rateTime"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "rateTime")
|
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")
|
fmt.Fprint(w, "Error: channel must be specified")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rl, err := rateLimitFromRequest(r)
|
rl, err := rateLimitFromFormData(formData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(422)
|
w.WriteHeader(422)
|
||||||
fmt.Fprintf(w, "error parsing ratelimit: %v", err)
|
fmt.Fprintf(w, "error parsing ratelimit: %v", err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue