<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,3 +2,4 @@
 require 'rake'
 
 task :default =&gt; [&quot;erlang:compile&quot;, &quot;erlang:releases&quot;]
+task :install =&gt; [&quot;erlang:install&quot;]
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@
 -module(s3).
 
 -behaviour(application).
-
+-define(TIMEOUT, 15000).
 %%--------------------------------------------------------------------
 %% External exports
 %%--------------------------------------------------------------------
@@ -21,7 +21,7 @@
 %% API
 -export([
       read_term/2, write_term/3,
-	  list_buckets/0, create_bucket/1, delete_bucket/1, link_to/3, head/2, policy/1, get_object/3, get_objects/2,
+	  list_buckets/0, create_bucket/1, delete_bucket/1, link_to/3, head/2, policy/1, get_object/3, get_objects/3, get_objects/2,
 	  list_objects/2, list_objects/1, write_object/4, write_object/5, read_object/2, read_object/3, delete_object/2 ]).
 	  
 %timer:tc(s3,get_objects,[&quot;ejabberd.conf&quot;, [{maxkeys, 20}]]).
@@ -36,8 +36,8 @@ start(_Type, _StartArgs) -&gt;
     
     ID = get(access, &quot;AMAZON_ACCESS_KEY_ID&quot;),
     Secret = get(secret, &quot;AMAZON_SECRET_ACCESS_KEY&quot;),
-    SSL = param(ssl, true),
-    N = param(workers, 5),
+    SSL = param(ssl, false),
+    N = param(workers, 2),
     Timeout = param(timeout, nil),
     Port = if SSL == true -&gt; 
             ssl:start(),
@@ -104,23 +104,34 @@ delete_object (Bucket, Key) -&gt;
 
 get_object (From, Bucket, Key) -&gt; 
     Pid = s3sup:get_random_pid(),
-    {ok, {Content, Headers}} = gen_server:call(Pid, {get, Bucket, Key}),
-    From ! {s3object, Content}. 
+    {ok, {Content, _Headers}} = gen_server:call(Pid, {get, Bucket, Key}),
+    From ! {s3object, Key, Content}. 
     
 % Gets objects in // from S3.
 %% option example: [{delimiter, &quot;/&quot;},{maxkeys,10},{prefix,&quot;/foo&quot;}]
 get_objects(Bucket, Options)-&gt;
+    get_objects(Bucket, Options, ?TIMEOUT).
+get_objects(Bucket, Options, Timeout)-&gt;
     {ok, Objects} = list_objects (Bucket, Options ),
+    timer:send_after(Timeout, self(), timeout),
     lists:foreach(fun({object_info, {&quot;Key&quot;, Key}, _, _, _})-&gt;
         spawn(?MODULE, get_object,[self(), Bucket, Key ])
     end, Objects),
-    R = lists:foldl(fun(_N, Acc)-&gt;
+    R = lists:foldl(
+    fun (_N, timeout)-&gt;timeout;
+        (_N, Acc)-&gt;
         receive
-            {s3object, R} -&gt; 
-                [R|Acc]
+            {s3object, K, R} -&gt; 
+                [{K, R}|Acc];
+            timeout-&gt;
+                timeout
         end
+        
     end,[],  Objects),
-    {ok, R}.
+    case R of
+        timeout -&gt; {error,timeout};
+        R -&gt; {ok, R}
+    end.
     
 %% option example: [{delimiter, &quot;/&quot;},{maxkeys,10},{prefix,&quot;/foo&quot;}]
 list_objects (Bucket, Options ) -&gt; </diff>
      <filename>lib/s3/src/s3.erl</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,7 @@
 -include(&quot;../include/s3.hrl&quot;).
 
 -record(state, {ssl,access_key, secret_key, pending, timeout=?TIMEOUT}).
--record(request, {pid, callback, code, headers=[], content=[]}).
+-record(request, {pid, callback, started, code, headers=[], content=[]}).
 %%====================================================================
 %% External functions
 %%====================================================================
@@ -168,8 +168,9 @@ handle_info({ibrowse_async_response,RequestId,Body },State = #state{pending=P})
 	end;
 handle_info({ibrowse_async_response_end,RequestId}, State = #state{pending=P})-&gt;
     case gb_trees:lookup(RequestId,P) of
-		{value,R} -&gt; 
+		{value,#request{started=_Started}=R} -&gt; 
 		    handle_http_response(R),
+		    %io:format(&quot;Query took ~p ms~n&quot;, [timer:now_diff(now(), Started)/1000]),
 			{noreply,State#state{pending=gb_trees:delete(RequestId, P)}};
 		none -&gt; {noreply,State}
 			%% the requestid isn't here, probably the request was deleted after a timeout
@@ -259,11 +260,16 @@ buildContentHeaders( Contents, AdditionalHeaders ) -&gt;
 buildOptions(&lt;&lt;&gt;&gt;, _ContentType, SSL)-&gt;
     [{stream_to, self()}, {is_ssl, SSL}, {ssl_options, []}];
 buildOptions(Content, ContentType,SSL)-&gt;
-    [{content_length, integer_to_list(size(Content))},
+    [{content_length, content_length(Content)},
     {content_type, ContentType},
     {is_ssl, SSL},{ssl_options, []},
     {stream_to, self()}].
-
+    
+content_length(Content) when is_binary(Content)-&gt;
+    integer_to_list(size(Content));
+content_length(Content) when is_list(Content)-&gt;
+    integer_to_list(length(Content)).
+    
 genericRequest(From, #state{ssl=SSL, access_key=AKI, secret_key=SAK, timeout=Timeout, pending=P }=State, 
                 Method, Bucket, Path, QueryParams, AdditionalHeaders,Contents, ContentType, Callback ) -&gt;
     Date = httpd_util:rfc1123_date(),
@@ -279,10 +285,10 @@ genericRequest(From, #state{ssl=SSL, access_key=AKI, secret_key=SAK, timeout=Tim
 		        {&quot;Date&quot;, Date } 
 	            | OriginalHeaders ],
     Options = buildOptions(Contents, ContentType, SSL), 
-    %io:format(&quot;Sending request ~p~n&quot;, [Url]),
+    io:format(&quot;Sending request ~p~n&quot;, [Url]),
     case ibrowse:send_req(Url, Headers,  Method, Contents,Options, Timeout) of
         {ibrowse_req_id,RequestId} -&gt;
-            Pendings = gb_trees:insert(RequestId,#request{pid=From,callback=Callback},P),
+            Pendings = gb_trees:insert(RequestId,#request{pid=From,started=now(), callback=Callback},P),
             {noreply, State#state{pending=Pendings}};
         {error,E} when E =:= retry_later orelse E =:= conn_failed -&gt;
             io:format(&quot;Waiting on retry Error : ~p, Pid : ~p~n&quot;, [E, self()]),</diff>
      <filename>lib/s3/src/s3server.erl</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,2 @@
-{vsn,&quot;0.4&quot;}.
+{vsn,&quot;0.5&quot;}.
 {release_name,&quot;initial&quot;}.
\ No newline at end of file</diff>
      <filename>lib/s3/vsn.config</filename>
    </modified>
    <modified>
      <diff>@@ -98,11 +98,16 @@ namespace :erlang do
     erlang_source_dependencies + erlang_test_dependencies
   end
 
+  def erlang_home
+    @erlang_home||=IO.popen(&quot;#{ERL_TOP}/bin/erl -noinput -noshell -eval 'io:format(code:root_dir()).' -s init stop&quot;).readlines[0] 
+  end
+
   def run_application_test(application, directories)
     application_name = application.pathmap(&quot;%f&quot;).ext(&quot;&quot;)
     run_script(&quot;run_test&quot;,[&quot;application&quot;, application_name] + directories)
   end
-
+  
+  
   def run_description_test(description, directories)
     run_script(&quot;run_test&quot;,[&quot;file&quot;, description] + directories)
   end
@@ -373,6 +378,16 @@ namespace :erlang do
 
   task :default =&gt; [:compile]
 
+
+  desc &quot;Installs in local erl repository : #{erlang_home}&quot;
+  task :install =&gt;  [:compile] do |t|
+    FileList.new('lib/*').each do |dir|
+      vsn = extract_version_information(&quot;#{dir}/vsn.config&quot;,&quot;vsn&quot;).gsub(&quot;\&quot;&quot;,&quot;&quot;)
+      sh &quot;cp -R #{dir} #{erlang_home}/#{dir}-#{vsn}&quot;
+    end
+  end
+
+
   desc &quot;Build Application packages&quot;
   task :package =&gt; [:applications] do
     ERL_APPLICATIONS.each do |application|</diff>
      <filename>rakelib/erlang.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>680185e4594f67b4e63cf98f84c73d2fea3edcd7</id>
    </parent>
  </parents>
  <author>
    <name>Eric Cestari</name>
    <email>ecestari@mac.com</email>
  </author>
  <url>http://github.com/cstar/erls3/commit/6c44f47ede9ddc428d0305d254e1c8309115ca4b</url>
  <id>6c44f47ede9ddc428d0305d254e1c8309115ca4b</id>
  <committed-date>2009-04-02T04:01:49-07:00</committed-date>
  <authored-date>2009-04-02T04:01:49-07:00</authored-date>
  <message>Added rake install task.</message>
  <tree>8324328dfddccb4f2bd5651240435b7407076ea7</tree>
  <committer>
    <name>Eric Cestari</name>
    <email>ecestari@mac.com</email>
  </committer>
</commit>
