When I set the proxy with server.py and browse https://www.google.com, it outputs the 501 error.
I find the problem is causing by the below
# when self.uri = www.google.com:443,
# parsed is ParseResult(scheme='www.google.com', netloc='', path='443', params='', query='', fragment='')
parsed = urlparse.urlparse(self.uri)
And I change the code to below, it runs without any problem.
uri = self.uri if self.uri.startswith('https://') else 'https://' + self.uri
parsed = urlparse.urlparse(uri)