blitz 0.1.20 → 0.1.21
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/Gemfile +7 -2
- data/Gemfile.lock +8 -1
- data/README.md +26 -0
- data/Rakefile +5 -5
- data/blitz.gemspec +21 -10
- data/lib/blitz.rb +2 -1
- data/lib/blitz/command.rb +2 -32
- data/lib/blitz/command/curl.rb +13 -195
- data/lib/blitz/curl.rb +226 -0
- data/lib/blitz/curl/error.rb +1 -1
- data/lib/blitz/curl/rush.rb +12 -19
- data/lib/blitz/curl/sprint.rb +13 -17
- data/lib/blitz/utils.rb +38 -0
- data/spec/blitz/client_spec.rb +57 -0
- data/spec/blitz/command/api_spec.rb +42 -0
- data/spec/blitz/command/curl_spec.rb +4 -0
- data/spec/blitz/curl/rush_spec.rb +89 -0
- data/spec/blitz/curl/sprint_spec.rb +86 -0
- data/spec/blitz/curl_spec.rb +242 -0
- data/spec/spec_helper.rb +13 -0
- metadata +29 -26
- data/spec/command/curl_spec.rb +0 -244
data/Gemfile
CHANGED
@@ -8,9 +8,8 @@ gem "rest-client", "~> 1.6.1"
|
|
8
8
|
gem "json", "~> 1.5.1"
|
9
9
|
gem "json_pure", "~> 1.5.1"
|
10
10
|
gem "hexy", "~> 0.1.1"
|
11
|
-
gem 'rspec', '~> 2.6'
|
12
|
-
gem 'rspec-core', '~> 2.6'
|
13
11
|
gem 'term-ansicolor', '1.0.5'
|
12
|
+
gem 'rake', '0.9.0'
|
14
13
|
|
15
14
|
# Add dependencies to develop your gem here.
|
16
15
|
# Include everything needed to run rake, tests, features, etc.
|
@@ -19,3 +18,9 @@ group :development do
|
|
19
18
|
gem "jeweler", "~> 1.5.1"
|
20
19
|
end
|
21
20
|
|
21
|
+
group :test do
|
22
|
+
gem 'rspec', '~> 2.6'
|
23
|
+
gem 'rspec-core', '~> 2.6'
|
24
|
+
gem 'simplecov', '>= 0.4.2'
|
25
|
+
end
|
26
|
+
|
data/Gemfile.lock
CHANGED
@@ -15,7 +15,8 @@ GEM
|
|
15
15
|
json (1.5.1)
|
16
16
|
json_pure (1.5.1)
|
17
17
|
mime-types (1.16)
|
18
|
-
|
18
|
+
multi_json (1.0.4)
|
19
|
+
rake (0.9.0)
|
19
20
|
rest-client (1.6.1)
|
20
21
|
mime-types (>= 1.16)
|
21
22
|
rspec (2.6.0)
|
@@ -26,6 +27,10 @@ GEM
|
|
26
27
|
rspec-expectations (2.6.0)
|
27
28
|
diff-lcs (~> 1.1.2)
|
28
29
|
rspec-mocks (2.6.0)
|
30
|
+
simplecov (0.5.4)
|
31
|
+
multi_json (~> 1.0.3)
|
32
|
+
simplecov-html (~> 0.5.3)
|
33
|
+
simplecov-html (0.5.3)
|
29
34
|
term-ansicolor (1.0.5)
|
30
35
|
|
31
36
|
PLATFORMS
|
@@ -38,7 +43,9 @@ DEPENDENCIES
|
|
38
43
|
jeweler (~> 1.5.1)
|
39
44
|
json (~> 1.5.1)
|
40
45
|
json_pure (~> 1.5.1)
|
46
|
+
rake (= 0.9.0)
|
41
47
|
rest-client (~> 1.6.1)
|
42
48
|
rspec (~> 2.6)
|
43
49
|
rspec-core (~> 2.6)
|
50
|
+
simplecov (>= 0.4.2)
|
44
51
|
term-ansicolor (= 1.0.5)
|
data/README.md
CHANGED
@@ -33,4 +33,30 @@ will generate tests like this:
|
|
33
33
|
which you can simply copy/paste to the [blitz.io](http://blitz.io). Your
|
34
34
|
CouchDB must be on the public cloud though.
|
35
35
|
|
36
|
+
## Using blitz gem on your application
|
37
|
+
|
38
|
+
You can integrate blitz gem to your application and run tests whenever you want.
|
39
|
+
|
40
|
+
### Sprint
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
require 'blitz'
|
44
|
+
|
45
|
+
...
|
46
|
+
|
47
|
+
result = Blitz::Curl.parse('-r california www.example.com').execute
|
48
|
+
```
|
49
|
+
|
50
|
+
### Rush
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
require 'blitz'
|
54
|
+
|
55
|
+
...
|
56
|
+
|
57
|
+
result = Blitz::Curl.parse('-r california -p 10-50:30 www.example.com').execute do |partial|
|
58
|
+
pp [ partial.region, partial.timeline.last.hits ]
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
36
62
|
Copyright (c) 2011 Mu Dynamics. See LICENSE.txt for further details.
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'bundler'
|
5
5
|
begin
|
6
|
-
Bundler.setup(:default, :development)
|
6
|
+
Bundler.setup(:default, :development, :test)
|
7
7
|
rescue Bundler::BundlerError => e
|
8
8
|
$stderr.puts e.message
|
9
9
|
$stderr.puts "Run `bundle install` to install missing gems"
|
@@ -32,11 +32,11 @@ Jeweler::Tasks.new do |gem|
|
|
32
32
|
end
|
33
33
|
Jeweler::RubygemsDotOrgTasks.new
|
34
34
|
|
35
|
+
require 'rspec/core/rake_task'
|
35
36
|
desc "Run all the specs"
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
RSpec::Core::Runner.run [ *Dir.glob('spec/**/*.rb') ]
|
37
|
+
RSpec::Core::RakeTask.new do |t|
|
38
|
+
t.pattern = ENV['file'] || 'spec/**/*_spec.rb'
|
39
|
+
t.rspec_opts = ["--color"]
|
40
40
|
end
|
41
41
|
|
42
42
|
task :default => :spec
|
data/blitz.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{blitz}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.21"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["pcapr"]
|
12
|
-
s.date = %q{2012-
|
12
|
+
s.date = %q{2012-02-07}
|
13
13
|
s.default_executable = %q{blitz}
|
14
14
|
s.description = %q{Make load and performance testing a fun sport}
|
15
15
|
s.email = %q{support@blitz.io}
|
@@ -37,13 +37,21 @@ Gem::Specification.new do |s|
|
|
37
37
|
"lib/blitz/command/help.rb",
|
38
38
|
"lib/blitz/command/traceroute.rb",
|
39
39
|
"lib/blitz/command/version.rb",
|
40
|
+
"lib/blitz/curl.rb",
|
40
41
|
"lib/blitz/curl/error.rb",
|
41
42
|
"lib/blitz/curl/rush.rb",
|
42
43
|
"lib/blitz/curl/sprint.rb",
|
43
44
|
"lib/blitz/helper.rb",
|
44
45
|
"lib/blitz/traceroute.rb",
|
45
46
|
"lib/blitz/traceroute/error.rb",
|
46
|
-
"
|
47
|
+
"lib/blitz/utils.rb",
|
48
|
+
"spec/blitz/client_spec.rb",
|
49
|
+
"spec/blitz/command/api_spec.rb",
|
50
|
+
"spec/blitz/command/curl_spec.rb",
|
51
|
+
"spec/blitz/curl/rush_spec.rb",
|
52
|
+
"spec/blitz/curl/sprint_spec.rb",
|
53
|
+
"spec/blitz/curl_spec.rb",
|
54
|
+
"spec/spec_helper.rb",
|
47
55
|
"test/helper.rb",
|
48
56
|
"test/test_blitz.rb"
|
49
57
|
]
|
@@ -53,7 +61,13 @@ Gem::Specification.new do |s|
|
|
53
61
|
s.rubygems_version = %q{1.6.2}
|
54
62
|
s.summary = %q{Make load and performance testing a fun sport}
|
55
63
|
s.test_files = [
|
56
|
-
"spec/
|
64
|
+
"spec/blitz/client_spec.rb",
|
65
|
+
"spec/blitz/command/api_spec.rb",
|
66
|
+
"spec/blitz/command/curl_spec.rb",
|
67
|
+
"spec/blitz/curl/rush_spec.rb",
|
68
|
+
"spec/blitz/curl/sprint_spec.rb",
|
69
|
+
"spec/blitz/curl_spec.rb",
|
70
|
+
"spec/spec_helper.rb",
|
57
71
|
"test/helper.rb",
|
58
72
|
"test/test_blitz.rb"
|
59
73
|
]
|
@@ -67,9 +81,8 @@ Gem::Specification.new do |s|
|
|
67
81
|
s.add_runtime_dependency(%q<json>, ["~> 1.5.1"])
|
68
82
|
s.add_runtime_dependency(%q<json_pure>, ["~> 1.5.1"])
|
69
83
|
s.add_runtime_dependency(%q<hexy>, ["~> 0.1.1"])
|
70
|
-
s.add_runtime_dependency(%q<rspec>, ["~> 2.6"])
|
71
|
-
s.add_runtime_dependency(%q<rspec-core>, ["~> 2.6"])
|
72
84
|
s.add_runtime_dependency(%q<term-ansicolor>, ["= 1.0.5"])
|
85
|
+
s.add_runtime_dependency(%q<rake>, ["= 0.9.0"])
|
73
86
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
74
87
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
75
88
|
else
|
@@ -78,9 +91,8 @@ Gem::Specification.new do |s|
|
|
78
91
|
s.add_dependency(%q<json>, ["~> 1.5.1"])
|
79
92
|
s.add_dependency(%q<json_pure>, ["~> 1.5.1"])
|
80
93
|
s.add_dependency(%q<hexy>, ["~> 0.1.1"])
|
81
|
-
s.add_dependency(%q<rspec>, ["~> 2.6"])
|
82
|
-
s.add_dependency(%q<rspec-core>, ["~> 2.6"])
|
83
94
|
s.add_dependency(%q<term-ansicolor>, ["= 1.0.5"])
|
95
|
+
s.add_dependency(%q<rake>, ["= 0.9.0"])
|
84
96
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
85
97
|
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
86
98
|
end
|
@@ -90,9 +102,8 @@ Gem::Specification.new do |s|
|
|
90
102
|
s.add_dependency(%q<json>, ["~> 1.5.1"])
|
91
103
|
s.add_dependency(%q<json_pure>, ["~> 1.5.1"])
|
92
104
|
s.add_dependency(%q<hexy>, ["~> 0.1.1"])
|
93
|
-
s.add_dependency(%q<rspec>, ["~> 2.6"])
|
94
|
-
s.add_dependency(%q<rspec-core>, ["~> 2.6"])
|
95
105
|
s.add_dependency(%q<term-ansicolor>, ["= 1.0.5"])
|
106
|
+
s.add_dependency(%q<rake>, ["= 0.9.0"])
|
96
107
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
97
108
|
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
98
109
|
end
|
data/lib/blitz.rb
CHANGED
@@ -6,7 +6,7 @@ require 'pp'
|
|
6
6
|
|
7
7
|
class Blitz # :nodoc:
|
8
8
|
require 'blitz/helper'
|
9
|
-
Version = "0.1.
|
9
|
+
Version = "0.1.21"
|
10
10
|
|
11
11
|
extend Blitz::Helper
|
12
12
|
|
@@ -32,6 +32,7 @@ require 'blitz/client'
|
|
32
32
|
require 'blitz/curl/error'
|
33
33
|
require 'blitz/curl/sprint'
|
34
34
|
require 'blitz/curl/rush'
|
35
|
+
require 'blitz/curl'
|
35
36
|
require 'blitz/traceroute'
|
36
37
|
require 'blitz/traceroute/error'
|
37
38
|
require 'blitz/command'
|
data/lib/blitz/command.rb
CHANGED
@@ -1,40 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
# The default template string contains what was sent and received. Strip
|
4
|
-
# these out since we don't need them
|
5
|
-
unless RUBY_VERSION =~ /^1.9/
|
6
|
-
module Test # :nodoc:
|
7
|
-
module Unit # :nodoc:
|
8
|
-
module Assertions # :nodoc:
|
9
|
-
class AssertionMessage # :nodoc:
|
10
|
-
alias :old_template :template
|
11
|
-
|
12
|
-
def template
|
13
|
-
@template_string = ''
|
14
|
-
@parameters = []
|
15
|
-
old_template
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
else
|
22
|
-
module ::Test::Unit # :nodoc:
|
23
|
-
AssertionFailedError = MiniTest::Assertion
|
24
|
-
end
|
25
|
-
end
|
1
|
+
require 'blitz/utils'
|
26
2
|
|
27
3
|
class Blitz
|
28
4
|
class Command # :nodoc:
|
29
|
-
include Test::Unit::Assertions
|
30
5
|
include Helper
|
31
6
|
include Term::ANSIColor
|
32
|
-
|
33
|
-
def shift key, argv
|
34
|
-
val = argv.shift
|
35
|
-
assert_not_nil(val, "missing value for #{key}")
|
36
|
-
val
|
37
|
-
end
|
7
|
+
include Blitz::Utils
|
38
8
|
end
|
39
9
|
end # Blitz
|
40
10
|
|
data/lib/blitz/command/curl.rb
CHANGED
@@ -6,16 +6,15 @@ class Curl < Command # :nodoc:
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def cmd_run argv
|
9
|
-
|
10
|
-
|
9
|
+
begin
|
10
|
+
test = Blitz::Curl.parse argv
|
11
|
+
rescue "help"
|
11
12
|
return help
|
12
13
|
end
|
13
|
-
|
14
|
-
|
15
|
-
sprint args
|
16
|
-
return
|
14
|
+
if test.class == Blitz::Curl::Sprint
|
15
|
+
sprint test
|
17
16
|
else
|
18
|
-
rush
|
17
|
+
rush test
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
@@ -52,18 +51,18 @@ class Curl < Command # :nodoc:
|
|
52
51
|
puts
|
53
52
|
end
|
54
53
|
|
55
|
-
def sprint
|
54
|
+
def sprint job
|
56
55
|
begin
|
57
|
-
job
|
56
|
+
job.queue
|
58
57
|
error "sprinting from #{yellow(job.region)}"
|
59
58
|
result = job.result
|
60
|
-
print_sprint_result args, result
|
59
|
+
print_sprint_result job.args, result
|
61
60
|
rescue ::Blitz::Curl::Error::Authorize => e
|
62
61
|
authorize_error e
|
63
62
|
rescue ::Blitz::Curl::Error::Step => e
|
64
63
|
error "#{red(e.message)} in step #{e.step}"
|
65
64
|
puts
|
66
|
-
print_sprint_result args, e
|
65
|
+
print_sprint_result job.args, e
|
67
66
|
rescue ::Blitz::Curl::Error::Region => e
|
68
67
|
error "#{red(e.message)}"
|
69
68
|
rescue ::Blitz::Curl::Error => e
|
@@ -131,18 +130,18 @@ class Curl < Command # :nodoc:
|
|
131
130
|
end
|
132
131
|
end
|
133
132
|
|
134
|
-
def rush
|
133
|
+
def rush job
|
135
134
|
continue = true
|
136
135
|
last_index = nil
|
137
136
|
begin
|
138
137
|
[ 'INT', 'STOP', 'HUP' ].each do |s|
|
139
138
|
trap(s) { continue = false }
|
140
139
|
end
|
141
|
-
job
|
140
|
+
job.queue
|
142
141
|
msg "rushing from #{yellow(job.region)}..."
|
143
142
|
puts
|
144
143
|
job.result do |result|
|
145
|
-
print_rush_result args, result, last_index
|
144
|
+
print_rush_result job.args, result, last_index
|
146
145
|
if not result.timeline.empty?
|
147
146
|
last_index = result.timeline.size
|
148
147
|
end
|
@@ -230,187 +229,6 @@ class Curl < Command # :nodoc:
|
|
230
229
|
puts
|
231
230
|
end
|
232
231
|
|
233
|
-
def parse_cli argv
|
234
|
-
hash = { 'steps' => [] }
|
235
|
-
|
236
|
-
while not argv.empty?
|
237
|
-
hash['steps'] << Hash.new
|
238
|
-
step = hash['steps'].last
|
239
|
-
|
240
|
-
while not argv.empty?
|
241
|
-
break if argv.first[0,1] != '-'
|
242
|
-
|
243
|
-
k = argv.shift
|
244
|
-
if [ '-A', '--user-agent' ].member? k
|
245
|
-
step['user-agent'] = shift(k, argv)
|
246
|
-
next
|
247
|
-
end
|
248
|
-
|
249
|
-
if [ '-b', '--cookie' ].member? k
|
250
|
-
step['cookies'] ||= []
|
251
|
-
step['cookies'] << shift(k, argv)
|
252
|
-
next
|
253
|
-
end
|
254
|
-
|
255
|
-
if [ '-d', '--data' ].member? k
|
256
|
-
step['content'] ||= Hash.new
|
257
|
-
step['content']['data'] ||= []
|
258
|
-
v = shift(k, argv)
|
259
|
-
v = File.read v[1..-1] if v =~ /^@/
|
260
|
-
step['content']['data'] << v
|
261
|
-
next
|
262
|
-
end
|
263
|
-
|
264
|
-
if [ '-D', '--dump-header' ].member? k
|
265
|
-
hash['dump-header'] = shift(k, argv)
|
266
|
-
next
|
267
|
-
end
|
268
|
-
|
269
|
-
if [ '-e', '--referer'].member? k
|
270
|
-
step['referer'] = shift(k, argv)
|
271
|
-
next
|
272
|
-
end
|
273
|
-
|
274
|
-
if [ '-h', '--help' ].member? k
|
275
|
-
hash['help'] = true
|
276
|
-
next
|
277
|
-
end
|
278
|
-
|
279
|
-
if [ '-H', '--header' ].member? k
|
280
|
-
step['headers'] ||= []
|
281
|
-
step['headers'].push shift(k, argv)
|
282
|
-
next
|
283
|
-
end
|
284
|
-
|
285
|
-
if [ '-p', '--pattern' ].member? k
|
286
|
-
v = shift(k, argv)
|
287
|
-
v.split(',').each do |vt|
|
288
|
-
unless /^(\d+)-(\d+):(\d+)$/ =~ vt
|
289
|
-
raise Test::Unit::AssertionFailedError, "invalid ramp pattern"
|
290
|
-
end
|
291
|
-
hash['pattern'] ||= { 'iterations' => 1, 'intervals' => [] }
|
292
|
-
hash['pattern']['intervals'] << {
|
293
|
-
'iterations' => 1,
|
294
|
-
'start' => $1.to_i,
|
295
|
-
'end' => $2.to_i,
|
296
|
-
'duration' => $3.to_i
|
297
|
-
}
|
298
|
-
end
|
299
|
-
next
|
300
|
-
end
|
301
|
-
|
302
|
-
if [ '-r', '--region' ].member? k
|
303
|
-
v = shift(k, argv)
|
304
|
-
assert_match(/^california|oregon|virginia|singapore|ireland|japan$/, v, 'region must be one of california, oregon, virginia, singapore, japan or ireland')
|
305
|
-
hash['region'] = v
|
306
|
-
next
|
307
|
-
end
|
308
|
-
|
309
|
-
if [ '-s', '--status' ].member? k
|
310
|
-
step['status'] = shift(k, argv).to_i
|
311
|
-
next
|
312
|
-
end
|
313
|
-
|
314
|
-
if [ '-T', '--timeout' ].member? k
|
315
|
-
step['timeout'] = shift(k, argv).to_i
|
316
|
-
next
|
317
|
-
end
|
318
|
-
|
319
|
-
if [ '-u', '--user' ].member? k
|
320
|
-
step['user'] = shift(k, argv)
|
321
|
-
next
|
322
|
-
end
|
323
|
-
|
324
|
-
if [ '-X', '--request' ].member? k
|
325
|
-
step['request'] = shift(k, argv)
|
326
|
-
next
|
327
|
-
end
|
328
|
-
|
329
|
-
if /-x:c/ =~ k or /--xtract:cookie/ =~ k
|
330
|
-
xname = shift(k, argv)
|
331
|
-
assert_match /^[a-zA-Z_][a-zA-Z_0-9]*$/, xname, "cookie name must be alphanumeric: #{xname}"
|
332
|
-
|
333
|
-
step['xtracts'] ||= Hash.new
|
334
|
-
xhash = step['xtracts'][xname] = { 'type' => 'cookie' }
|
335
|
-
next
|
336
|
-
end
|
337
|
-
|
338
|
-
if /-v:(\S+)/ =~ k or /--variable:(\S+)/ =~ k
|
339
|
-
vname = $1
|
340
|
-
vargs = shift(k, argv)
|
341
|
-
|
342
|
-
assert_match /^[a-zA-Z][a-zA-Z0-9]*$/, vname, "variable name must be alphanumeric: #{vname}"
|
343
|
-
|
344
|
-
step['variables'] ||= Hash.new
|
345
|
-
vhash = step['variables'][vname] = Hash.new
|
346
|
-
if vargs.match /^(list)?\[([^\]]+)\]$/
|
347
|
-
vhash['type'] = 'list'
|
348
|
-
vhash['entries'] = $2.split(',')
|
349
|
-
elsif vargs.match /^(a|alpha)$/
|
350
|
-
vhash['type'] = 'alpha'
|
351
|
-
elsif vargs.match /^(a|alpha)\[(\d+),(\d+)(,(\d+))??\]$/
|
352
|
-
vhash['type'] = 'alpha'
|
353
|
-
vhash['min'] = $2.to_i
|
354
|
-
vhash['max'] = $3.to_i
|
355
|
-
vhash['count'] = $5 ? $5.to_i : 1000
|
356
|
-
elsif vargs.match /^(n|number)$/
|
357
|
-
vhash['type'] = 'number'
|
358
|
-
elsif vargs.match /^(n|number)\[(-?\d+),(-?\d+)(,(\d+))?\]$/
|
359
|
-
vhash['type'] = 'number'
|
360
|
-
vhash['min'] = $2.to_i
|
361
|
-
vhash['max'] = $3.to_i
|
362
|
-
vhash['count'] = $5 ? $5.to_i : 1000
|
363
|
-
elsif vargs.match /^(u|udid)$/
|
364
|
-
vhash['type'] = 'udid'
|
365
|
-
else
|
366
|
-
raise ArgumentError, "Invalid variable args for #{vname}: #{vargs}"
|
367
|
-
end
|
368
|
-
next
|
369
|
-
end
|
370
|
-
|
371
|
-
if [ '-V', '--verbose' ].member? k
|
372
|
-
hash['verbose'] = true
|
373
|
-
next
|
374
|
-
end
|
375
|
-
|
376
|
-
if [ '-1', '--tlsv1' ].member? k
|
377
|
-
step['ssl'] = 'tlsv1'
|
378
|
-
next
|
379
|
-
end
|
380
|
-
|
381
|
-
if [ '-2', '--sslv2' ].member? k
|
382
|
-
step['ssl'] = 'sslv2'
|
383
|
-
next
|
384
|
-
end
|
385
|
-
|
386
|
-
if [ '-3', '--sslv3' ].member? k
|
387
|
-
step['ssl'] = 'sslv3'
|
388
|
-
next
|
389
|
-
end
|
390
|
-
|
391
|
-
raise ArgumentError, "Unknown option #{k}"
|
392
|
-
end
|
393
|
-
|
394
|
-
if step.member? 'content'
|
395
|
-
data_size = step['content']['data'].inject(0) { |m, v| m + v.size }
|
396
|
-
assert(data_size < 10*1024, "POST content must be < 10K")
|
397
|
-
end
|
398
|
-
|
399
|
-
break if hash['help']
|
400
|
-
|
401
|
-
url = argv.shift
|
402
|
-
raise ArgumentError, "no URL specified!" if not url
|
403
|
-
step['url'] = url
|
404
|
-
end
|
405
|
-
|
406
|
-
if not hash['help']
|
407
|
-
if hash['steps'].empty?
|
408
|
-
raise ArgumentError, "no URL specified!"
|
409
|
-
end
|
410
|
-
end
|
411
|
-
|
412
|
-
hash
|
413
|
-
end
|
414
232
|
end # Curl
|
415
233
|
end # Command
|
416
234
|
end # Blitz
|