fix voor ssl
This commit is contained in:
parent
6a6d42f402
commit
6fa1a57fda
1 changed files with 30 additions and 18 deletions
|
|
@ -31,6 +31,7 @@ Usage: #{$0.sub(/.*\//, "")} [options] -u <baseurl>
|
||||||
|
|
||||||
-h, --help show this message
|
-h, --help show this message
|
||||||
-u <baseurl> set baseurl
|
-u <baseurl> set baseurl
|
||||||
|
-s use ssl
|
||||||
EOT
|
EOT
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
@ -40,7 +41,8 @@ def cmdline
|
||||||
begin
|
begin
|
||||||
opts = GetoptLong.new(
|
opts = GetoptLong.new(
|
||||||
[ "-h", "--help", GetoptLong::NO_ARGUMENT ],
|
[ "-h", "--help", GetoptLong::NO_ARGUMENT ],
|
||||||
[ "-u", GetoptLong::REQUIRED_ARGUMENT ]
|
[ "-u", GetoptLong::REQUIRED_ARGUMENT ],
|
||||||
|
[ "-s", GetoptLong::NO_ARGUMENT ]
|
||||||
)
|
)
|
||||||
opts.quiet=true
|
opts.quiet=true
|
||||||
|
|
||||||
|
|
@ -67,7 +69,8 @@ def fetch(uri_str, limit = 10)
|
||||||
path = URI.parse(uri_str).path
|
path = URI.parse(uri_str).path
|
||||||
query = URI.parse(uri_str).query
|
query = URI.parse(uri_str).query
|
||||||
|
|
||||||
Net::HTTP.start(host, port) {|http|
|
http = Net::HTTP.new(host, port)
|
||||||
|
http.use_ssl = @use_ssl
|
||||||
if query
|
if query
|
||||||
req = Net::HTTP::Get.new("#{URI.escape(path)}?#{URI.escape(query)}")
|
req = Net::HTTP::Get.new("#{URI.escape(path)}?#{URI.escape(query)}")
|
||||||
else
|
else
|
||||||
|
|
@ -80,10 +83,10 @@ def fetch(uri_str, limit = 10)
|
||||||
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
|
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
|
||||||
when Net::HTTPNotFound then puts "404 Not Found #{uri_str}"; response.error!
|
when Net::HTTPNotFound then puts "404 Not Found #{uri_str}"; response.error!
|
||||||
when Net::HTTPUnauthorized then puts "401 Authorization Required #{uri_str}"; response.error!
|
when Net::HTTPUnauthorized then puts "401 Authorization Required #{uri_str}"; response.error!
|
||||||
|
when Net::HTTPUnauthorized then puts "401 Authorization Required #{uri_str}"; response.error!
|
||||||
else
|
else
|
||||||
response.error!
|
response.error!
|
||||||
end
|
end
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def svnparse(url)
|
def svnparse(url)
|
||||||
|
|
@ -153,6 +156,7 @@ def cvsparse(url)
|
||||||
begin
|
begin
|
||||||
body = fetch("#{url}/CVS/Entries").body
|
body = fetch("#{url}/CVS/Entries").body
|
||||||
rescue
|
rescue
|
||||||
|
p $!
|
||||||
end
|
end
|
||||||
dirs = Array.new
|
dirs = Array.new
|
||||||
body.each{|line|
|
body.each{|line|
|
||||||
|
|
@ -174,6 +178,12 @@ if options["-u"].nil?
|
||||||
usage
|
usage
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if options["-s"]
|
||||||
|
@use_ssl = true
|
||||||
|
else
|
||||||
|
@use_ssl = false
|
||||||
|
end
|
||||||
|
|
||||||
mode=nil
|
mode=nil
|
||||||
|
|
||||||
# first test for subversion entries
|
# first test for subversion entries
|
||||||
|
|
@ -182,6 +192,7 @@ if mode.nil?
|
||||||
body = fetch("#{options["-u"]}/.svn/entries").body
|
body = fetch("#{options["-u"]}/.svn/entries").body
|
||||||
mode="subversion"
|
mode="subversion"
|
||||||
rescue
|
rescue
|
||||||
|
p $!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -191,6 +202,7 @@ if mode.nil?
|
||||||
body = fetch("#{options["-u"]}/CVS/Entries").body
|
body = fetch("#{options["-u"]}/CVS/Entries").body
|
||||||
mode="cvs"
|
mode="cvs"
|
||||||
rescue
|
rescue
|
||||||
|
p $!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue