python: Check protocol is None

This commit is contained in:
Tatsuhiro Tsujikawa 2015-08-03 16:49:09 +09:00
parent 0481d44c69
commit 388285675b
1 changed files with 1 additions and 1 deletions

View File

@ -1268,7 +1268,7 @@ if asyncio:
if ssl_ctx: if ssl_ctx:
protocol = sock.selected_npn_protocol() protocol = sock.selected_npn_protocol()
logging.info('npn, protocol:%s', protocol) logging.info('npn, protocol:%s', protocol)
if protocol.encode('utf-8') != \ if protocol is None or protocol.encode('utf-8') != \
cnghttp2.NGHTTP2_PROTO_VERSION_ID: cnghttp2.NGHTTP2_PROTO_VERSION_ID:
self.transport.abort() self.transport.abort()
return return