code: func (s *S3Uploader) buildS3Request(fileBase string, buffer *bytes.Buffer) (*http.Request, error) {
  	u := &url.URL{
  		Scheme: s.s3url.Scheme,
  		Host:   s.s3url.Host,
  		Path:   fileBase,
  	}
  	// This is a PUT request containing the data buffer.
  	req, err := http.NewRequest("PUT", u.String(), buffer)
  	if err != nil {
  		return nil, err
  	}
  
  	// FIXME: Send 'Connection: close' header on HTTP requests
  	// as reusing the connection is still prone to EOF/Connection reset errors
  	// in certain network environments...
  	// See: ENGT-9670
  	// https://stackoverflow.com/questions/17714494/golang-http-request-results-in-eof-errors
  	req.Close = true
  
  	// Generate MD5 to ensure reliable delivery
  	h := md5.New()
  	if _, err := h.Write(buffer.Bytes()); err != nil {
  		return nil, err
  	}
  	md5 := base64.StdEncoding.EncodeToString(h.Sum(nil))
  
  	// Get current time in UTC format for Date header.
  	curTime := time.Now().UTC().Format(time.RFC1123)
  	req.Header.Add("Date", curTime)
  	req.Header.Add("Content-Md5", md5)
  	req.Header.Add("Content-Type", "application/x-gzip")
  	req.Header.Add("X-Amz-Acl", s.permission)
  
  	authHeader, err := s.buildAuthHeader(md5, curTime, fileBase)
  	if err != nil {
  		return nil, err
  	}
  	req.Header.Add("Authorization", authHeader)
  
  	// Set content length so we avoid chunked requests.
  	req.ContentLength = int64(buffer.Len())
  	return req, nil
  }
docs: // buildS3Request constructs an http request for the upload