/usr/lib/s9fes/help/sys_inet-connect is in scheme9 2010.11.13-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | S9 EXT (sys:inet-connect string1 string2) ==> integer
Create a fresh client socket and connect it to host STRING1,
service STRING2. Return a file descriptor for accessing the
new socket.
; Fetch HTML page "url" from HTTP server "host", port "port"
;
(define (http-fetch host url port)
(let* ((s (sys:inet-connect host port))
(in (sys:make-input-port s))
(out (sys:make-output-port s)))
(display* out "GET http://" host "/" url " HTTP/1.0" #\newline #\newline)
(sys:flush out)
(let in-loop ((line (read-line in))
(page '()))
(cond ((eof-object? line)
(close-input-port in)
(close-output-port out)
(reverse page))
(else
(in-loop (read-line in)
(cons line page)))))))
|