The code tells itself what it does. On all pages I tested I get status code 400. I tried to specify the certificate or SSL version too but the result is the same. I tried both closed and keep-alive as Connection for the msg sent.
import ssl,socket
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
page='google.com'
s=ssl.wrap_socket(s)
s.connect((page,443))
s.send(("GET / HTTP/1.1\r\nHost: "+page+"/\r\n\r\n").encode('UTF-8'))
while True:
data=s.recv(4096)
print(data)
Edit: I removed the / from the Host and it kinda helped, but now I get 301 Moved.