From 6686997ed2b8c23405313b0985cc9ca41db5a831 Mon Sep 17 00:00:00 2001 From: Ruben Shekspir Date: Sat, 23 Feb 2019 10:30:39 +0400 Subject: [PATCH] working get request, for http 1 --- http.Mod | 18 +++++++++--------- makefile | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/http.Mod b/http.Mod index 9d2bec3..e5c1f07 100644 --- a/http.Mod +++ b/http.Mod @@ -1,12 +1,14 @@ MODULE http; IMPORT Internet, Out; -PROCEDURE get(host, port: ARRAY OF CHAR, VAR buff: ARRAY 1000 OF CHAR); +VAR + buff: ARRAY 1000 OF CHAR; +PROCEDURE get(host, port: ARRAY OF CHAR; VAR buff: ARRAY OF CHAR); VAR socket : Internet.Socket; - connected: BOOLEAN; + connectionFlag: BOOLEAN; send: ARRAY 7 OF CHAR; BEGIN - connected := Internet.Connect(host, port, socket); + connectionFlag := Internet.Connect(host, port, socket); send[0] := "G"; send[1] := "E"; send[2] := "T"; @@ -15,15 +17,13 @@ BEGIN send[5] := " "; (* Somewhy it's ignoring the last byte *) - connected := Internet.Write(socket, send); - connected := Internet.Read(socket, buff); + connectionFlag := Internet.Write(socket, send); + connectionFlag := Internet.Read(socket, buff); Internet.Disconnect(socket); - END get; -VAR - buff: ARRAY 1000 OF CHAR + BEGIN - get("google.am", "80", buff); + get("voto.am", "80", buff); Out.String(buff); Out.Ln; END http. \ No newline at end of file diff --git a/makefile b/makefile index fee349c..1e3cddb 100644 --- a/makefile +++ b/makefile @@ -12,6 +12,7 @@ clean: rm *.c rm *.o rm *.sym + rm http test: http ./http \ No newline at end of file