Alsmost works

This commit is contained in:
Ruben Shekspir 2019-02-19 11:19:59 +04:00
parent 4b5cb0ef76
commit 84b04c2b37
2 changed files with 35 additions and 0 deletions

29
http.Mod Normal file
View file

@ -0,0 +1,29 @@
MODULE http;
IMPORT Internet, Out;
PROCEDURE get(host, port: ARRAY OF CHAR, VAR buff: ARRAY 1000 OF CHAR);
VAR
socket : Internet.Socket;
connected: BOOLEAN;
send: ARRAY 7 OF CHAR;
BEGIN
connected := Internet.Connect(host, port, socket);
send[0] := "G";
send[1] := "E";
send[2] := "T";
send[3] := 0DX;
send[4] := 0AX;
send[5] := " ";
(* Somewhy it's ignoring the last byte *)
connected := Internet.Write(socket, send);
connected := Internet.Read(socket, buff);
Internet.Disconnect(socket);
END get;
VAR
buff: ARRAY 1000 OF CHAR
BEGIN
get("google.am", "80", buff);
Out.String(buff);
Out.Ln;
END http.

View file

@ -4,8 +4,14 @@ VOC = /opt/voc/bin/voc
all:
$(VOC) -s types.Mod sockets.Mod netdb.Mod Internet.Mod stringHelpers.Mod time.Mod IRC.Mod test.Mod -m
http:
$(VOC) -s types.Mod sockets.Mod netdb.Mod Internet.Mod http.Mod -m
clean:
rm *.h
rm *.c
rm *.o
rm *.sym
test: http
./http