Skip to content

Instantly share code, notes, and snippets.

@Lukasa
Created September 2, 2016 13:37
Show Gist options
  • Save Lukasa/25c7c7a210d5c5f3b2ef136c1c6bc12f to your computer and use it in GitHub Desktop.
Save Lukasa/25c7c7a210d5c5f3b2ef136c1c6bc12f to your computer and use it in GitHub Desktop.
Demonstrate nginx's failings
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