diff --git a/common/site.go b/common/site.go index bda719b1..9ffaa424 100644 --- a/common/site.go +++ b/common/site.go @@ -155,7 +155,7 @@ type devConfig struct { //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 diff --git a/gen_router.go b/gen_router.go index 261a3071..0c26930f 100644 --- a/gen_router.go +++ b/gen_router.go @@ -10,8 +10,6 @@ import ( "sync/atomic" "errors" "net/http" - "io" - "io/ioutil" c "github.com/Azareal/Gosora/common" co "github.com/Azareal/Gosora/common/counters" @@ -927,12 +925,12 @@ func (r *GenRouter) SuspiciousRequest(req *http.Request, pre string) { // TODO: GetDefaultPath func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { // HTTP/1.1 hanging conn fix - if req.ProtoMajor == 1 && c.Dev.ExpFix1 { + /*if req.ProtoMajor == 1 && c.Dev.ExpFix1 { defer func() { - io.Copy(ioutil.Discard, req.Body) + //io.Copy(ioutil.Discard, req.Body) req.Body.Close() }() - } + }*/ malformedRequest := func(typ int) { w.WriteHeader(200) // 400 w.Write([]byte("")) @@ -1021,6 +1019,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } else { h.Set("Referrer-Policy","strict-origin") } + h.Set("Permissions-Policy","interest-cohort=()") } if c.Dev.SuperDebug { diff --git a/router_gen/main.go b/router_gen/main.go index a11813f5..5bbf2c6d 100644 --- a/router_gen/main.go +++ b/router_gen/main.go @@ -432,8 +432,6 @@ import ( "sync/atomic" "errors" "net/http" - "io" - "io/ioutil" c "github.com/Azareal/Gosora/common" co "github.com/Azareal/Gosora/common/counters" @@ -510,12 +508,12 @@ func (r *GenRouter) SuspiciousRequest(req *http.Request, pre string) { // TODO: GetDefaultPath func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { // HTTP/1.1 hanging conn fix - if req.ProtoMajor == 1 && c.Dev.ExpFix1 { + /*if req.ProtoMajor == 1 && c.Dev.ExpFix1 { defer func() { - io.Copy(ioutil.Discard, req.Body) + //io.Copy(ioutil.Discard, req.Body) req.Body.Close() }() - } + }*/ malformedRequest := func(typ int) { w.WriteHeader(200) // 400 w.Write([]byte("")) @@ -604,6 +602,7 @@ func (r *GenRouter) ServeHTTP(w http.ResponseWriter, req *http.Request) { } else { h.Set("Referrer-Policy","strict-origin") } + h.Set("Permissions-Policy","interest-cohort=()") } if c.Dev.SuperDebug {