v / examples
Raw file
		
1// Simple raw HTTP head request
2import net
3import time
4import io
5
6fn main() {
7 // Make a new connection
8 mut conn := net.dial_tcp('google.com:80')?
9 // Simple http HEAD request for a file
10 conn.write_string('GET /index.html HTTP/1.0\r\n\r\n')?
11 // Wrap in a buffered reader
12 mut r := io.new_buffered_reader(reader: conn)
13 for {
14 l := r.read_line() or { break }
15 println('$l')
16 // Make it nice and obvious that we are doing this line by line
17 time.sleep(100 * time.millisecond)
18 }
19}