From e9f413ef676cf2e605bf0183ef39e8bb1cad368e Mon Sep 17 00:00:00 2001 From: Tomasz Polgrabia <tomasz@polgrabia.me> Date: Sat, 8 Mar 2025 10:48:52 +0100 Subject: [PATCH] Julia simple raw HTTP/1.1 connection as client. --- current/samples/julia/net.jl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 current/samples/julia/net.jl diff --git a/current/samples/julia/net.jl b/current/samples/julia/net.jl new file mode 100644 index 0000000..138dab4 --- /dev/null +++ b/current/samples/julia/net.jl @@ -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