func (p *putter) putPart(part *part) error {
	v := url.Values{}
	v.Set("partNumber", strconv.Itoa(part.PartNumber))
	v.Set("uploadId", p.UploadID)
	if _, err := part.r.Seek(0, 0); err != nil { // move back to beginning, if retrying
		return err
	}
	req, err := http.NewRequest("PUT", p.url.String()+"?"+v.Encode(), part.r)
	if err != nil {
		return err
	}
	req.ContentLength = part.len
	req.Header.Set(md5Header, part.md5)
	req.Header.Set(sha256Header, part.sha256)
	p.b.Sign(req)
	resp, err := p.c.Client.Do(req)
	if err != nil {
		return err
	}
	defer checkClose(resp.Body, err)
	if resp.StatusCode != 200 {
		return newRespError(resp)
	}
	s := resp.Header.Get("etag")
	if len(s) < 2 {
		return fmt.Errorf("Got Bad etag:%s", s)
	}
	s = s[1 : len(s)-1] // includes quote chars for some reason
	if part.ETag != s {
		return fmt.Errorf("Response etag does not match. Remote:%s Calculated:%s", s, p.ETag)
	}
	return nil
}
func (p *putter) putPart(part *part) error {
	v := url.Values{}
	v.Set("partNumber", strconv.Itoa(part.PartNumber))
	v.Set("uploadId", p.UploadID)
	if _, err := part.r.Seek(0, 0); err != nil { 
		return err
	}
	req, err := http.NewRequest("PUT", p.url.String()+"?"+v.Encode(), part.r)
	if err != nil {
		return err
	}
	req.ContentLength = part.len
	req.Header.Set(md5Header, part.md5)
	req.Header.Set(sha256Header, part.sha256)
	p.b.Sign(req)
	resp, err := p.c.Client.Do(req)
	if err != nil {
		return err
	}
	defer checkClose(resp.Body, err)
	if resp.StatusCode != 200 {
		return newRespError(resp)
	}
	s := resp.Header.Get("etag")
	if len(s) < 2 {
		return fmt.Errorf("Got Bad etag:%s", s)
	}
	s = s[1 : len(s)-1] 
	if part.ETag != s {
		return fmt.Errorf("Response etag does not match. Remote:%s Calculated:%s", s, p.ETag)
	}
	return nil
}
func ( p * putter ) putPart ( part * part ) error { v := url . Values { } v . Set ( " " , strconv . Itoa ( part . PartNumber ) ) v . Set ( " " , p . UploadID ) if _ , err := part . r . Seek ( 0 , 0 ) ; err != nil { // move back to beginning, if retrying return err } req , err := http . NewRequest ( " " , p . url . String ( ) + " " + v . Encode ( ) , part . r ) if err != nil { return err } req . ContentLength = part . len req . Header . Set ( md5Header , part . md5 ) req . Header . Set ( sha256Header , part . sha256 ) p . b . Sign ( req ) resp , err := p . c . Client . Do ( req ) if err != nil { return err } defer checkClose ( resp . Body , err ) if resp . StatusCode != 200 { return newRespError ( resp ) } s := resp . Header . Get ( " " ) if len ( s ) < 2 { return fmt . Errorf ( " " , s ) } s = s [ 1 : len ( s ) - 1 ] // includes quote chars for some reason if part . ETag != s { return fmt . Errorf ( " " , s , p . ETag ) } return nil }
// uploads a part, checking the etag against the calculated value
uploads a part checking the etag against the calculated value