<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>external/httpclient.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -55,6 +55,24 @@ ECONF
 		Net::HTTP.start(hostname,port) {|http| http.delete(url)}
 	end
 	
+	require &quot;#{@@testdir}/../external/httpclient&quot;
+	def httpclient(host, port, request, query_string)
+		r = nil
+		EventMachine.run do
+			http = EventMachine::Protocols::HttpClient.request(
+				:host =&gt; host,
+				:port =&gt; port,
+				:request =&gt; request,
+				:query_string =&gt; query_string
+			)
+			http.callback do |response|
+				r = response
+				EM.stop_event_loop
+			end
+		end
+		r
+	end
+	
 	def setup
 		Dir.chdir(@@testdir)
 		SwiftcoreTestSupport.announce(:swiftiply_functional,&quot;Functional Swiftiply Testing&quot;)
@@ -83,7 +101,7 @@ ECONF
 		
 		smallfile_name = &quot;smallfile#{Time.now.to_i}&quot;
 		smallfile_path = File.join(dr,smallfile_name)
-		File.open(smallfile_path,'w') {|fh| fh.puts &quot;alfalfa leafcutter bee&quot;}
+		File.open(smallfile_path,'w') {|fh| fh.puts &quot;0123456789&quot;*102}
 		DeleteQueue &lt;&lt; smallfile_path
 		
 		bigfile_name = &quot;bigfile#{Time.now.to_i}&quot;
@@ -109,7 +127,10 @@ ECONF
 	
 		response = get_url('127.0.0.1',29998,smallfile_name)
 		small_etag = response['ETag']
-		assert_equal(&quot;alfalfa leafcutter bee\n&quot;,response.body)
+		assert_equal(&quot;0123456789&quot;*102+&quot;\n&quot;,response.body)
+		
+		response = httpclient('127.0.0.1',29998,&quot;http://127.0.0.1/#{smallfile_name}&quot;,'')
+		assert_equal(&quot;0123456789&quot;*102+&quot;\n&quot;,response[:content])
 		
 		response = get_url('127.0.0.1',29998,bigfile_name)
 		big_etag = response['ETag']
@@ -128,12 +149,12 @@ ECONF
 		unless ab == ''
 			r = `#{ab} -n 100000 -c 25 http://127.0.0.1:29998/#{smallfile_name}`
 			r =~ /^(Requests per second.*)$/
-			puts &quot;10k 22 byte files, concurrency of 25\n#{$1}\n&quot;
+			puts &quot;10k 1020 byte files, concurrency of 25\n#{$1}\n&quot;
 		end
 		unless ab == ''
 			r = `#{ab} -n 100000 -c 25 -H 'If-None-Match: #{small_etag}' http://127.0.0.1:29998/#{smallfile_name}`
 			r =~ /^(Requests per second.*)$/
-			puts &quot;10k 22 byte files with etag, concurrency of 25\n#{$1}\n&quot;
+			puts &quot;10k 1020 byte files with etag, concurrency of 25\n#{$1}\n&quot;
 		end
 		unless ab == ''
 			r = `#{ab} -n 100000 -i -c 25 http://127.0.0.1:29998/#{smallfile_name}`
@@ -153,7 +174,7 @@ ECONF
 		
 		# And it is still correct?
 		response = get_url('127.0.0.1',29998,smallfile_name)
-		assert_equal(&quot;alfalfa leafcutter bee\n&quot;,response.body)
+		assert_equal(&quot;0123456789&quot;*102+&quot;\n&quot;,response.body)
 	end
 
 	def test_serve_static_file_caches
@@ -836,8 +857,20 @@ ECONF
 		# This request should pull the file from the docroot, since it the
 		# docroot was not deleted from the config that was just read.
 		response = get_url('127.0.0.1',29998,'/xyzzy')
-
 		assert_equal(&quot;alfalfa leafcutter bee\n&quot;,response.body)
+		
+		# Reload the config again, just to make sure we can do it twice;
+		# there was a bug reported about Swiftiply dying after the second HUP,
+		# so we want to make sure we are covered, here.
+		
+		Process.kill 'SIGHUP',swiftiply_pid
+		response = get_url('127.0.0.1',29998,'/xyzzy')
+		assert_equal(&quot;alfalfa leafcutter bee\n&quot;,response.body,&quot;Swiftiply failure on second HUP.&quot;)
+		
+		# And because we're the suspicious types, let's do it a third tim, just to cover the bases.
+		Process.kill 'SIGHUP',swiftiply_pid
+		response = get_url('127.0.0.1',29998,'/xyzzy')
+		assert_equal(&quot;alfalfa leafcutter bee\n&quot;,response.body,&quot;Swiftiply failure on second HUP.&quot;)
 	end
 	
 end</diff>
      <filename>test/TC_Swiftiply.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>aa0451433560e471c5f6d1e2fecf530035b329b4</id>
    </parent>
  </parents>
  <author>
    <name>khaines@swiftcore.org</name>
    <email>khaines@swiftcore.org</email>
  </author>
  <url>http://github.com/wyhaines/swiftiply/commit/2968c22b0134f975579c0e3047052c66ef4592f1</url>
  <id>2968c22b0134f975579c0e3047052c66ef4592f1</id>
  <committed-date>2008-07-03T07:38:07-07:00</committed-date>
  <authored-date>2008-07-03T07:38:07-07:00</authored-date>
  <message>Added a modified version of the standard EM HttpClient that removes a bit of the user safeguards.

New/modified tests check requests in the form of 'GET http://foo/bar HTTP/1.1', which are valid requests to send to a proxy (uses the modified httpclient); better HUP tests, which repeat the HUP a couple of times to make sure it continues working; changed the size of the small file test to 1k, since it's more representative of a typical small image file, and it also doesn't appear to make any significant difference in perf betweek 22 bytes and 1020 bytes, so the numbers remain valid as a measure of top end speed.</message>
  <tree>c6c57b507d1a67de0ee6b37d82fe3b6c4ffe37a4</tree>
  <committer>
    <name>khaines@swiftcore.org</name>
    <email>khaines@swiftcore.org</email>
  </committer>
</commit>
