sqreen 1.11.2 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 729e481e969ff8187a3927f867812792de037a77f107a84c11269876fd8be84e
4
- data.tar.gz: 4d3cfc1c63134cfcd56d10c4086107df2e4ecf5e48b2c8cdd09797156d47e3fa
3
+ metadata.gz: 3e8eff78019936af7f34aba50cc99778250b703abf40045b13d3656dcb905804
4
+ data.tar.gz: 39ad12dfbe8dc9429ed66b2015e2e8aaa6383ecd5eb90dbe9221a35c38fcf0b5
5
5
  SHA512:
6
- metadata.gz: 33f234007987eb877da95b7178259748302591799bacc9db8968529ee431079d6e13f2bb9557b1bca0ae2494315a67a3b0b3ae1d9da37458a4d9a23d55a534b2
7
- data.tar.gz: 86b459747ae5d1eea783dbbbf64d354c7cb8a63ed48668232144f9e99a366e320fc501147f10a90c892936399f573af31413f04ebafc3c524075b1cac74aa0fc
6
+ metadata.gz: 9737911ca8cfa2fb17bc88454c47d28134e7f923a5490abab57be7d63d852842f5ca457b83a90d28a38b34baac09a099d42dd66d8cbd116fe1127511d3b7b6d6
7
+ data.tar.gz: 95e83d374c1e68d8085ae09538669b6a6a42ab84e461faf7620090154127bd1dd69bf80ed7a25a45d1b9aa338816b8e9e7425752346b7e25771c06de099c71e1
@@ -1,45 +1,22 @@
1
1
  # Copyright (c) 2015 Sqreen. All Rights Reserved.
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
- require "sqreen/backported_queue" if RUBY_VERSION >= "2.5.0"
4
-
5
3
  module Sqreen
6
- if RUBY_VERSION >= "2.5.0"
7
- # A simple size limited queue.
8
- # When trying to enqueue more than the capacity
9
- # the older elements will get thrown
10
- class CappedQueue < BackportedQueue
11
- attr_reader :capacity
12
-
13
- def initialize(capacity)
14
- @capacity = capacity
15
- super()
16
- end
4
+ # A simple size limited queue.
5
+ # When trying to enqueue more than the capacity
6
+ # the older elements will get thrown
7
+ class CappedQueue < Queue
8
+ attr_reader :capacity
17
9
 
18
- alias original_push push
19
-
20
- def push(value)
21
- pop until size < @capacity
22
- original_push(value)
23
- end
10
+ def initialize(capacity)
11
+ @capacity = capacity
12
+ super()
24
13
  end
25
- else
26
- # A simple size limited queue.
27
- # When trying to enqueue more than the capacity
28
- # the older elements will get thrown
29
- class CappedQueue < Queue
30
- attr_reader :capacity
31
-
32
- def initialize(capacity)
33
- @capacity = capacity
34
- super()
35
- end
36
14
 
37
- alias original_push push
15
+ alias original_push push
38
16
 
39
- def push(value)
40
- pop until size < @capacity
41
- original_push(value)
42
- end
17
+ def push(value)
18
+ pop until size < @capacity
19
+ original_push(value)
43
20
  end
44
21
  end
45
22
  end
@@ -40,6 +40,10 @@ module Sqreen
40
40
  @queue ||= CappedQueue.new(MAX_QUEUE_LENGTH)
41
41
  end
42
42
 
43
+ def update_queue(queue)
44
+ @queue = queue
45
+ end
46
+
43
47
  def observations_queue
44
48
  @observations_queue ||= CappedQueue.new(MAX_OBS_QUEUE_LENGTH)
45
49
  end
@@ -87,6 +91,7 @@ module Sqreen
87
91
  # startup
88
92
  # set_at_exit do not place a global at_exit (used for testing)
89
93
  def initialize(configuration, framework, set_at_exit = true, session_class = Sqreen::Session)
94
+ Sqreen.update_queue(CappedQueue.new(MAX_QUEUE_LENGTH))
90
95
  @logged_out_tried = false
91
96
  @configuration = configuration
92
97
  @framework = framework
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Sqreen. All Rights Reserved.
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
3
  module Sqreen
4
- VERSION = '1.11.2'.freeze
4
+ VERSION = '1.11.3'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqreen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.2
4
+ version: 1.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sqreen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-21 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs
@@ -51,7 +51,6 @@ files:
51
51
  - lib/sqreen-alt.rb
52
52
  - lib/sqreen.rb
53
53
  - lib/sqreen/attack_detected.html
54
- - lib/sqreen/backported_queue.rb
55
54
  - lib/sqreen/binding_accessor.rb
56
55
  - lib/sqreen/ca.crt
57
56
  - lib/sqreen/call_countable.rb
@@ -1,110 +0,0 @@
1
- ## Backported PureRuby queue from Ruby 2.0.0
2
- # Necessary while ruby 2.5.0 native queue are segfaulting
3
- module Sqreen
4
- class BackportedQueue
5
- #
6
- # Creates a new queue.
7
- #
8
- def initialize
9
- @que = []
10
- @que.taint # enable tainted communication
11
- @num_waiting = 0
12
- self.taint
13
- @mutex = Mutex.new
14
- @cond = ConditionVariable.new
15
- end
16
-
17
- #
18
- # Pushes +obj+ to the queue.
19
- #
20
- def push(obj)
21
- Thread.handle_interrupt(StandardError => :on_blocking) do
22
- @mutex.synchronize do
23
- @que.push obj
24
- @cond.signal
25
- end
26
- end
27
- end
28
-
29
- #
30
- # Alias of push
31
- #
32
- alias << push
33
-
34
- #
35
- # Alias of push
36
- #
37
- alias enq push
38
-
39
- #
40
- # Retrieves data from the queue. If the queue is empty, the calling thread is
41
- # suspended until data is pushed onto the queue. If +non_block+ is true, the
42
- # thread isn't suspended, and an exception is raised.
43
- #
44
- def pop(non_block=false)
45
- Thread.handle_interrupt(StandardError => :on_blocking) do
46
- @mutex.synchronize do
47
- while true
48
- if @que.empty?
49
- if non_block
50
- raise ThreadError, "queue empty"
51
- else
52
- begin
53
- @num_waiting += 1
54
- @cond.wait @mutex
55
- ensure
56
- @num_waiting -= 1
57
- end
58
- end
59
- else
60
- return @que.shift
61
- end
62
- end
63
- end
64
- end
65
- end
66
-
67
- #
68
- # Alias of pop
69
- #
70
- alias shift pop
71
-
72
- #
73
- # Alias of pop
74
- #
75
- alias deq pop
76
-
77
- #
78
- # Returns +true+ if the queue is empty.
79
- #
80
- def empty?
81
- @que.empty?
82
- end
83
-
84
- #
85
- # Removes all objects from the queue.
86
- #
87
- def clear
88
- @que.clear
89
- end
90
-
91
- #
92
- # Returns the length of the queue.
93
- #
94
- def length
95
- @que.length
96
- end
97
-
98
- #
99
- # Alias of length.
100
- #
101
- alias size length
102
-
103
- #
104
- # Returns the number of threads waiting on the queue.
105
- #
106
- def num_waiting
107
- @num_waiting
108
- end
109
- end
110
- end