@@ -53,20 +53,19 @@ def run
53
53
unless res
54
54
fail_with ( Failure ::Unreachable , 'Failed to receive a reply from the server.' )
55
55
end
56
- if res . code == 200
57
- print_good ( 'Server reachable.' )
58
- else
56
+ unless res . code == 200
59
57
fail_with ( Failure ::UnexpectedReply , 'Unexpected reply from the target.' )
60
58
end
59
+ print_good ( 'Server reachable.' )
61
60
62
61
raw_res = res . to_s
63
- if raw_res =~ /JSESSIONID=(\w +);/
64
- jsessionid = ::Regexp . last_match ( 1 )
65
- print_status ( "JSESSIONID value: #{ jsessionid } " )
66
- else
62
+ unless raw_res =~ /JSESSIONID=(\w +);/
67
63
fail_with ( Failure ::UnexpectedReply , 'JSESSIONID not found.' )
68
64
end
69
65
66
+ jsessionid = ::Regexp . last_match ( 1 )
67
+ print_status ( "JSESSIONID value: #{ jsessionid } " )
68
+
70
69
res = send_request_cgi (
71
70
'method' => 'GET' ,
72
71
'uri' => normalize_uri ( target_uri . path , "workflow/jsp/logon.jsp;jsessionid=#{ jsessionid } " ) ,
@@ -86,12 +85,6 @@ def run
86
85
87
86
token_value = ::Regexp . last_match ( 1 )
88
87
print_status ( "FCWEB.FORM.TOKEN value: #{ token_value } " )
89
- # if body =~ /name="FCWEB\.FORM\.TOKEN" value="([^"]+)"/
90
- # token_value = ::Regexp.last_match(1)
91
- # print_status("FCWEB.FORM.TOKEN value: #{token_value}")
92
- # else
93
- # fail_with(Failure::UnexpectedReply, 'FCWEB.FORM.TOKEN not found.')
94
- # end
95
88
96
89
res = send_request_cgi (
97
90
'method' => 'GET' ,
@@ -228,13 +221,13 @@ def run
228
221
fail_with ( Failure ::Unreachable , 'Failed to receive a reply from the server.' ) unless res
229
222
230
223
body = res . body
231
- if body =~ /name="FCWEB\. FORM\. TOKEN" value="([^"]+)"/
232
- token_value = ::Regexp . last_match ( 1 )
233
- print_status ( "FCWEB.FORM.TOKEN value: #{ token_value } " )
234
- else
224
+ unless body =~ /name="FCWEB\. FORM\. TOKEN" value="([^"]+)"/
235
225
fail_with ( Failure ::UnexpectedReply , 'FCWEB.FORM.TOKEN not found.' )
236
226
end
237
227
228
+ token_value = ::Regexp . last_match ( 1 )
229
+ print_status ( "FCWEB.FORM.TOKEN value: #{ token_value } " )
230
+
238
231
res = send_request_cgi (
239
232
'method' => 'POST' ,
240
233
'uri' => normalize_uri ( target_uri . path , 'workflow/logon.do' ) ,
0 commit comments