Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed up the code

Removed the misformed define (and reported it to erlang-bugs as it shouldn't have ever compiled)
Rewritten the headers stuff
Removed export all
  • Loading branch information...
commit e6e40d71d5cda1f5494997ace13db5f8fa956b9d 1 parent c135144
@hypernumbers hypernumbers authored
View
4 examples/hmac_api/hmac_api.hrl
@@ -9,7 +9,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-define(schema, "AWS").
% defines the prefix for headers to be included in the signature
--define(headerprefix, $x,$-,$a,$m,$z,$-).
+-define(headerprefix, "x-amz-").
% defines the date header
-define(dateheader, "x-amz-date").
@@ -21,7 +21,7 @@
%%% %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%-define(schema, "MOCHIAPI").
-%-define(headerprefix, $x,$-,$m,$o,$c,$h,$i,$w,$a,$p,$i,$-).
+%-define(headerprefix, "x-mochiapi-").
%-define(dateheader, "x-mochiapi-date").
% a couple of keys for testing
View
9 examples/hmac_api/hmac_api_lib.erl
@@ -5,11 +5,6 @@
-author("Hypernumbers Ltd <gordon@hypernumbers.com>").
--define(RFC2116_SP, "\x20").
--define(RFC2116_HT, "\t"
-
--compile(export_all).
-
%%% this library supports the hmac_sha api on both the client-side
%%% AND the server-side
%%%
@@ -122,8 +117,8 @@ canonicalise_headers(List) when is_list(List) ->
c_headers2(consolidate(List2, []), []).
c_headers2([], Acc) -> string:join(Acc, "\n") ++ "\n";
-c_headers2([{[?headerprefix | Rest], Key} | T], Acc) ->
- Hd = string:strip([?headerprefix | Rest]) ++ ":" ++ string:strip(Key),
+c_headers2([{?headerprefix ++ Rest, Key} | T], Acc) ->
+ Hd = string:strip(?headerprefix ++ Rest) ++ ":" ++ string:strip(Key),
c_headers2(T, [Hd | Acc]);
c_headers2([_H | T], Acc) -> c_headers2(T, Acc).
Please sign in to comment.
Something went wrong with that request. Please try again.