Julia simple raw HTTP/1.1 connection as client.
parent
37a2d5c5f4
commit
e9f413ef67
|
@ -0,0 +1,15 @@
|
|||
import Sockets as s;
|
||||
|
||||
scon = s.connect("www.google.com", 80)
|
||||
write(scon, "GET / HTTP/1.1\r\n")
|
||||
write(scon, "Host: www.google.com\r\n")
|
||||
write(scon, "User-Agent: bot\r\n")
|
||||
write(scon, "Connection: close\r\n")
|
||||
write(scon, "\r\n")
|
||||
|
||||
bytes = read(scon)
|
||||
response = String(bytes)
|
||||
|
||||
for line in split(response, "\r\n")
|
||||
print("Response line " * line * "\r\n")
|
||||
end
|
Loading…
Reference in New Issue