Skip to content

Commit b236187

Browse files
kernelsmithzeroSteiner
authored andcommitted
restores proper -u usage
1 parent 7d896ba commit b236187

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

plugins/request.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ def parse_args_http(args = [], type = 'http')
127127
when '-o'
128128
options[:output_file] = File.expand_path(val)
129129
when '-u'
130-
options[:auth_username] = val
130+
val = val.split(':', 2) # only split on first ':' as per curl:
131+
# from curl man page: "The user name and passwords are split up on the
132+
# first colon, which makes it impossible to use a colon in the user
133+
# name with this option. The password can, still.
134+
options[:auth_username] = val.first
135+
options[:auth_password] = val.last
131136
when '-p'
132137
options[:auth_password] = val
133138
when '-X'
@@ -186,8 +191,6 @@ def handle_request_http(opts, opt_parser)
186191
print_error('The connection was reset by the peer')
187192
rescue ::EOFError, Errno::ETIMEDOUT, Rex::ConnectionError, ::Timeout::Error
188193
print_error('Encountered an error')
189-
#rescue ::Exception => ex
190-
# print_line("An error of type #{ex.class} happened, message is #{ex.message}")
191194
ensure
192195
http_client.close
193196
end

0 commit comments

Comments
 (0)