Skip to content

Commit 6f12c59

Browse files
committed
Merge pull request #14 from jekyll/fix-for-1-9-3
Merge pull request 14
2 parents 782884a + 825137a commit 6f12c59

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ rvm:
44
- 2.2
55
- 2.1
66
- 2.0
7+
- 1.9.3
78
sudo: false
89
notifications:
910
email: false

lib/jekyll-gist/gist_tag.rb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
require 'cgi'
22
require 'net/http'
33

4+
Net::OpenTimeout = Class.new(RuntimeError) unless Net.const_defined?(:OpenTimeout)
5+
Net::ReadTimeout = Class.new(RuntimeError) unless Net.const_defined?(:ReadTimeout)
6+
47
module Jekyll
58
module Gist
69
class GistTag < Liquid::Tag
@@ -62,19 +65,13 @@ def fetch_raw_code(gist_id, filename = nil)
6265
begin
6366
uri = URI(url)
6467
Net::HTTP.start(uri.host, uri.port,
65-
use_ssl: uri.scheme == 'https',
68+
use_ssl: uri.scheme == 'https',
6669
read_timeout: 3, open_timeout: 3) do |http|
67-
request = Net::HTTP::Get.new uri
70+
request = Net::HTTP::Get.new uri.to_s
6871
response = http.request(request)
6972
response.body
7073
end
71-
rescue SocketError
72-
nil
73-
rescue Net::HTTPError
74-
nil
75-
rescue Net::OpenTimeout
76-
nil
77-
rescue Net::ReadTimeout
74+
rescue SocketError, Net::HTTPError, Net::OpenTimeout, Net::ReadTimeout
7875
nil
7976
end
8077
end

0 commit comments

Comments
 (0)