Skip to content

Instantly share code, notes, and snippets.

@westhood
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save westhood/8971012 to your computer and use it in GitHub Desktop.

Select an option

Save westhood/8971012 to your computer and use it in GitHub Desktop.
Use npn to test if the site supports spdy protocol
import ssl
import socket
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.set_npn_protocols(["http/1.1", "spdy/3"])
sock = socket.socket()
ssl_sock = context.wrap_socket(sock)
ssl_sock.connect(("www.google.com", 443))
print(ssl_sock.selected_npn_protocol())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment