Class: CrashLog::AuthHMAC::CanonicalString

Inherits:
String
  • Object
show all
Includes:
Headers
Defined in:
lib/crash_log/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) ⇒ CanonicalString

Returns a new instance of CanonicalString.



65
66
67
68
69
# File 'lib/crash_log/auth_hmac.rb', line 65

def initialize(request)
  self << request_method(request) + "\n"
  self << header_values(headers(request)) + "\n"
  self << request_path(request)
end