Created
February 28, 2020 16:17
-
-
Save rdeioris/dc05e63c2f61bfd757bd9270bc651a05 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
#s.connect(('towel.blinkenlights.nl', 23)) | |
s.connect(('aiv01.it', 80)) | |
first_line = 'GET /corsi/programmazione HTTP/1.0\r\n' | |
first_header = 'Host: aiv01.it\r\n' | |
second_header = 'Connection: close\r\n' | |
third_header = 'Foo: Bar\r\n' | |
empty_line = '\r\n' | |
s.send((first_line+first_header+second_header + | |
third_header+empty_line).encode('ascii')) | |
while True: | |
data = s.recv(4096) | |
if not data: | |
break | |
print(data,) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment