Class: AuthHMAC::CanonicalString

Inherits:
String
  • Object
show all
Includes:
Headers
Defined in:
lib/auth-hmac.rb

Overview

Build a Canonical String for a HTTP request.

A Canonical String has the following format:

CanonicalString = HTTP-Verb + “n” +

Content-Type + "\n" +
Content-MD5  + "\n" +
Date         + "\n" +
request-uri;

If the Date header doesn’t exist, one will be generated since Net/HTTP will generate one if it doesn’t exist and it will be used on the server side to do authentication.

Instance Method Summary collapse

Methods included from Headers

#find_header, #headers

Constructor Details

#initialize(request, authenticate_referrer = false) ⇒ CanonicalString

Returns a new instance of CanonicalString.



76
77
78
79
80
# File 'lib/auth-hmac.rb', line 76

def initialize(request, authenticate_referrer=false)
  self << request_method(request) + "\n"
  self << header_values(request) + "\n"
  self << request_path(request, authenticate_referrer)
end