func newPutter(url url.URL, h http.Header, c *Config, b *Bucket) (p *putter, err error) {
	p = new(putter)
	p.url = url
	p.c, p.b = new(Config), new(Bucket)
	*p.c, *p.b = *c, *b
	p.c.Concurrency = max(c.Concurrency, 1)
	p.c.NTry = max(c.NTry, 1)
	p.bufsz = max64(minPartSize, c.PartSize)
	resp, err := p.retryRequest("POST", url.String()+"?uploads", nil, h)
	if err != nil {
		return nil, err
	}
	defer checkClose(resp.Body, err)
	if resp.StatusCode != 200 {
		return nil, newRespError(resp)
	}
	err = xml.NewDecoder(resp.Body).Decode(p)
	if err != nil {
		return nil, err
	}
	p.ch = make(chan *part)
	for i := 0; i < p.c.Concurrency; i++ {
		go p.worker()
	}
	p.md5OfParts = md5.New()
	p.md5 = md5.New()

	p.sp = bufferPool(p.bufsz)

	return p, nil
}
func newPutter(url url.URL, h http.Header, c *Config, b *Bucket) (p *putter, err error) {
	p = new(putter)
	p.url = url
	p.c, p.b = new(Config), new(Bucket)
	*p.c, *p.b = *c, *b
	p.c.Concurrency = max(c.Concurrency, 1)
	p.c.NTry = max(c.NTry, 1)
	p.bufsz = max64(minPartSize, c.PartSize)
	resp, err := p.retryRequest("POST", url.String()+"?uploads", nil, h)
	if err != nil {
		return nil, err
	}
	defer checkClose(resp.Body, err)
	if resp.StatusCode != 200 {
		return nil, newRespError(resp)
	}
	err = xml.NewDecoder(resp.Body).Decode(p)
	if err != nil {
		return nil, err
	}
	p.ch = make(chan *part)
	for i := 0; i < p.c.Concurrency; i++ {
		go p.worker()
	}
	p.md5OfParts = md5.New()
	p.md5 = md5.New()

	p.sp = bufferPool(p.bufsz)

	return p, nil
}
func newPutter ( url url . URL , h http . Header , c * Config , b * Bucket ) ( p * putter , err error ) { p = new ( putter ) p . url = url p . c , p . b = new ( Config ) , new ( Bucket ) * p . c , * p . b = * c , * b p . c . Concurrency = max ( c . Concurrency , 1 ) p . c . NTry = max ( c . NTry , 1 ) p . bufsz = max64 ( minPartSize , c . PartSize ) resp , err := p . retryRequest ( " " , url . String ( ) + " " , nil , h ) if err != nil { return nil , err } defer checkClose ( resp . Body , err ) if resp . StatusCode != 200 { return nil , newRespError ( resp ) } err = xml . NewDecoder ( resp . Body ) . Decode ( p ) if err != nil { return nil , err } p . ch = make ( chan * part ) for i := 0 ; i < p . c . Concurrency ; i ++ { go p . worker ( ) } p . md5OfParts = md5 . New ( ) p . md5 = md5 . New ( ) p . sp = bufferPool ( p . bufsz ) return p , nil }
// Sends an S3 multipart upload initiation request.
// See http://docs.amazonwebservices.com/AmazonS3/latest/dev/mpuoverview.html.
// The initial request returns an UploadId that we use to identify
// subsequent PUT requests.
Sends an S3 multipart upload initiation request . See http : // docs . amazonwebservices . com / AmazonS3 / latest / dev / mpuoverview . html . The initial request returns an UploadId that we use to identify subsequent PUT requests .