Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dee04b6962 | ||
|
|
87d95b4eff | ||
|
|
f083763f1d | ||
|
|
669f3283f4 |
@@ -9,6 +9,9 @@ import (
|
|||||||
|
|
||||||
"gitea.inhome.blapointe.com/local/args"
|
"gitea.inhome.blapointe.com/local/args"
|
||||||
"gitea.inhome.blapointe.com/local/logb"
|
"gitea.inhome.blapointe.com/local/logb"
|
||||||
|
|
||||||
|
"gitea.inhome.blapointe.com/local/args"
|
||||||
|
"gitea.inhome.blapointe.com/local/logb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var conf *args.ArgSet
|
var conf *args.ArgSet
|
||||||
|
|||||||
6
go.mod
6
go.mod
@@ -7,6 +7,12 @@ require (
|
|||||||
gitea.inhome.blapointe.com/local/logb v0.0.0-20231109150430-1221d87a6dbc
|
gitea.inhome.blapointe.com/local/logb v0.0.0-20231109150430-1221d87a6dbc
|
||||||
gitea.inhome.blapointe.com/local/oauth2 v0.0.0-20240109220403-8897142866f1
|
gitea.inhome.blapointe.com/local/oauth2 v0.0.0-20240109220403-8897142866f1
|
||||||
github.com/google/uuid v1.3.0
|
github.com/google/uuid v1.3.0
|
||||||
|
<<<<<<< HEAD
|
||||||
|
gitea.inhome.blapointe.com/local/args v0.0.0-20230410154220-44370f257b34
|
||||||
|
gitea.inhome.blapointe.com/local/logb v0.0.0-20230410154319-880efa39d871
|
||||||
|
gitea.inhome.blapointe.com/local/oauth2 v0.0.0-20230410162733-d39498ff8454
|
||||||
|
=======
|
||||||
|
>>>>>>> f083763f1d7e0fd450f167db58f091310c8b2ec2
|
||||||
golang.org/x/time v0.1.0
|
golang.org/x/time v0.1.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import (
|
|||||||
|
|
||||||
"gitea.inhome.blapointe.com/local/rproxy3/config"
|
"gitea.inhome.blapointe.com/local/rproxy3/config"
|
||||||
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
|
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
|
||||||
|
|
||||||
|
"gitea.inhome.blapointe.com/local/rproxy3/config"
|
||||||
|
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
|
||||||
)
|
)
|
||||||
|
|
||||||
type redirPurge struct {
|
type redirPurge struct {
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ import (
|
|||||||
"gitea.inhome.blapointe.com/local/rproxy3/storage"
|
"gitea.inhome.blapointe.com/local/rproxy3/storage"
|
||||||
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
|
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
|
||||||
|
|
||||||
|
"gitea.inhome.blapointe.com/local/rproxy3/config"
|
||||||
|
"gitea.inhome.blapointe.com/local/rproxy3/storage"
|
||||||
|
"gitea.inhome.blapointe.com/local/rproxy3/storage/packable"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
)
|
)
|
||||||
@@ -153,11 +157,11 @@ func (s *Server) Pre(foo http.HandlerFunc) http.HandlerFunc {
|
|||||||
if auth, err := s.lookupAuth(mapKey(r.Host)); err != nil {
|
if auth, err := s.lookupAuth(mapKey(r.Host)); err != nil {
|
||||||
log.Printf("failed to lookup auth for %s (%s): %v", r.Host, mapKey(r.Host), err)
|
log.Printf("failed to lookup auth for %s (%s): %v", r.Host, mapKey(r.Host), err)
|
||||||
w.Header().Set("WWW-Authenticate", "Basic")
|
w.Header().Set("WWW-Authenticate", "Basic")
|
||||||
http.Error(w, err.Error(), http.StatusForbidden)
|
http.Error(w, err.Error(), http.StatusUnauthorized)
|
||||||
} else if _, p, _ := r.BasicAuth(); auth != p {
|
} else if _, p, _ := r.BasicAuth(); auth != "" && auth != p {
|
||||||
log.Printf("failed to auth: expected %q but got %q", auth, p)
|
log.Printf("failed to auth: expected %q but got %q", auth, p)
|
||||||
w.Header().Set("WWW-Authenticate", "Basic")
|
w.Header().Set("WWW-Authenticate", "Basic")
|
||||||
http.Error(w, "unexpected basic auth", http.StatusForbidden)
|
http.Error(w, "unexpected basic auth", http.StatusUnauthorized)
|
||||||
} else {
|
} else {
|
||||||
foo(w, r)
|
foo(w, r)
|
||||||
}
|
}
|
||||||
@@ -215,7 +219,6 @@ func (cb corsResponseWriter) WriteHeader(code int) {
|
|||||||
func doCORS(w http.ResponseWriter, r *http.Request) (http.ResponseWriter, bool) {
|
func doCORS(w http.ResponseWriter, r *http.Request) (http.ResponseWriter, bool) {
|
||||||
key := mapKey(r.Host)
|
key := mapKey(r.Host)
|
||||||
if !config.GetCORS(key) {
|
if !config.GetCORS(key) {
|
||||||
pushMeta(r, "do-cors", "not enabled for key")
|
|
||||||
return w, false
|
return w, false
|
||||||
}
|
}
|
||||||
pushMeta(r, "do-cors", "enabled for key")
|
pushMeta(r, "do-cors", "enabled for key")
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import (
|
|||||||
"gitea.inhome.blapointe.com/local/rproxy3/config"
|
"gitea.inhome.blapointe.com/local/rproxy3/config"
|
||||||
"gitea.inhome.blapointe.com/local/rproxy3/storage"
|
"gitea.inhome.blapointe.com/local/rproxy3/storage"
|
||||||
|
|
||||||
|
"gitea.inhome.blapointe.com/local/rproxy3/config"
|
||||||
|
"gitea.inhome.blapointe.com/local/rproxy3/storage"
|
||||||
|
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user