lib/shared/http.rb in yawast-0.5.0.beta6 vs lib/shared/http.rb in yawast-0.5.0.beta7

- old
+ new

@@ -14,12 +14,21 @@ @cookie = cookie puts "Using Cookie: #{@cookie}" if @cookie != nil end def self.head(uri) - req = get_http(uri) - req.use_ssl = uri.scheme == 'https' - req.head(uri.path, get_headers) + begin + req = get_http(uri) + req.use_ssl = uri.scheme == 'https' + req.head(uri.path, get_headers) + rescue + #if we get here, the HEAD failed - but GET may work + #so we silently fail back to using GET instead + req = get_http(uri) + req.use_ssl = uri.scheme == 'https' + res = req.request_get(uri.path, get_headers) + res + end end def self.get(uri, headers = nil) body = ''