#NEWLINE# def verify_origin_proto( self , connection_info , origin_proto ) : #NEWLINE# #INDENT# access_url = connection_info . get ( 'access_url' ) #NEWLINE# if ( not access_url ) : #NEWLINE# #INDENT# detail = _ ( 'No access_url in connection_info. Cannot validate protocol' ) #NEWLINE# raise exception . ValidationError ( detail = detail ) #NEWLINE# #UNINDENT# expected_protos = [ urlparse . urlparse ( access_url ) . scheme ] #NEWLINE# if ( 'ws' in expected_protos ) : #NEWLINE# #INDENT# expected_protos . append ( 'http' ) #NEWLINE# #UNINDENT# if ( 'wss' in expected_protos ) : #NEWLINE# #INDENT# expected_protos . append ( 'https' ) #NEWLINE# #UNINDENT# return ( origin_proto in expected_protos )