tdi 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/doc/json/http.json +6 -0
- data/helper/file.rb +1 -1
- data/helper/http.rb +11 -4
- data/lib/tdi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f886ba994177c0f77b060ac037649df1bb770d8
|
4
|
+
data.tar.gz: 3a9d33dca864eab56f7d2a8f4ca87753c696c0ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83fe06b4f51a77b5352432261848afe4da6383bf5ba54fa1c5336b8a0f5745780329c3476b759fef9ee6871b22a4f44866ce229abb93115a493bd6e2fe6eb6c6
|
7
|
+
data.tar.gz: 5abb8268952a0251358153fc043b6ff9e30437830b58b4ee365e0635b925b69167027f58985d55958eb9f6a9badba43956030cc3e2a32ea2b9cbdac87fddb350
|
data/Gemfile.lock
CHANGED
data/doc/json/http.json
CHANGED
data/helper/file.rb
CHANGED
@@ -103,7 +103,7 @@ class TDIPlan < TDI
|
|
103
103
|
|
104
104
|
# Verdict.
|
105
105
|
res_msg = "FILE (#{user}): #{path} => #{perm} #{type} #{location}"
|
106
|
-
res_dict = case_content
|
106
|
+
res_dict = {:path => case_name}.merge(case_content)
|
107
107
|
if @flag_success
|
108
108
|
success role_name, plan_name, res_msg, res_dict
|
109
109
|
else
|
data/helper/http.rb
CHANGED
@@ -41,6 +41,7 @@ class TDIPlan < TDI
|
|
41
41
|
# Params.
|
42
42
|
code = params['code'].nil? ? 200 : params['code'].to_i
|
43
43
|
match = params['match']
|
44
|
+
send_header = params['send_header']
|
44
45
|
expect_header = params['expect_header']
|
45
46
|
timeout_limit = params['timeout'].nil? ? 2 : params['timeout'].to_i
|
46
47
|
|
@@ -57,7 +58,7 @@ class TDIPlan < TDI
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
|
-
return host, port, path, proxy, proxy_port, code, match, expect_header_key, expect_header_value, ssl, timeout_limit
|
61
|
+
return host, port, path, proxy, proxy_port, send_header, code, match, expect_header_key, expect_header_value, ssl, timeout_limit
|
61
62
|
end
|
62
63
|
|
63
64
|
def http(role_name, plan_name, plan_content)
|
@@ -65,7 +66,7 @@ class TDIPlan < TDI
|
|
65
66
|
val.is_a?(Hash)
|
66
67
|
}.each_pair do |case_name, case_content|
|
67
68
|
# Parse params.
|
68
|
-
host, port, path, proxy, proxy_port, code, match, expect_header_key, expect_header_value, ssl, timeout_limit = _parse(case_name, case_content)
|
69
|
+
host, port, path, proxy, proxy_port, send_header, code, match, expect_header_key, expect_header_value, ssl, timeout_limit = _parse(case_name, case_content)
|
69
70
|
|
70
71
|
# User.
|
71
72
|
user = Etc.getpwuid(Process.euid).name
|
@@ -76,8 +77,14 @@ class TDIPlan < TDI
|
|
76
77
|
res_str = case_name
|
77
78
|
res_dict = {url: case_name, net: origin_network(host)}
|
78
79
|
res_dict[:proxy] = "#{proxy}:#{proxy_port}" unless proxy.nil?
|
80
|
+
headers = nil
|
79
81
|
response = nil
|
80
82
|
|
83
|
+
if not send_header.nil?
|
84
|
+
hdr, val = send_header.split(': ')
|
85
|
+
headers = Hash[hdr, val]
|
86
|
+
end
|
87
|
+
|
81
88
|
begin
|
82
89
|
addr = getaddress(host).to_s
|
83
90
|
|
@@ -87,7 +94,7 @@ class TDIPlan < TDI
|
|
87
94
|
Timeout::timeout(timeout_limit) do
|
88
95
|
begin
|
89
96
|
http.start(host, port, use_ssl: ssl, verify_mode: OpenSSL::SSL::VERIFY_NONE) { |http|
|
90
|
-
response = http.get(path)
|
97
|
+
response = http.get(path, headers)
|
91
98
|
}
|
92
99
|
rescue Errno::ECONNREFUSED, Errno::ECONNRESET => e
|
93
100
|
res_msg = "HTTP (#{user}): #{res_str} (#{e.message})"
|
@@ -104,7 +111,7 @@ class TDIPlan < TDI
|
|
104
111
|
Timeout::timeout(timeout_limit) do
|
105
112
|
begin
|
106
113
|
http.start() { |http|
|
107
|
-
response = http.get(path)
|
114
|
+
response = http.get(path, headers)
|
108
115
|
}
|
109
116
|
rescue Errno::ECONNREFUSED, Errno::ECONNRESET => e
|
110
117
|
res_msg = "HTTP (#{user}): #{res_str} (#{e.message})"
|
data/lib/tdi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rogério Carvalho Schneider
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-08-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|