]> Cypherpunks.ru repositories - gocheese.git/commitdiff
Check PyPI HTTP status code v2.3.0
authorSergey Matveev <stargrave@stargrave.org>
Tue, 17 Dec 2019 09:59:49 +0000 (12:59 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 17 Dec 2019 10:05:27 +0000 (13:05 +0300)
VERSION
install.texi
refresh.go

diff --git a/VERSION b/VERSION
index ccbccc3dc62631f22ff358ac418e52401ec770b4..276cbf9e2858c779297bb9f73b34170302949ec4 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.0
+2.3.0
index 94a12f50cafe319afe78c8d19f0c9203ace7e638..dc95c2ddf293ba751f7a05ba8e2f5c16912aa71d 100644 (file)
@@ -1,7 +1,7 @@
 @node Install
 @unnumbered Install
 
 @node Install
 @unnumbered Install
 
-@set VERSION 2.2.0
+@set VERSION 2.3.0
 
 Preferable way is to download tarball with the signature from
 website and, for example, run tests with benchmarks:
 
 Preferable way is to download tarball with the signature from
 website and, for example, run tests with benchmarks:
index 625f840b5f3115b99b558f838f5d8953eddbc4be..860267bfe620ca2abb2dc4bd9aac36288a967996 100644 (file)
@@ -60,6 +60,12 @@ func refreshDir(
                http.Error(w, err.Error(), http.StatusBadGateway)
                return false
        }
                http.Error(w, err.Error(), http.StatusBadGateway)
                return false
        }
+       if resp.StatusCode != http.StatusOK {
+               resp.Body.Close()
+               log.Println("error", r.RemoteAddr, "refresh", pkgName, "HTTP status:", resp.Status)
+               http.Error(w, "PyPI has non 200 status code", http.StatusBadGateway)
+               return false
+       }
        body, err := ioutil.ReadAll(resp.Body)
        resp.Body.Close()
        if err != nil {
        body, err := ioutil.ReadAll(resp.Body)
        resp.Body.Close()
        if err != nil {
@@ -154,6 +160,15 @@ func refreshDir(
                                return false
                        }
                        defer resp.Body.Close()
                                return false
                        }
                        defer resp.Body.Close()
+                       if resp.StatusCode != http.StatusOK {
+                               log.Println(
+                                       "error", r.RemoteAddr,
+                                       "pypi", filename, "download",
+                                       "HTTP status:", resp.Status,
+                               )
+                               http.Error(w, "PyPI has non 200 status code", http.StatusBadGateway)
+                               return false
+                       }
                        hasher := hasherNew()
                        hasherSHA256 := sha256.New()
                        dst, err := TempFile(dirPath)
                        hasher := hasherNew()
                        hasherSHA256 := sha256.New()
                        dst, err := TempFile(dirPath)