#NEWLINE# def prepare_server_https( self , port , temp = False ) : #NEWLINE# #INDENT# 'Prepare the server for HTTPS.\n\n        Make sure that the ssl_module is loaded and that the server\n        is appropriately listening on port.\n\n        :param str port: Port to listen on\n\n        ' #NEWLINE# self . prepare_https_modules ( temp ) #NEWLINE# listens = [ self . parser . get_arg ( x ) . split ( ) [ 0 ] for x in self . parser . find_dir ( 'Listen' ) ] #NEWLINE# if ( not listens ) : #NEWLINE# #INDENT# listens = [ '80' ] #NEWLINE# #UNINDENT# if ( port in listens ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# for listen in listens : #NEWLINE# #INDENT# if ( len ( listen . split ( ':' ) ) == 1 ) : #NEWLINE# #INDENT# if ( port not in listens ) : #NEWLINE# #INDENT# if ( port == '443' ) : #NEWLINE# #INDENT# args = [ port ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# args = [ port , 'https' ] #NEWLINE# #UNINDENT# self . parser . add_dir_to_ifmodssl ( parser . get_aug_path ( self . parser . loc [ 'listen' ] ) , 'Listen' , args ) #NEWLINE# self . save_notes += ( 'Added Listen %s directive to %s\n' % ( port , self . parser . loc [ 'listen' ] ) ) #NEWLINE# listens . append ( port ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( _ , ip ) = listen [ : : ( - 1 ) ] . split ( ':' , 1 ) #NEWLINE# ip = ip [ : : ( - 1 ) ] #NEWLINE# if ( ( '%s:%s' % ( ip , port ) ) not in listens ) : #NEWLINE# #INDENT# if ( port == '443' ) : #NEWLINE# #INDENT# args = [ ( '%s:%s' % ( ip , port ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# args = [ ( '%s:%s' % ( ip , port ) ) , 'https' ] #NEWLINE# #UNINDENT# self . parser . add_dir_to_ifmodssl ( parser . get_aug_path ( self . parser . loc [ 'listen' ] ) , 'Listen' , args ) #NEWLINE# self . save_notes += ( 'Added Listen %s:%s directive to %s\n' % ( ip , port , self . parser . loc [ 'listen' ] ) ) #NEWLINE# listens . append ( ( '%s:%s' % ( ip , port ) ) )