nethttp_ab 0.0.6 → 0.0.7
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.
- data/CHANGELOG +3 -0
- data/Rakefile +1 -1
- data/lib/requester.rb +16 -19
- data/nethttp_ab.gemspec +10 -11
- metadata +7 -9
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('nethttp_ab', '0.0.
|
5
|
+
Echoe.new('nethttp_ab', '0.0.7') do |p|
|
6
6
|
p.description = "Simple tool to test and benchmark sites"
|
7
7
|
p.url = "http://github.com/german/nethttp_ab"
|
8
8
|
p.author = "Dmitrii Samoilov"
|
data/lib/requester.rb
CHANGED
@@ -176,26 +176,15 @@ module NethttpAb
|
|
176
176
|
|
177
177
|
def start_threads
|
178
178
|
@concurrent_users.times do
|
179
|
-
#begin
|
180
|
-
# http_opened_session = get_http_session(@url)
|
181
|
-
#rescue OpenSSL::SSL::SSLError => e
|
182
|
-
# puts "The url you provided is wrong, please check is it really ssl encrypted"
|
183
|
-
# exit
|
184
|
-
#rescue Errno::ECONNREFUSED => e
|
185
|
-
# puts "Connection error, please check your internet connection or make sure the server is responding"
|
186
|
-
# exit
|
187
|
-
#rescue SocketError => e
|
188
|
-
# puts e.message
|
189
|
-
# exit
|
190
|
-
#end
|
191
|
-
|
192
179
|
@threads << Thread.new do
|
193
180
|
while !@requests_queue.empty? do
|
194
181
|
# lock request in order to avoid sharing same request by two threads and making more requests then specified
|
195
182
|
if next_url = @requests_queue.lock_next_request
|
196
183
|
req = if @follow_links
|
197
184
|
next_url_parsed = URI.parse(next_url)
|
198
|
-
|
185
|
+
|
186
|
+
# ensure that we are requesting main page (if url is like http://google.com)
|
187
|
+
next_url_parsed.path = '/' if next_url_parsed.path == ""
|
199
188
|
next_url_parsed
|
200
189
|
else
|
201
190
|
@url
|
@@ -206,13 +195,21 @@ module NethttpAb
|
|
206
195
|
|
207
196
|
@total_time += Benchmark.realtime do
|
208
197
|
begin
|
209
|
-
|
210
|
-
|
198
|
+
response_object = if 443 == req.port
|
199
|
+
http = Net::HTTP.new(req.host, req.port)
|
200
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
201
|
+
http.use_ssl = true
|
202
|
+
http.start{|agent| agent.get(req.path)}
|
203
|
+
else
|
204
|
+
Net::HTTP.get_response(req)
|
205
|
+
end
|
206
|
+
|
207
|
+
response = case response_object
|
211
208
|
when Net::HTTPSuccess
|
212
|
-
|
209
|
+
response_object
|
213
210
|
when Net::HTTPRedirection
|
214
|
-
print "redirected to #{
|
215
|
-
Net::HTTP.get_response(URI.parse(
|
211
|
+
print "redirected to #{response_object['location']}\n"
|
212
|
+
Net::HTTP.get_response(URI.parse(response_object['location']))
|
216
213
|
end
|
217
214
|
|
218
215
|
print '.' # show progress while processing queue
|
data/nethttp_ab.gemspec
CHANGED
@@ -1,25 +1,24 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "0.0.
|
4
|
+
s.name = "nethttp_ab"
|
5
|
+
s.version = "0.0.7"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Dmitrii Samoilov"]
|
9
|
-
s.date =
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.email = %q{germaninthetown@gmail.com}
|
9
|
+
s.date = "2012-02-06"
|
10
|
+
s.description = "Simple tool to test and benchmark sites"
|
11
|
+
s.email = "germaninthetown@gmail.com"
|
13
12
|
s.executables = ["nethttp_ab"]
|
14
13
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "bin/nethttp_ab", "lib/requester.rb", "lib/requests_queue.rb", "lib/simple_requests_queue.rb"]
|
15
14
|
s.files = ["CHANGELOG", "Gemfile", "LICENSE", "Manifest", "README", "Rakefile", "bin/nethttp_ab", "lib/requester.rb", "lib/requests_queue.rb", "lib/simple_requests_queue.rb", "nethttp_ab.gemspec", "test/nethttp_ab_test.rb", "test/requests_queue_test.rb", "test/resources/depth2/links1.html", "test/resources/depth2/links2.html", "test/resources/depth2/links3.html", "test/resources/depth2/links_11.html", "test/resources/depth2/links_12.html", "test/resources/depth2/links_21.html", "test/resources/depth2/links_31.html", "test/resources/depth2/links_32.html", "test/resources/depth2/links_33.html", "test/resources/index.html", "test/resources/links.html", "test/resources/links1.html", "test/resources/links2.html", "test/resources/links3.html", "test/resources/links4.html", "test/resources/links5.html", "test/resources/links_depth_2.html", "test/simple_requests_queue_test.rb", "test/url_regexp_test.rb"]
|
16
|
-
s.homepage =
|
15
|
+
s.homepage = "http://github.com/german/nethttp_ab"
|
17
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Nethttp_ab", "--main", "README"]
|
18
17
|
s.require_paths = ["lib"]
|
19
|
-
s.rubyforge_project =
|
20
|
-
s.rubygems_version =
|
21
|
-
s.summary =
|
22
|
-
s.test_files = ["test/
|
18
|
+
s.rubyforge_project = "nethttp_ab"
|
19
|
+
s.rubygems_version = "1.8.14"
|
20
|
+
s.summary = "Simple tool to test and benchmark sites"
|
21
|
+
s.test_files = ["test/simple_requests_queue_test.rb", "test/url_regexp_test.rb", "test/requests_queue_test.rb", "test/nethttp_ab_test.rb"]
|
23
22
|
|
24
23
|
if s.respond_to? :specification_version then
|
25
24
|
s.specification_version = 3
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nethttp_ab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2012-02-06 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: nokogiri
|
17
|
-
requirement: &
|
16
|
+
requirement: &17373460 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
@@ -22,7 +21,7 @@ dependencies:
|
|
22
21
|
version: 1.4.2
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
24
|
+
version_requirements: *17373460
|
26
25
|
description: Simple tool to test and benchmark sites
|
27
26
|
email: germaninthetown@gmail.com
|
28
27
|
executables:
|
@@ -69,7 +68,6 @@ files:
|
|
69
68
|
- test/resources/links_depth_2.html
|
70
69
|
- test/simple_requests_queue_test.rb
|
71
70
|
- test/url_regexp_test.rb
|
72
|
-
has_rdoc: true
|
73
71
|
homepage: http://github.com/german/nethttp_ab
|
74
72
|
licenses: []
|
75
73
|
post_install_message:
|
@@ -96,12 +94,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
94
|
version: '1.2'
|
97
95
|
requirements: []
|
98
96
|
rubyforge_project: nethttp_ab
|
99
|
-
rubygems_version: 1.
|
97
|
+
rubygems_version: 1.8.14
|
100
98
|
signing_key:
|
101
99
|
specification_version: 3
|
102
100
|
summary: Simple tool to test and benchmark sites
|
103
101
|
test_files:
|
102
|
+
- test/simple_requests_queue_test.rb
|
104
103
|
- test/url_regexp_test.rb
|
105
|
-
- test/nethttp_ab_test.rb
|
106
104
|
- test/requests_queue_test.rb
|
107
|
-
- test/
|
105
|
+
- test/nethttp_ab_test.rb
|