1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-07 06:40:54 +00:00

Allow 'upgrade' anywhere in connection header

This commit is contained in:
Kane York 2016-03-30 17:33:45 -07:00
parent 4874d2577f
commit 189965c967

View file

@ -4,7 +4,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/gorilla/websocket"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
@ -12,6 +11,7 @@ import (
"net/url" "net/url"
"os" "os"
"os/signal" "os/signal"
"regexp"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
@ -20,7 +20,8 @@ import (
"syscall" "syscall"
"time" "time"
"unicode/utf8" "unicode/utf8"
"regexp"
"github.com/gorilla/websocket"
) )
// SuccessCommand is a Reply Command to indicate success in reply to a C2S Command. // SuccessCommand is a Reply Command to indicate success in reply to a C2S Command.
@ -52,6 +53,7 @@ const defaultMinMemoryKB = 1024 * 24
// DotTwitchDotTv is the .twitch.tv suffix. // DotTwitchDotTv is the .twitch.tv suffix.
const DotTwitchDotTv = ".twitch.tv" const DotTwitchDotTv = ".twitch.tv"
var OriginRegexp = regexp.MustCompile(DotTwitchDotTv + "$") var OriginRegexp = regexp.MustCompile(DotTwitchDotTv + "$")
// ResponseSuccess is a Reply ClientMessage with the MessageID not yet filled out. // ResponseSuccess is a Reply ClientMessage with the MessageID not yet filled out.
@ -205,7 +207,7 @@ func HTTPHandleRootURL(w http.ResponseWriter, r *http.Request) {
return return
} }
if r.Header.Get("Connection") == "Upgrade" { if strings.Contains(strings.ToLower(r.Header.Get("Connection")), "upgrade") {
updateSysMem() updateSysMem()
if Statistics.SysMemFreeKB > 0 && Statistics.SysMemFreeKB < Configuration.MinMemoryKBytes { if Statistics.SysMemFreeKB > 0 && Statistics.SysMemFreeKB < Configuration.MinMemoryKBytes {