These ones don't matter as much, though (just debug output)

Change-Id: Ief8c49e0243e21feacf035e63dbe925bb417f716
This commit is contained in:
Brad Fitzpatrick 2012-12-26 13:17:36 -08:00
parent 22621b80f6
commit a2df86d08e
1 changed files with 4 additions and 4 deletions

View File

@ -144,16 +144,16 @@ func (c *Client) SearchExistingFileSchema(wholeRef *blobref.BlobRef) (*blobref.B
return nil, err
}
var buf bytes.Buffer
body := io.TeeReader(io.LimitReader(res.Body, 1 << 20), &buf)
body := io.TeeReader(io.LimitReader(res.Body, 1<<20), &buf)
if res.StatusCode != 200 {
io.Copy(ioutil.Discard, body)
io.Copy(struct{ io.Writer }{ioutil.Discard}, body) // golang.org/issue/4589
return nil, fmt.Errorf("client: got status code %d from URL %s; body %s", res.StatusCode, url, buf.String())
}
var ress struct {
Files []*blobref.BlobRef `json:"files"`
}
if err := json.NewDecoder(body).Decode(&ress); err != nil {
io.Copy(ioutil.Discard, body)
io.Copy(struct{ io.Writer }{ioutil.Discard}, body) // golang.org/issue/4589
return nil, fmt.Errorf("client: error parsing JSON from URL %s: %v; body=%s", url, err, buf.String())
}
if len(ress.Files) == 0 {
@ -178,7 +178,7 @@ func (c *Client) FileHasContents(f, wholeRef *blobref.BlobRef) bool {
if c.downloadHelper == "" {
return false
}
req := c.newRequest("HEAD", c.downloadHelper + f.String() + "/?verifycontents=" + wholeRef.String())
req := c.newRequest("HEAD", c.downloadHelper+f.String()+"/?verifycontents="+wholeRef.String())
res, err := c.httpClient.Do(req)
if err != nil {
log.Printf("download helper HEAD error: %v", err)