lib/rmega/net.rb in rmega-0.2.4 vs lib/rmega/net.rb in rmega-0.2.5
- old
+ new
@@ -16,10 +16,16 @@
end
def http_get_content(url)
uri = URI(url)
req = ::Net::HTTP::Get.new(uri.request_uri)
- return net_http(uri).request(req).body
+ resp = net_http(uri).request(req)
+
+ if resp.code.to_i == 509 and resp.body.to_s.empty?
+ raise BandwidthLimitExceeded.new
+ end
+
+ return resp.body
end
def http_post(url, data)
uri = URI(url)
req = ::Net::HTTP::Post.new(uri.request_uri)
\ No newline at end of file