From c2e2c7a771ca967e680ad5c45b9392957655a7d4 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 13 Nov 2012 20:40:46 +0000 Subject: follow redirects --- lib/custodian/protocol-tests/http.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/custodian/protocol-tests/http.rb') diff --git a/lib/custodian/protocol-tests/http.rb b/lib/custodian/protocol-tests/http.rb index f08856d..c7910c5 100755 --- a/lib/custodian/protocol-tests/http.rb +++ b/lib/custodian/protocol-tests/http.rb @@ -128,8 +128,16 @@ class HTTPTest response = http.start { http.get("#{url.path}?#{url.query}") } end - @status = response.code.to_i - @body = response.body + case response + when Net::HTTPRedirection + then + newURL = response['location'].match(/^http/)? + response['Location']:uri_str+response['Location'] + return( getURL(newURL) ) + else + @status = response.code.to_i + @body = response.body + end return true rescue Errno::EHOSTUNREACH => ex -- cgit v1.2.1