Permalink
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...
1 parent c135144 commit e6e40d71d5cda1f5494997ace13db5f8fa956b9d @hypernumbers committed Jul 26, 2011
Showing with 4 additions and 9 deletions.
  1. +2 −2 examples/hmac_api/hmac_api.hrl
  2. +2 −7 examples/hmac_api/hmac_api_lib.erl
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).

0 comments on commit e6e40d7

Please sign in to comment.