nethttp_ab 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/LICENSE +19 -0
- data/Manifest +4 -1
- data/Rakefile +2 -2
- data/bin/nethttp_ab +26 -7
- data/lib/requester.rb +10 -3
- data/nethttp_ab.gemspec +7 -9
- metadata +32 -54
- data.tar.gz.sig +0 -1
- metadata.gz.sig +0 -0
data/CHANGELOG
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2011 by Dmitrii Samoilov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/Manifest
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
CHANGELOG
|
2
|
+
LICENSE
|
3
|
+
Manifest
|
1
4
|
README
|
2
5
|
Rakefile
|
3
6
|
bin/nethttp_ab
|
@@ -5,8 +8,8 @@ lib/net.rb
|
|
5
8
|
lib/requester.rb
|
6
9
|
lib/requests_queue.rb
|
7
10
|
lib/simple_requests_queue.rb
|
11
|
+
nethttp_ab.gemspec
|
8
12
|
test/nethttp_ab_test.rb
|
9
13
|
test/requests_queue_test.rb
|
10
14
|
test/resources/index.html
|
11
15
|
test/simple_requests_queue_test.rb
|
12
|
-
Manifest
|
data/Rakefile
CHANGED
@@ -2,8 +2,8 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('nethttp_ab', '0.0.
|
6
|
-
p.description = "Simple tool to benchmark sites"
|
5
|
+
Echoe.new('nethttp_ab', '0.0.2') do |p|
|
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"
|
9
9
|
p.email = "germaninthetown@gmail.com"
|
data/bin/nethttp_ab
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rubygems'
|
3
|
-
require 'trollop'
|
4
3
|
require File.dirname(File.expand_path(__FILE__)) + '/../lib/requester.rb'
|
5
4
|
|
6
5
|
# SIMPLE USAGE:
|
@@ -10,19 +9,39 @@ require File.dirname(File.expand_path(__FILE__)) + '/../lib/requester.rb'
|
|
10
9
|
# OR simulate user and follow all local links on the page
|
11
10
|
# nethttp_ab -f http://localhost:3000
|
12
11
|
|
13
|
-
opts =
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
opts = {}
|
13
|
+
|
14
|
+
if ARGV.include?('--follow_links') || ARGV.include?('-f')
|
15
|
+
opts[:follow_links] = true
|
16
|
+
else
|
17
|
+
opts[:follow_links] = false
|
18
|
+
end
|
19
|
+
|
20
|
+
if ARGV.include?('-c')
|
21
|
+
opts[:concurrent_threads] = ARGV[ARGV.index('-c') + 1].to_i
|
22
|
+
ARGV.delete('-c')
|
23
|
+
ARGV.delete(opts[:concurrent_threads])
|
24
|
+
else
|
25
|
+
opts[:concurrent_threads] = 3
|
26
|
+
end
|
27
|
+
|
28
|
+
if ARGV.include?('-n')
|
29
|
+
opts[:requests] = ARGV[ARGV.index('-n') + 1].to_i
|
30
|
+
ARGV.delete('-n')
|
31
|
+
ARGV.delete(opts[:requests])
|
32
|
+
else
|
33
|
+
opts[:requests] = 10
|
17
34
|
end
|
18
35
|
|
19
36
|
url_to_benchmark = "http://localhost:3000/"
|
37
|
+
|
20
38
|
# search for the url to perform benchmarking on
|
21
|
-
# we don't use trollop here since I don't like to specify --url=http://mysite.com to get the url
|
22
39
|
ARGV.each do |arg|
|
23
|
-
url_to_benchmark = arg if arg =~
|
40
|
+
url_to_benchmark = arg if arg =~ /^(https?:\/\/)?([\w\.]+)\.([a-z]{2,6}\.?)(\/[\w\.]*)*\/?$/
|
24
41
|
end
|
25
42
|
|
43
|
+
url_to_benchmark = "http://" + url_to_benchmark if url_to_benchmark !~ /^https?:\/\//
|
44
|
+
|
26
45
|
requester = NethttpAb::Requester.new
|
27
46
|
requester.concurrent_users = opts[:concurrent_threads]
|
28
47
|
requester.num_of_requests = opts[:requests]
|
data/lib/requester.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'benchmark'
|
2
2
|
require 'thread'
|
3
|
-
require 'nokogiri' # we could follow links on the pages if there's --follow-links=2 option
|
4
3
|
|
5
4
|
require File.dirname(File.expand_path(__FILE__)) + '/requests_queue'
|
6
5
|
require File.dirname(File.expand_path(__FILE__)) + '/simple_requests_queue'
|
@@ -33,6 +32,8 @@ module NethttpAb
|
|
33
32
|
|
34
33
|
def follow_links=(flag)
|
35
34
|
@follow_links = flag
|
35
|
+
# we could follow links on the pages if there's --follow-links=2 option
|
36
|
+
require 'nokogiri' if @follow_links
|
36
37
|
end
|
37
38
|
|
38
39
|
def url=(link)
|
@@ -72,6 +73,9 @@ module NethttpAb
|
|
72
73
|
rescue Errno::ECONNREFUSED => e
|
73
74
|
puts("Connection error, please check your internet connection or make sure the server is running (it's local)")
|
74
75
|
exit
|
76
|
+
rescue SocketError => e
|
77
|
+
puts e.message
|
78
|
+
exit
|
75
79
|
end
|
76
80
|
|
77
81
|
req = Net::HTTP::Get.new(@url.path)
|
@@ -93,10 +97,13 @@ module NethttpAb
|
|
93
97
|
begin
|
94
98
|
http_opened_session = get_http_session(@url)
|
95
99
|
rescue OpenSSL::SSL::SSLError => e
|
96
|
-
puts
|
100
|
+
puts "The url you provided is wrong, please check is it really ssl encrypted"
|
97
101
|
exit
|
98
102
|
rescue Errno::ECONNREFUSED => e
|
99
|
-
puts
|
103
|
+
puts "Connection error, please check your internet connection or make sure the server is running (it's local)"
|
104
|
+
exit
|
105
|
+
rescue SocketError => e
|
106
|
+
puts e.message
|
100
107
|
exit
|
101
108
|
end
|
102
109
|
|
data/nethttp_ab.gemspec
CHANGED
@@ -2,26 +2,24 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{nethttp_ab}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.2"
|
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.
|
10
|
-
s.date = %q{2011-04-05}
|
9
|
+
s.date = %q{2011-04-06}
|
11
10
|
s.default_executable = %q{nethttp_ab}
|
12
|
-
s.description = %q{Simple tool to benchmark sites}
|
11
|
+
s.description = %q{Simple tool to test and benchmark sites}
|
13
12
|
s.email = %q{germaninthetown@gmail.com}
|
14
13
|
s.executables = ["nethttp_ab"]
|
15
|
-
s.extra_rdoc_files = ["README", "bin/nethttp_ab", "lib/net.rb", "lib/requester.rb", "lib/requests_queue.rb", "lib/simple_requests_queue.rb"]
|
16
|
-
s.files = ["README", "Rakefile", "bin/nethttp_ab", "lib/net.rb", "lib/requester.rb", "lib/requests_queue.rb", "lib/simple_requests_queue.rb", "test/nethttp_ab_test.rb", "test/requests_queue_test.rb", "test/resources/index.html", "test/simple_requests_queue_test.rb"
|
14
|
+
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "bin/nethttp_ab", "lib/net.rb", "lib/requester.rb", "lib/requests_queue.rb", "lib/simple_requests_queue.rb"]
|
15
|
+
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "bin/nethttp_ab", "lib/net.rb", "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/index.html", "test/simple_requests_queue_test.rb"]
|
17
16
|
s.homepage = %q{http://github.com/german/nethttp_ab}
|
18
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Nethttp_ab", "--main", "README"]
|
19
18
|
s.require_paths = ["lib"]
|
20
19
|
s.rubyforge_project = %q{nethttp_ab}
|
21
20
|
s.rubygems_version = %q{1.6.2}
|
22
|
-
s.
|
23
|
-
s.
|
24
|
-
s.test_files = ["test/simple_requests_queue_test.rb", "test/requests_queue_test.rb", "test/nethttp_ab_test.rb"]
|
21
|
+
s.summary = %q{Simple tool to test and benchmark sites}
|
22
|
+
s.test_files = ["test/nethttp_ab_test.rb", "test/requests_queue_test.rb", "test/simple_requests_queue_test.rb"]
|
25
23
|
|
26
24
|
if s.respond_to? :specification_version then
|
27
25
|
s.specification_version = 3
|
metadata
CHANGED
@@ -1,54 +1,35 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nethttp_ab
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.1
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Dmitrii Samoilov
|
9
9
|
autorequire:
|
10
10
|
b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q4T+
|
28
|
-
6QmqCPwYdpN1hijiEM4miV9osuZYTAnR9IKBakY3tRE1Q7aTTyT4tMmS/GrwY+IB
|
29
|
-
qih6K+1QUvvm0euQNIlHfM0RQ+cgISMezNJRmDtldZTLI5NbSnbO6mW+QoFcKmXz
|
30
|
-
+Zut89O9LtR+kOHx2W1p7eHudOUB4L6lCafXA1O54piyMbYsde8oHmAjW39hKaUo
|
31
|
-
r061XXjdbf9qKeUjTZ6lmWaQMjM=
|
32
|
-
-----END CERTIFICATE-----
|
33
|
-
|
34
|
-
date: 2011-04-05 00:00:00 +03:00
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-04-06 00:00:00.000000000 +03:00
|
35
13
|
default_executable:
|
36
14
|
dependencies: []
|
37
|
-
|
38
|
-
description: Simple tool to benchmark sites
|
15
|
+
description: Simple tool to test and benchmark sites
|
39
16
|
email: germaninthetown@gmail.com
|
40
|
-
executables:
|
17
|
+
executables:
|
41
18
|
- nethttp_ab
|
42
19
|
extensions: []
|
43
|
-
|
44
|
-
|
20
|
+
extra_rdoc_files:
|
21
|
+
- CHANGELOG
|
22
|
+
- LICENSE
|
45
23
|
- README
|
46
24
|
- bin/nethttp_ab
|
47
25
|
- lib/net.rb
|
48
26
|
- lib/requester.rb
|
49
27
|
- lib/requests_queue.rb
|
50
28
|
- lib/simple_requests_queue.rb
|
51
|
-
files:
|
29
|
+
files:
|
30
|
+
- CHANGELOG
|
31
|
+
- LICENSE
|
32
|
+
- Manifest
|
52
33
|
- README
|
53
34
|
- Rakefile
|
54
35
|
- bin/nethttp_ab
|
@@ -56,46 +37,43 @@ files:
|
|
56
37
|
- lib/requester.rb
|
57
38
|
- lib/requests_queue.rb
|
58
39
|
- lib/simple_requests_queue.rb
|
40
|
+
- nethttp_ab.gemspec
|
59
41
|
- test/nethttp_ab_test.rb
|
60
42
|
- test/requests_queue_test.rb
|
61
43
|
- test/resources/index.html
|
62
44
|
- test/simple_requests_queue_test.rb
|
63
|
-
- Manifest
|
64
|
-
- nethttp_ab.gemspec
|
65
45
|
has_rdoc: true
|
66
46
|
homepage: http://github.com/german/nethttp_ab
|
67
47
|
licenses: []
|
68
|
-
|
69
48
|
post_install_message:
|
70
|
-
rdoc_options:
|
49
|
+
rdoc_options:
|
71
50
|
- --line-numbers
|
72
51
|
- --inline-source
|
73
52
|
- --title
|
74
53
|
- Nethttp_ab
|
75
54
|
- --main
|
76
55
|
- README
|
77
|
-
require_paths:
|
56
|
+
require_paths:
|
78
57
|
- lib
|
79
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
59
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version:
|
85
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
65
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version:
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.2'
|
91
70
|
requirements: []
|
92
|
-
|
93
71
|
rubyforge_project: nethttp_ab
|
94
72
|
rubygems_version: 1.6.2
|
95
73
|
signing_key:
|
96
74
|
specification_version: 3
|
97
|
-
summary: Simple tool to benchmark sites
|
98
|
-
test_files:
|
99
|
-
- test/simple_requests_queue_test.rb
|
100
|
-
- test/requests_queue_test.rb
|
75
|
+
summary: Simple tool to test and benchmark sites
|
76
|
+
test_files:
|
101
77
|
- test/nethttp_ab_test.rb
|
78
|
+
- test/requests_queue_test.rb
|
79
|
+
- test/simple_requests_queue_test.rb
|
data.tar.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
��5�\',�-�Oº� �ۓ���s�*��HKȴH��!�o��>:�=�h�|C�'�\��Ws��s���)���bâΘU�>���o_�uT�Sm/�;��9S�����^�)��P����KO�v�o�g���^ը����L��wU������<cHb��u�*�t0M�u��\�
|
metadata.gz.sig
DELETED
Binary file
|