You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2020/10/24 19:17:52 UTC

[whimsy] branch master updated: typo, better default for port, try a different way to bypass certificate verification

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new eece912  typo, better default for port, try a different way to bypass certificate verification
eece912 is described below

commit eece9124d40a4f8fa86c0e2f1b2d3d536a0f2249
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Oct 24 15:17:15 2020 -0400

    typo, better default for port, try a different way to bypass certificate
    verification
---
 www/board/agenda/daemon/wsc.rb | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/www/board/agenda/daemon/wsc.rb b/www/board/agenda/daemon/wsc.rb
index 5b49e73..b54e0a7 100644
--- a/www/board/agenda/daemon/wsc.rb
+++ b/www/board/agenda/daemon/wsc.rb
@@ -24,7 +24,7 @@ options.host = 'whimsy.local'
 options.path = '/board/agenda/websocket/'
 options.user = Etc.getlogin
 options.restart = false
-options.verfify = true
+options.verify = true
 
 opt_parser = OptionParser.new do |opts|
   opts.banner = "Usage: #{File.basename(__FILE__)} [options]"
@@ -60,8 +60,9 @@ end
 
 opt_parser.parse!(ARGV)
 
-options.port ||= (options.host.include?('whimsy') ? 80 : 34234)
 options.protocol ||= (options.host.include?('local') ? 'ws' : 'wss')
+options.port ||= 34234 if options.path=='/'
+options.port ||= (options.protocol == 'ws' ? 80 : 443)
 
 ########################################################################
 #                         Connect to WebSocket                         #
@@ -94,12 +95,13 @@ EM.run do
       path = File.expand_path('../session.json', options.path)
       request = Net::HTTP::Get.new(path)
       request.basic_auth options.user, password
-      ssl = {use_ssl: options.protocol == 'wss'}
 
-      response = Net::HTTP.start(options.host, options.port, ssl) do |http|
+      http = Net::HTTP.new(options.host, options.port)
+      if options.protocol == 'wss'
+        http.use_ssl = true
         http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless options.verify
-        http.request(request)
       end
+      response = http.request(request)
 
       if Net::HTTPOK === response
         session = JSON.parse(response.body)['session']