Giff Networking - Owen2k6/GoOS GitHub Wiki
Giff provides a minimal HTTP client suitable for Cosmos:
-
Only
http://
is supported.https://
will set status to"https not supported"
. - DNS is resolved via GoOS/Cosmos DNS settings (
DNSConfig.DNSNameservers[0]
). - User-Agent:
GoOS-Giff/<version>
. - Connection:
HTTP/1.0
withConnection: close
.
Downloads bytes to a file. On success:
net_status = "ok"
net_size = "<bytes>"
On failure:
net_status = <error string>
net_size = "0"
- Also shows a dialogue with the error.
Downloads as bytes, decodes as UTF-8 (fallback ASCII), stores into varName
. Also sets net_status
and net_size
as above.
- Accepts
"http://host[:port]/path"
; if missing scheme,http://
is assumed. - Invalid URL →
net_status = "invalid url"
.
netGetText "example.com/index.txt", page;
if "$net_status == ok" {
message "Downloaded $net_size bytes";
fileWrite "0:\\page.txt", "$page";
} else {
message "Failed: $net_status";
}
netGet "http://example.com/icon.bin", "0:\\icon.bin";
message "GET status: $net_status, size: $net_size";