mirror of
https://github.com/fatedier/frp.git
synced 2026-01-11 22:23:12 +00:00
Fix various typos (#3783)
This commit is contained in:
@@ -24,21 +24,21 @@ import (
|
||||
"github.com/fatedier/frp/pkg/util/util"
|
||||
)
|
||||
|
||||
type HTTPAuthWraper struct {
|
||||
type HTTPAuthWrapper struct {
|
||||
h http.Handler
|
||||
user string
|
||||
passwd string
|
||||
}
|
||||
|
||||
func NewHTTPBasicAuthWraper(h http.Handler, user, passwd string) http.Handler {
|
||||
return &HTTPAuthWraper{
|
||||
func NewHTTPBasicAuthWrapper(h http.Handler, user, passwd string) http.Handler {
|
||||
return &HTTPAuthWrapper{
|
||||
h: h,
|
||||
user: user,
|
||||
passwd: passwd,
|
||||
}
|
||||
}
|
||||
|
||||
func (aw *HTTPAuthWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
func (aw *HTTPAuthWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
user, passwd, hasAuth := r.BasicAuth()
|
||||
if (aw.user == "" && aw.passwd == "") || (hasAuth && user == aw.user && passwd == aw.passwd) {
|
||||
aw.h.ServeHTTP(w, r)
|
||||
@@ -83,11 +83,11 @@ func (authMid *HTTPAuthMiddleware) Middleware(next http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
type HTTPGzipWraper struct {
|
||||
type HTTPGzipWrapper struct {
|
||||
h http.Handler
|
||||
}
|
||||
|
||||
func (gw *HTTPGzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
func (gw *HTTPGzipWrapper) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
|
||||
gw.h.ServeHTTP(w, r)
|
||||
return
|
||||
@@ -100,7 +100,7 @@ func (gw *HTTPGzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func MakeHTTPGzipHandler(h http.Handler) http.Handler {
|
||||
return &HTTPGzipWraper{
|
||||
return &HTTPGzipWrapper{
|
||||
h: h,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user