block floc

disable expfix1
This commit is contained in:
Azareal 2021-04-10 20:06:22 +10:00
parent a7b2659cde
commit 868a530f4b
3 changed files with 9 additions and 11 deletions

View File

@ -155,7 +155,7 @@ type devConfig struct {
//QuicPort int // Experimental! //QuicPort int // Experimental!
ExpFix1 bool // unlisted setting, experimental fix for http/1.1 conn hangs //ExpFix1 bool // unlisted setting, experimental fix for http/1.1 conn hangs
} }
// configHolder is purely for having a big struct to unmarshal data into // configHolder is purely for having a big struct to unmarshal data into

View File

@ -10,8 +10,6 @@ import (
"sync/atomic" "sync/atomic"
"errors" "errors"
"net/http" "net/http"
"io"
"io/ioutil"
c "github.com/Azareal/Gosora/common" c "github.com/Azareal/Gosora/common"
co "github.com/Azareal/Gosora/common/counters" co "github.com/Azareal/Gosora/common/counters"
@ -927,12 +925,12 @@ func (r *GenRouter) SuspiciousRequest(req *http.Request, pre string) {
// TODO: GetDefaultPath // TODO: GetDefaultPath
func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// HTTP/1.1 hanging conn fix // HTTP/1.1 hanging conn fix
if req.ProtoMajor == 1 && c.Dev.ExpFix1 { /*if req.ProtoMajor == 1 && c.Dev.ExpFix1 {
defer func() { defer func() {
io.Copy(ioutil.Discard, req.Body) //io.Copy(ioutil.Discard, req.Body)
req.Body.Close() req.Body.Close()
}() }()
} }*/
malformedRequest := func(typ int) { malformedRequest := func(typ int) {
w.WriteHeader(200) // 400 w.WriteHeader(200) // 400
w.Write([]byte("")) w.Write([]byte(""))
@ -1021,6 +1019,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
} else { } else {
h.Set("Referrer-Policy","strict-origin") h.Set("Referrer-Policy","strict-origin")
} }
h.Set("Permissions-Policy","interest-cohort=()")
} }
if c.Dev.SuperDebug { if c.Dev.SuperDebug {

View File

@ -432,8 +432,6 @@ import (
"sync/atomic" "sync/atomic"
"errors" "errors"
"net/http" "net/http"
"io"
"io/ioutil"
c "github.com/Azareal/Gosora/common" c "github.com/Azareal/Gosora/common"
co "github.com/Azareal/Gosora/common/counters" co "github.com/Azareal/Gosora/common/counters"
@ -510,12 +508,12 @@ func (r *GenRouter) SuspiciousRequest(req *http.Request, pre string) {
// TODO: GetDefaultPath // TODO: GetDefaultPath
func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// HTTP/1.1 hanging conn fix // HTTP/1.1 hanging conn fix
if req.ProtoMajor == 1 && c.Dev.ExpFix1 { /*if req.ProtoMajor == 1 && c.Dev.ExpFix1 {
defer func() { defer func() {
io.Copy(ioutil.Discard, req.Body) //io.Copy(ioutil.Discard, req.Body)
req.Body.Close() req.Body.Close()
}() }()
} }*/
malformedRequest := func(typ int) { malformedRequest := func(typ int) {
w.WriteHeader(200) // 400 w.WriteHeader(200) // 400
w.Write([]byte("")) w.Write([]byte(""))
@ -604,6 +602,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
} else { } else {
h.Set("Referrer-Policy","strict-origin") h.Set("Referrer-Policy","strict-origin")
} }
h.Set("Permissions-Policy","interest-cohort=()")
} }
if c.Dev.SuperDebug { if c.Dev.SuperDebug {