diff options
author | Christoph Helma <helma@in-silico.ch> | 2011-03-09 10:24:49 +0100 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2011-03-09 10:24:49 +0100 |
commit | 1ffb44de021b276d3ae25fc9d9b09ec1f0f9aa16 (patch) | |
tree | e9b271b11b3a602b808693f9d451db092a17b721 /lib/helper.rb | |
parent | 2b0ad7c00ec9559d05e07e78cee5f7846d51ee5f (diff) |
old database config removed
Diffstat (limited to 'lib/helper.rb')
-rw-r--r-- | lib/helper.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/helper.rb b/lib/helper.rb index 37238bd..3031b74 100644 --- a/lib/helper.rb +++ b/lib/helper.rb @@ -42,6 +42,19 @@ helpers do return env['REQUEST_URI'] =~ /\/login$/ end + def uri_available?(urlStr) + url = URI.parse(urlStr) + unless @subjectid + Net::HTTP.start(url.host, url.port) do |http| + return http.head(url.request_uri).code == "200" + end + else + Net::HTTP.start(url.host, url.port) do |http| + return http.post(url.request_uri, "subjectid=#{@subjectid}").code == "202" + end + end + end + end before do |