Skip to content

Commit f80d906

Browse files
edsenabredsena
and
edsena
authored
Adding support for SSL backend (brentley#28)
Co-authored-by: edsena <[email protected]>
1 parent faf59b6 commit f80d906

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

app/controllers/application_controller.rb

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class ApplicationController < ActionController::Base
1111
def index
1212
begin
1313
req = Net::HTTP::Get.new(nodejs_uri.to_s)
14-
res = Net::HTTP.start(nodejs_uri.host, nodejs_uri.port) {|http|
14+
res = Net::HTTP.start(nodejs_uri.host, nodejs_uri.port, :use_ssl => nodejs_uri.scheme == 'https') {|http|
1515
http.read_timeout = 2
1616
http.open_timeout = 2
1717
http.request(req)
@@ -25,13 +25,12 @@ def index
2525

2626
rescue => e
2727
logger.error e.message
28-
logger.error e.backtrace.join("\n")
2928
@text = "no backend found"
3029
end
3130

3231
begin
3332
crystalreq = Net::HTTP::Get.new(crystal_uri.to_s)
34-
crystalres = Net::HTTP.start(crystal_uri.host, crystal_uri.port) {|http|
33+
crystalres = Net::HTTP.start(crystal_uri.host, crystal_uri.port, :use_ssl => crystal_uri.scheme == 'https') {|http|
3534
http.read_timeout = 2
3635
http.open_timeout = 2
3736
http.request(crystalreq)
@@ -45,7 +44,6 @@ def index
4544

4645
rescue => e
4746
logger.error e.message
48-
logger.error e.backtrace.join("\n")
4947
@crystal = "no backend found"
5048
end
5149
end
@@ -83,7 +81,6 @@ def expand_url(url)
8381
end
8482
rescue => e
8583
logger.error e.message
86-
logger.error e.backtrace.join("\n")
8784
end
8885

8986
logger.info "expanded #{url} to #{uri}"

0 commit comments

Comments
 (0)