typhoeus 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +9 -0
- data/lib/typhoeus/pool.rb +12 -1
- data/lib/typhoeus/request/callbacks.rb +0 -1
- data/lib/typhoeus/version.rb +1 -1
- data/spec/typhoeus/pool_spec.rb +17 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTgwYWYyZmI1ZTkxMWMxZjM3MTQ2ZmE1OTJkMGJlMTJkNjQ1NWQ0Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjU1MTA2N2IxOGJhNWVmNWYwMGFjMTNhNjc2YTcyOWQ5MzFlMDljNw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzZmYjAyZTYxZDIwMjQyN2NhMmViNTE1ZjliNjI3OGU4MzEwNzYwMTMxZjEy
|
10
|
+
MWY1NDRjOWQyODZjMDRmYWVkMjIyOGU3ZGJiMjM5YmM5ZDI1YjFkODc1NWZm
|
11
|
+
YWY1YmZjYjliZWMzYzY3NDc1YzI5ZWRjYjA0Y2RmZDMxNmIzMDA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGY3YTM2NjQyOGFkZjJiMDI4MWZlODUyYTI2YzFiMmM4MTZmYThkODAyODE3
|
14
|
+
OWQ0YmJkYTVhNzFiNzk4ZTdjNTNhMDFhYjAwZDg3ZGJjYzMxNzJhYTQxMjhh
|
15
|
+
NWMyOTBkNzM1ZTc3ZTZhZGI5ZjcwNGM5ZDM0ZmQ3NWM5MjM3OGY=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.7.1
|
4
|
+
|
5
|
+
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v0.7.0...v0.7.1)
|
6
|
+
|
7
|
+
Bugfixes:
|
8
|
+
|
9
|
+
* Forking may cause libcurl sockets to be shared with child processes, causing HTTP requests to be interleaved
|
10
|
+
([Rolf Timmermans](https://github.com/rolftimmermans), [\#436](https://github.com/typhoeus/typhoeus/pull/426))
|
11
|
+
|
3
12
|
## 0.7.0
|
4
13
|
|
5
14
|
[Full Changelog](http://github.com/typhoeus/typhoeus/compare/v0.7.0.pre1...v0.7.0)
|
data/lib/typhoeus/pool.rb
CHANGED
@@ -9,6 +9,7 @@ module Typhoeus
|
|
9
9
|
# @api private
|
10
10
|
module Pool
|
11
11
|
@mutex = Mutex.new
|
12
|
+
@pid = Process.pid
|
12
13
|
|
13
14
|
# Releases easy into the pool. The easy handle is
|
14
15
|
# reset before it gets back in.
|
@@ -27,7 +28,17 @@ module Typhoeus
|
|
27
28
|
#
|
28
29
|
# @return [ Ethon::Easy ] The easy.
|
29
30
|
def self.get
|
30
|
-
@mutex.synchronize
|
31
|
+
@mutex.synchronize do
|
32
|
+
if @pid == Process.pid
|
33
|
+
easies.pop
|
34
|
+
else
|
35
|
+
# Process has forked. Clear all easies to avoid sockets being
|
36
|
+
# shared between processes.
|
37
|
+
@pid = Process.pid
|
38
|
+
easies.clear
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end || Ethon::Easy.new
|
31
42
|
end
|
32
43
|
|
33
44
|
# Clear the pool
|
data/lib/typhoeus/version.rb
CHANGED
data/spec/typhoeus/pool_spec.rb
CHANGED
@@ -59,6 +59,23 @@ describe Typhoeus::Pool do
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
context "when forked" do
|
64
|
+
before do
|
65
|
+
allow(Process).to receive(:pid).and_return(1)
|
66
|
+
Typhoeus::Pool.send(:easies) << easy
|
67
|
+
allow(Process).to receive(:pid).and_return(2)
|
68
|
+
end
|
69
|
+
|
70
|
+
after do
|
71
|
+
allow(Process).to receive(:pid).and_call_original
|
72
|
+
Typhoeus::Pool.instance_variable_set(:@pid, Process.pid)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "creates" do
|
76
|
+
expect(Typhoeus::Pool.get).to_not eq(easy)
|
77
|
+
end
|
78
|
+
end
|
62
79
|
end
|
63
80
|
|
64
81
|
describe "#with" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typhoeus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Balatero
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-01-
|
13
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: ethon
|