Skip to content

Instantly share code, notes, and snippets.

@Lukasa Lukasa/test.py
Created Sep 2, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.