https instead of http on initial startup with certificates, issue 783, thanks shivakumar.

This commit is contained in:
Massimo Di Pierro
2012-05-10 22:22:27 -05:00
parent 409ce3f51e
commit f8b4e40d22
2 changed files with 22 additions and 8 deletions
+1 -1
View File
@@ -1 +1 @@
Version 1.99.7 (2012-05-10 18:20:22) dev
Version 1.99.7 (2012-05-10 22:21:22) dev
+21 -7
View File
@@ -100,12 +100,13 @@ def try_start_browser(url):
print 'warning: unable to detect your browser'
def start_browser(ip, port):
def start_browser(proto, ip, port):
""" Starts the default browser """
print 'please visit:'
print '\thttp://%s:%s' % (ip, port)
url = '%s://%s:%s' % (proto, ip, port)
print '\t', url
print 'starting browser...'
try_start_browser('http://%s:%s' % (ip, port))
try_start_browser(url)
def presentation(root):
@@ -366,10 +367,16 @@ class web2pyDialog(object):
except:
return self.error('invalid port number')
self.url = 'http://%s:%s' % (ip, port)
# Check for non default value for ssl inputs
if (len(self.options.ssl_certificate) > 0) or (len(self.options.ssl_private_key) > 0):
proto = 'https'
else:
proto = 'http'
self.url = '%s://%s:%s' % (proto, ip, port)
self.connect_pages()
self.button_start.configure(state='disabled')
try:
options = self.options
req_queue_size = options.request_queue_size
@@ -399,7 +406,7 @@ class web2pyDialog(object):
self.button_stop.configure(state='normal')
if not options.taskbar:
thread.start_new_thread(start_browser, (ip, port))
thread.start_new_thread(start_browser, (proto, ip, port))
self.password.configure(state='readonly')
self.ip.configure(state='readonly')
@@ -981,9 +988,16 @@ def start(cron=True):
(ip, port) = (options.ip, int(options.port))
# Check for non default value for ssl inputs
if (len(self.options.ssl_certificate) > 0) or (len(self.options.ssl_private_key) > 0):
proto = 'https'
else:
proto = 'http'
url = '%s://%s:%s' % (proto, ip, port)
if not options.nobanner:
print 'please visit:'
print '\thttp://%s:%s' % (ip, port)
print '\t', url
print 'use "kill -SIGTERM %i" to shutdown the web2py server' % os.getpid()
server = main.HttpServer(ip=ip,