summaryrefslogtreecommitdiff
path: root/lib/gitlab_net.rb
diff options
context:
space:
mode:
authorMichael <michael@fallo.ws>2013-03-10 06:05:23 -0700
committerMichael <michael@fallo.ws>2013-03-10 06:05:23 -0700
commit4bbda0b2590fc5081638c113c7cf74b60c8680b2 (patch)
tree69023666966e396663ee13c52e3b4b2edbf535a4 /lib/gitlab_net.rb
parent381f4cdb0e5c625dc3def0bc66085dcb0ccd4efc (diff)
parentfc8bd8f760fac40287681894dfd9a45e8c4d0517 (diff)
downloadgitlab-shell-4bbda0b2590fc5081638c113c7cf74b60c8680b2.tar.gz
Merge pull request #1 from gitlabhq/master
Master Sync
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r--lib/gitlab_net.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index a7d32cd..cc2c5a6 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -6,7 +6,9 @@ require_relative 'gitlab_config'
class GitlabNet
def allowed?(cmd, repo, key, ref)
project_name = repo.gsub("'", "")
- project_name = project_name.gsub(/\.git$/, "")
+ project_name = project_name.gsub(/\.git\Z/, "")
+ project_name = project_name.gsub(/\A\//, "")
+
key_id = key.gsub("key-", "")
url = "#{host}/allowed?key_id=#{key_id}&action=#{cmd}&ref=#{ref}&project=#{project_name}"
@@ -33,6 +35,10 @@ class GitlabNet
end
def get(url)
- Net::HTTP.get_response(URI.parse(url))
+ url = URI.parse(url)
+ http = Net::HTTP.new(url.host, url.port)
+ http.use_ssl = (url.port == 443)
+ request = Net::HTTP::Get.new(url.request_uri)
+ http.start {|http| http.request(request) }
end
end