Created
September 2, 2016 13:37
-
-
Save Lukasa/25c7c7a210d5c5f3b2ef136c1c6bc12f to your computer and use it in GitHub Desktop.
Demonstrate nginx's failings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import ssl | |
import time | |
ctx = ssl.create_default_context() | |
ctx.check_hostname = False | |
ctx.verify_mode = ssl.CERT_NONE | |
TARGET = ('67.205.133.224', 443) | |
def connect_slowly(): | |
print "connecting...", | |
s = socket.create_connection(TARGET) | |
print "connected" | |
print "sleeping...", | |
time.sleep(2) | |
print "slept" | |
s = ctx.wrap_socket(s) | |
s.sendall( | |
b'GET / HTTP/1.1\r\n' | |
b'Host: localhost\r\n' | |
b'\r\n' | |
) | |
connect_slowly() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment