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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- N2YzYzcwNTg0NGRkNzIwOWM0MTJlZWM3OTU0NDU0MWFjMWIxMzY5Mw==
4
+ NTgwYWYyZmI1ZTkxMWMxZjM3MTQ2ZmE1OTJkMGJlMTJkNjQ1NWQ0Yg==
5
5
  data.tar.gz: !binary |-
6
- MGY3YTAxZTUzNTdkYzVhZDlkZGJlZWQ0YWQwMjRmNmU5ZjBmODMzMw==
6
+ NjU1MTA2N2IxOGJhNWVmNWYwMGFjMTNhNjc2YTcyOWQ5MzFlMDljNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWYzMGQ5NzU4ODQ0MGE1MjdkMmU0NzE1N2I5Y2QwM2Q5MTA5ZDY2MzdiMWI3
10
- YTNjMzZmYmMwOTQ5ZGMyNzczZDliNzQ1NzA5NTI3MWQ1MTUyODM2YjBkM2E5
11
- YmU1OWZmN2EyNDI4ZTkzZTBhMzMzZGM5ZmZiZGM5MGQyMDM2MDM=
9
+ NzZmYjAyZTYxZDIwMjQyN2NhMmViNTE1ZjliNjI3OGU4MzEwNzYwMTMxZjEy
10
+ MWY1NDRjOWQyODZjMDRmYWVkMjIyOGU3ZGJiMjM5YmM5ZDI1YjFkODc1NWZm
11
+ YWY1YmZjYjliZWMzYzY3NDc1YzI5ZWRjYjA0Y2RmZDMxNmIzMDA=
12
12
  data.tar.gz: !binary |-
13
- MjliYzk1ZWI2NGRlYmYzOWI0NmQyZmU4ZTM4YzkwZmQyMTkwNzczNTg3YTVm
14
- NmZlNDcxM2MyMDVjYWNhODA0YzM5ZDYzZWEyMDY2YTRhZGYwMzMxZTc2ODAy
15
- MTYwOTc5NWEzM2QzNmQwNTFhNWEzMDkzMThhM2ZjNWVkNWY5MTY=
13
+ ZGY3YTM2NjQyOGFkZjJiMDI4MWZlODUyYTI2YzFiMmM4MTZmYThkODAyODE3
14
+ OWQ0YmJkYTVhNzFiNzk4ZTdjNTNhMDFhYjAwZDg3ZGJjYzMxNzJhYTQxMjhh
15
+ NWMyOTBkNzM1ZTc3ZTZhZGI5ZjcwNGM5ZDM0ZmQ3NWM5MjM3OGY=
@@ -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)
@@ -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 { easies.pop } || Ethon::Easy.new
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
@@ -2,7 +2,6 @@ module Typhoeus
2
2
  class Request
3
3
 
4
4
  # This module contains the logic for the response callbacks.
5
- # The on_complete callback is the only one at the moment.
6
5
  #
7
6
  # You can set multiple callbacks, which are then executed
8
7
  # in the same order.
@@ -1,5 +1,5 @@
1
1
  module Typhoeus
2
2
 
3
3
  # The current Typhoeus version.
4
- VERSION = '0.7.0'
4
+ VERSION = '0.7.1'
5
5
  end
@@ -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.0
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-08 00:00:00.000000000 Z
13
+ date: 2015-01-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ethon