class Aws::S3::Presigner

def sign_but_dont_send(req, expires_in, scheme)

def sign_but_dont_send(req, expires_in, scheme)
  req.handlers.remove(Plugins::S3RequestSigner::SigningHandler)
  req.handlers.remove(Seahorse::Client::Plugins::ContentLength::Handler)
  req.handle(step: :send) do |context|
    if scheme != context.http_request.endpoint.scheme
      endpoint = context.http_request.endpoint.dup
      endpoint.scheme = scheme
      endpoint.port = (scheme == 'http' ? 80 : 443)
      context.http_request.endpoint = URI.parse(endpoint.to_s)
    end
    signer = Signers::V4.new(
      context.config.credentials, 's3',
      context.config.region
    )
    url = signer.presigned_url(
      context.http_request,
      expires_in: expires_in,
      body_digest: "UNSIGNED-PAYLOAD"
    )
    Seahorse::Client::Response.new(context: context, data: url)
  end
end