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;
|
||||
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.
|
||||
1
makefile
1
makefile
|
|
@ -12,6 +12,7 @@ clean:
|
|||
rm *.c
|
||||
rm *.o
|
||||
rm *.sym
|
||||
rm http
|
||||
|
||||
test: http
|
||||
./http
|
||||
Loading…
Add table
Add a link
Reference in a new issue