Merge branch 'master' into 13822-nm-delayed-daemon
[arvados.git] / sdk / go / arvados / keep_service.go
index 9797440205cf3d8396d14ec389e380b2260486b2..0c866354aa9b1e3a34833f15018b66613d40bdb4 100644 (file)
@@ -127,6 +127,13 @@ func (s *KeepService) index(c *Client, url string) ([]KeepServiceIndexEntry, err
        scanner := bufio.NewScanner(resp.Body)
        sawEOF := false
        for scanner.Scan() {
+               if scanner.Err() != nil {
+                       // If we encounter a read error (timeout,
+                       // connection failure), stop now and return it
+                       // below, so it doesn't get masked by the
+                       // ensuing "badly formatted response" error.
+                       break
+               }
                if sawEOF {
                        return nil, fmt.Errorf("Index response contained non-terminal blank line")
                }