Giff Networking - Owen2k6/GoOS GitHub Wiki

Networking (HTTP only)

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 with Connection: close.

Commands

netGet "url", "destPath"

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.

netGetText "url", varName

Downloads as bytes, decodes as UTF-8 (fallback ASCII), stores into varName. Also sets net_status and net_size as above.

URL forms

  • Accepts "http://host[:port]/path"; if missing scheme, http:// is assumed.
  • Invalid URL → net_status = "invalid url".

Examples

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";
⚠️ **GitHub.com Fallback** ⚠️