dragonfly 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of dragonfly might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c443c8f0fc5b7be3523df81d24f3fa02d4cde7a1
4
- data.tar.gz: b68fd67ac67553ec180304a099a37e6625db4692
3
+ metadata.gz: f4447e48d0b8ae55e37417b745ad6b41874460e3
4
+ data.tar.gz: eec72c3113796cfb2350b92d2f423f74c09c08a8
5
5
  SHA512:
6
- metadata.gz: 3af5d4adc707c1089838cda7b65242ad2c3820dabf7c498e0ffdddb71768cc68f2eb970d7682fdac020e3fa416fb44b7bcb6f01706aedff1a72c56003a0b7be9
7
- data.tar.gz: b29fe47d2ce93f8f638d116b2964c345a591b237731ba68fcc22fad87428ed9bc02f3cf3663907f7b4a90270198a07f5a57638b3c75a3880ff8035eb77c9c00d
6
+ metadata.gz: 8b603153fca561242e794bf14dbbc2f5aa189d89d1bb61a680cc8592147f5f42742057dbc2a3817e1015b864876d9282a3b2407bd7525a779e44217b74ab17fd
7
+ data.tar.gz: e963b8c1b8791262b823d1b2af24f862cd799567da45cdd2676797c4822caa8c0ab5949596743032b95ac7486cc240698f88c982101f45d8570549d635406dbc
data/History.md CHANGED
@@ -1,3 +1,9 @@
1
+ 1.0.5 (2014-05-15)
2
+ ===================
3
+ Fixes
4
+ -----
5
+ - fetch_url wasn't correctly getting https endpoints on Ruby approx < 2
6
+
1
7
  1.0.4 (2014-04-11)
2
8
  ===================
3
9
  Fixes
data/README.md CHANGED
@@ -54,7 +54,7 @@ Installation
54
54
 
55
55
  or in your Gemfile
56
56
  ```ruby
57
- gem 'dragonfly', '~> 1.0.4'
57
+ gem 'dragonfly', '~> 1.0.5'
58
58
  ```
59
59
 
60
60
  Require with
@@ -42,19 +42,19 @@ module Dragonfly
42
42
  if data_uri?
43
43
  update_from_data_uri
44
44
  else
45
- data = get(url)
45
+ data = get_following_redirects(url)
46
46
  job.content.update(data, 'name' => filename)
47
47
  end
48
48
  end
49
49
 
50
50
  private
51
51
 
52
- def get(url, redirect_limit=10)
52
+ def get_following_redirects(url, redirect_limit=10)
53
53
  raise TooManyRedirects, "url #{url} redirected too many times" if redirect_limit == 0
54
- response = Net::HTTP.get_response(parse_url(url))
54
+ response = get(url)
55
55
  case response
56
56
  when Net::HTTPSuccess then response.body || ""
57
- when Net::HTTPRedirection then get(response['location'], redirect_limit-1)
57
+ when Net::HTTPRedirection then get_following_redirects(response['location'], redirect_limit-1)
58
58
  else
59
59
  response.error!
60
60
  end
@@ -62,6 +62,13 @@ module Dragonfly
62
62
  raise ErrorResponse.new(e.response.code.to_i, e.response.body)
63
63
  end
64
64
 
65
+ def get(url)
66
+ url = parse_url(url)
67
+ http = Net::HTTP.new(url.host, url.port)
68
+ http.use_ssl = true if url.scheme == 'https'
69
+ response = http.get(url.request_uri)
70
+ end
71
+
65
72
  def update_from_data_uri
66
73
  mime_type, b64_data = uri.scan(/^data:([^;]+);base64,(.*)$/)[0]
67
74
  if mime_type && b64_data
@@ -1,3 +1,3 @@
1
1
  module Dragonfly
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
@@ -25,7 +25,7 @@ describe Dragonfly::Job::FetchUrl do
25
25
  end
26
26
 
27
27
  it "should also work with https" do
28
- stub_request(:get, /place.com/).to_return(:body => 'secure result!')
28
+ stub_request(:get, 'https://place.com').to_return(:body => 'secure result!')
29
29
  job.fetch_url!('https://place.com')
30
30
  job.data.should == "secure result!"
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack