sqreen 1.11.2-java → 1.11.3-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4dfdb8465c560693a881e41c966844e86a9ac3749411bc07c4393a06fd6f843
4
- data.tar.gz: c9121844fddfb01f5da67954c6e21d6bc1a5f3ef90fbba1681b8f8849374976e
3
+ metadata.gz: 4d33d84719c5ef4d77abff52d3f9b3a364eca99359841886d931375cd2268660
4
+ data.tar.gz: 0aaa8b8a1b12532240099cc52f619aeaf1204d9c61c9874c8a01a0229d17de34
5
5
  SHA512:
6
- metadata.gz: c352c227db08adc5be3d298106e6b7c3b78c583626c07a2317296489ebd1173c03801b6f7fb5a78b238fe0c5afa4f69f5cba40fb64f3d4e0fe658489b1f820a8
7
- data.tar.gz: 2bb3acb9a2db28c897f6cc8b1335bca65ee73fe5f066da2a2a5c9821ad1548c33b785ae9214e48e6e6872d06208f4c527374bfff456daef7eb704659f49c6f8b
6
+ metadata.gz: add27b4931f0355b3a9d68b6308f5b5a5b3763cfeb983bcbe10d3b265b58c20d7071ebbdce06be0045f2c403bad839b2b00a7d71c9fb4eb0324ccf444eae941a
7
+ data.tar.gz: 44fdfe46547a83637c4fb1cd451d69f75caaba0b252a1537a8a82cee137034156a18555a3fb647aad8f73525b14ae4fedbab2ad9a51615dd0ab8b3fe054fc5df
@@ -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
data/lib/sqreen/runner.rb CHANGED
@@ -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: java
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
@@ -50,7 +50,6 @@ files:
50
50
  - lib/sqreen-alt.rb
51
51
  - lib/sqreen.rb
52
52
  - lib/sqreen/attack_detected.html
53
- - lib/sqreen/backported_queue.rb
54
53
  - lib/sqreen/binding_accessor.rb
55
54
  - lib/sqreen/ca.crt
56
55
  - 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