X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=httpauth.go;h=5b454cacb64d495d8bc49c1d1924f9ef4d45e250;hb=aca0f719ffa95e51420a625813f2f4cbf1d5397c;hp=5e97636cd6c3a88cab878bbc744756c754778e92;hpb=1b3ef99af2896156902264aaccced15426874484;p=tofuproxy.git diff --git a/httpauth.go b/httpauth.go index 5e97636..5b454ca 100644 --- a/httpauth.go +++ b/httpauth.go @@ -1,5 +1,6 @@ /* -tofuproxy -- HTTP proxy with TLS certificates management +tofuproxy -- flexible HTTP/HTTPS proxy, TLS terminator, X.509 TOFU + manager, WARC/geminispace browser Copyright (C) 2021 Sergey Matveev This program is free software: you can redistribute it and/or modify @@ -27,6 +28,8 @@ import ( "os/exec" "path/filepath" "strings" + + ttls "go.stargrave.org/tofuproxy/tls" ) func findInNetrc(host string) (string, string) { @@ -62,6 +65,7 @@ func authDialog(host, realm string) (string, string, error) { var b bytes.Buffer userInit, passInit := findInNetrc(host) b.WriteString(fmt.Sprintf(` +tk_setPalette grey wm title . "Unauthorized: %s" label .luser -text "User" @@ -74,17 +78,22 @@ set passinit "%s" set p [entry .pass -show "*" -textvariable passinit] grid .lpass .pass -proc submit {} { +proc login {} { global u p puts [$u get] puts [$p get] exit } -button .submit -text "Submit" -command submit -grid .submit +button .login -text "Login" -command login +grid .login + +bind . {switch -exact %%K { + q {exit 0} ; # reject once + l login +}} `, realm, userInit, passInit)) - cmd := exec.Command(CmdWish) + cmd := exec.Command(ttls.CmdWish) cmd.Stdin = &b out, err := cmd.Output() if err != nil {