X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=gocheese.go;h=7a36129746ab96d1254564d69385323639531d1d;hb=902150e27fa1530823817eb3227f9100b27d9410;hp=9b74ee7d5cf729b6f6f0faf09fb108b26ca896bc;hpb=2b83ac5db8551f70614672b2d326272b35d064d3;p=gocheese.git diff --git a/gocheese.go b/gocheese.go index 9b74ee7..7a36129 100644 --- a/gocheese.go +++ b/gocheese.go @@ -66,6 +66,9 @@ along with this program. If not, see .` ) var ( + pkgPyPI = regexp.MustCompile(`^.*]*>(.+)
.*$`) + Version string = "UNKNOWN" + root = flag.String("root", "./packages", "Path to packages directory") bind = flag.String("bind", "[::]:8080", "Address to bind to") tlsCert = flag.String("tls-cert", "", "Path to TLS X.509 certificate") @@ -79,17 +82,8 @@ var ( maxClients = flag.Int("maxclients", 128, "Maximal amount of simultaneous clients") version = flag.Bool("version", false, "Print version information") warranty = flag.Bool("warranty", false, "Print warranty information") - - pkgPyPI = regexp.MustCompile(`^.*]*>(.+)
.*$`) - Version string = "UNKNOWN" - - passwords map[string]Auther = make(map[string]Auther) ) -type Auther interface { - Auth(password string) bool -} - func mkdirForPkg(w http.ResponseWriter, r *http.Request, dir string) bool { path := filepath.Join(*root, dir) if _, err := os.Stat(path); os.IsNotExist(err) { @@ -189,11 +183,10 @@ func refreshDir(w http.ResponseWriter, r *http.Request, dir, filenameGet string) _, err = os.Stat(path) if err == nil { continue - } else { - if !os.IsNotExist(err) { - http.Error(w, err.Error(), http.StatusInternalServerError) - return false - } + } + if !os.IsNotExist(err) { + http.Error(w, err.Error(), http.StatusInternalServerError) + return false } log.Println(r.RemoteAddr, "pypi touch", filename) if err = ioutil.WriteFile(path, digest, os.FileMode(0666)); err != nil {