oknow ctx bad
parent
f958dcacc4
commit
9be5d8235e
|
|
@ -66,6 +66,10 @@ func (cfg Config) NewHandler() Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s Session) Empty() bool {
|
||||||
|
return s == (Session{})
|
||||||
|
}
|
||||||
|
|
||||||
func runHTTP(ctx context.Context, cfg Config) error {
|
func runHTTP(ctx context.Context, cfg Config) error {
|
||||||
server := &http.Server{
|
server := &http.Server{
|
||||||
Addr: cfg.Addr,
|
Addr: cfg.Addr,
|
||||||
|
|
@ -105,7 +109,7 @@ func (h Handler) serveHTTP(w http.ResponseWriter, r *http.Request) error {
|
||||||
return h.handle(session, w, r)
|
return h.handle(session, w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h Handler) auth(r *http.Request) (session, error) {
|
func (h Handler) auth(r *http.Request) (Session, error) {
|
||||||
user, pass, ok := r.BasicAuth()
|
user, pass, ok := r.BasicAuth()
|
||||||
if !ok {
|
if !ok {
|
||||||
return Session{}, nil
|
return Session{}, nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue