Browse code

Merge pull request #228 from mattn/proxy

Adds proxy support for gist_tag

Frederic Hemberger authored on 18/10/2011 at 09:07:55
Showing 1 changed files
... ...
@@ -71,7 +71,13 @@ module Jekyll
71 71
     def get_gist_from_web(gist, file)
72 72
       gist_url          = get_gist_url_for gist, file
73 73
       raw_uri           = URI.parse gist_url
74
-      https             = Net::HTTP.new raw_uri.host, raw_uri.port
74
+      proxy             = ENV['http_proxy']
75
+      if proxy
76
+        proxy_uri       = URI.parse(proxy)
77
+        https           = Net::HTTP::Proxy(proxy_uri.host, proxy_uri.port).new raw_uri.host, raw_uri.port
78
+      else
79
+        https           = Net::HTTP.new raw_uri.host, raw_uri.port
80
+      end
75 81
       https.use_ssl     = true
76 82
       https.verify_mode = OpenSSL::SSL::VERIFY_NONE
77 83
       request           = Net::HTTP::Get.new raw_uri.request_uri