lib/oci/base_signer.rb
# enum to define the signing strategy
enum to define the signing strategy
enum to define the signing strategy
def inject_missing_headers(method, headers, body, uri, operation_signing_strategy)
      headers[:date] ||= Time.now.utc.httpdate
      headers[:accept] ||= '*/*'
      headers[:host] ||= uri.host if @headers_to_sign_all_requests.include?(:host)
      return unless %i[put post patch].include?(method)
      body ||= ''
      if operation_signing_strategy == :exclude_body
        headers[:'content-length'] ||= if body.respond_to?(:read) && body.respond_to?(:write)
                                         body.respond_to?('size') ? body.size : body.stat.size
                                       else
                                         body.bytes.length.to_s
                                       end
      else
        headers[:'content-length'] ||= body.bytes.length.to_s
        headers[:'x-content-sha256'] ||= OpenSSL::Digest::SHA256.new.update(body).base64digest
      end
    end
def inject_missing_headers ( method , headers , body , uri , operation_signing_strategy ) headers [ :date ] ||= Time . now . utc . httpdate headers [ :accept ] ||= '*/*' headers [ :host ] ||= uri . host if @headers_to_sign_all_requests . include? ( :host ) return unless %i[ put post patch ] . include? ( method ) body ||= '' if operation_signing_strategy == :exclude_body headers [ :' content-length ' ] ||= if body . respond_to? ( :read ) && body . respond_to? ( :write ) body . respond_to? ( 'size' ) ? body . size : body . stat . size else body . bytes . length . to_s end else headers [ :' content-length ' ] ||= body . bytes . length . to_s headers [ :' x-content-sha256 ' ] ||= OpenSSL :: Digest :: SHA256 . new . update ( body ) . base64digest end end
enum to define the signing strategy
enum to define the signing strategy
# For object storage service's put method, we don't need to set content length and x-content sha256
method
headers
body
uri
operation_signing_strategy