X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=main.go;h=b2d3250a3fbf57365a5161eb1be888466836c09d;hb=70d532b5982c2203286c901f29fb462d7d88c0f7;hp=981d58e2f6c2d710a965632b610098af3f7585b5;hpb=a138af795fb0ad0cece96ab5ded469f097397665;p=gocheese.git diff --git a/main.go b/main.go index 981d58e..b2d3250 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ /* GoCheese -- Python private package repository and caching proxy -Copyright (C) 2019-2022 Sergey Matveev - 2019-2022 Elena Balakhonova +Copyright (C) 2019-2023 Sergey Matveev + 2019-2023 Elena Balakhonova This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,7 +44,7 @@ import ( ) const ( - Version = "3.4.0" + Version = "3.7.1" UserAgent = "GoCheese/" + Version ) @@ -212,6 +212,9 @@ func main() { log.Fatalln("Both -tls-cert and -tls-key are required") } + UmaskCur = syscall.Umask(0) + syscall.Umask(UmaskCur) + var err error PyPIURLParsed, err = url.Parse(*PyPIURL) if err != nil { @@ -233,7 +236,7 @@ func main() { tlsConfig.VerifyConnection = func(s tls.ConnectionState) error { spki := s.VerifiedChains[0][0].RawSubjectPublicKeyInfo theirDgst := sha256.Sum256(spki) - if bytes.Compare(ourDgst, theirDgst[:]) != 0 { + if !bytes.Equal(ourDgst, theirDgst[:]) { return errors.New("certificate's SPKI digest mismatch") } return nil @@ -271,8 +274,8 @@ func main() { } ln = netutil.LimitListener(ln, *MaxClients) - needsShutdown := make(chan os.Signal, 0) - exitErr := make(chan error, 0) + needsShutdown := make(chan os.Signal, 1) + exitErr := make(chan error) signal.Notify(needsShutdown, syscall.SIGTERM, syscall.SIGINT) go func(s *http.Server) { <-needsShutdown