slowweb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/slow_web/ext/net_http.rb +9 -6
- data/lib/slow_web/version.rb +1 -1
- metadata +3 -3
@@ -7,13 +7,16 @@ module Net
|
|
7
7
|
host = self.address
|
8
8
|
limit = SlowWeb.get_limit(host)
|
9
9
|
|
10
|
-
#
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
# Manage this request if it has been limited
|
11
|
+
if !limit.nil?
|
12
|
+
# Wait until the request limit is no longer exceeded
|
13
|
+
while limit.exceeded?
|
14
|
+
sleep 1
|
15
|
+
end
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
+
# Add request to limiter
|
18
|
+
limit.add_request(request)
|
19
|
+
end
|
17
20
|
|
18
21
|
# Continue with the original request
|
19
22
|
request_without_slowweb(request, body, &block)
|
data/lib/slow_web/version.rb
CHANGED
metadata
CHANGED