mirror of
https://github.com/vishapoberon/vipak.git
synced 2026-04-05 20:42:26 +00:00
working get request, for http 1
This commit is contained in:
parent
84b04c2b37
commit
6686997ed2
2 changed files with 10 additions and 9 deletions
18
http.Mod
18
http.Mod
|
|
@ -1,12 +1,14 @@
|
||||||
MODULE http;
|
MODULE http;
|
||||||
IMPORT Internet, Out;
|
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
|
VAR
|
||||||
socket : Internet.Socket;
|
socket : Internet.Socket;
|
||||||
connected: BOOLEAN;
|
connectionFlag: BOOLEAN;
|
||||||
send: ARRAY 7 OF CHAR;
|
send: ARRAY 7 OF CHAR;
|
||||||
BEGIN
|
BEGIN
|
||||||
connected := Internet.Connect(host, port, socket);
|
connectionFlag := Internet.Connect(host, port, socket);
|
||||||
send[0] := "G";
|
send[0] := "G";
|
||||||
send[1] := "E";
|
send[1] := "E";
|
||||||
send[2] := "T";
|
send[2] := "T";
|
||||||
|
|
@ -15,15 +17,13 @@ BEGIN
|
||||||
send[5] := " ";
|
send[5] := " ";
|
||||||
(* Somewhy it's ignoring the last byte *)
|
(* Somewhy it's ignoring the last byte *)
|
||||||
|
|
||||||
connected := Internet.Write(socket, send);
|
connectionFlag := Internet.Write(socket, send);
|
||||||
connected := Internet.Read(socket, buff);
|
connectionFlag := Internet.Read(socket, buff);
|
||||||
Internet.Disconnect(socket);
|
Internet.Disconnect(socket);
|
||||||
|
|
||||||
END get;
|
END get;
|
||||||
VAR
|
|
||||||
buff: ARRAY 1000 OF CHAR
|
|
||||||
BEGIN
|
BEGIN
|
||||||
get("google.am", "80", buff);
|
get("voto.am", "80", buff);
|
||||||
Out.String(buff);
|
Out.String(buff);
|
||||||
Out.Ln;
|
Out.Ln;
|
||||||
END http.
|
END http.
|
||||||
1
makefile
1
makefile
|
|
@ -12,6 +12,7 @@ clean:
|
||||||
rm *.c
|
rm *.c
|
||||||
rm *.o
|
rm *.o
|
||||||
rm *.sym
|
rm *.sym
|
||||||
|
rm http
|
||||||
|
|
||||||
test: http
|
test: http
|
||||||
./http
|
./http
|
||||||
Loading…
Add table
Add a link
Reference in a new issue