minor fixes

This commit is contained in:
Ward Wouts 2007-07-24 21:28:01 +00:00
parent 24c26f957f
commit 9a8e7fa0d8

View file

@ -63,11 +63,16 @@ def fetch(uri_str, limit = 10)
raise ArgumentError, 'HTTP redirect too deep' if limit == 0 raise ArgumentError, 'HTTP redirect too deep' if limit == 0
host = URI.parse(uri_str).host host = URI.parse(uri_str).host
port = URI.parse(uri_str).port
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) {|http| Net::HTTP.start(host, port) {|http|
req = Net::HTTP::Get.new("#{path}?#{query}") if query
req = Net::HTTP::Get.new("#{URI.escape(path)}?#{URI.escape(query)}")
else
req = Net::HTTP::Get.new("#{URI.escape(path)}")
end
req.basic_auth @user, @pass req.basic_auth @user, @pass
response = http.request(req) response = http.request(req)
case response case response
@ -110,6 +115,7 @@ end
def cvsparse(url) def cvsparse(url)
puts "\n#{url}" puts "\n#{url}"
body=[]
begin begin
body = fetch("#{url}/CVS/Entries").body body = fetch("#{url}/CVS/Entries").body
rescue rescue