libraryextensions/http/lib/Http.xtl

Http.xtl -- the facade of the http extension: bounded HTTP GET, text from the web within size, time and redirect limits. Import: "ht:" u_se< "Http" Limits: XETAL_HTTP_MAX bytes (16 MiB), XETAL_HTTP_TIMEOUT seconds (30), 5 redirects; only http:// and https:// URLs. Downloads go under the working directory (or XETAL_HTTP_ROOT). Run with xetal-x (xetal-x --ext DIR puts this directory on XETAL_PATH). Each signature line is written out by the binding macro (lib/Ffi.xtlm).

source · imports ffi: lib/Ffi.xtlm

ˡg̲et : Char -> Char

function · line 13

ht:g_et url: the body as text; a status other than 2xx is an error.

"g_et : text -> text"           ᶠᶠⁱb̲ind< "http/get"
ᶠᶠⁱb̲ind< expands to
ˡg̲et ← { a →
  pa ← a ⎕N̲PUT "ext:http/get?text"
  ⎕N̲GET "ext:http/get"
}

ˡs̲tatus : Unit -> Int

function · line 15

ht:s_tatus @: the last response's status (0 if none came).

"s_tatus : unit -> int"         ᶠᶠⁱb̲ind< "http/status"
ᶠᶠⁱb̲ind< expands to
ˡs̲tatus ← { @ →
  f̲loor f̲irst n̲umbers ⎕N̲GET "ext:http/status"
}

ˡh̲eader : Char -> Char

function · line 17

ht:h_eader "content-type": a header of the last response ("" if absent).

"h_eader : text -> text"        ᶠᶠⁱb̲ind< "http/header"
ᶠᶠⁱb̲ind< expands to
ˡh̲eader ← { a →
  pa ← a ⎕N̲PUT "ext:http/header?text"
  ⎕N̲GET "ext:http/header"
}

ˡs̲ave! : Char -> Char -> Int

function · line 20

url ht:s_ave! "data/x.csv": the body into a file (whole, or not at all); how many bytes.

"s_ave! : text text -> int"     ᶠᶠⁱb̲ind< "http/save"
ᶠᶠⁱb̲ind< expands to
ˡs̲ave! ← { a b →
  pa ← a ⎕N̲PUT "ext:http/save?text"
  pb ← b ⎕N̲PUT "ext:http/save?text"
  f̲loor f̲irst n̲umbers ⎕N̲GET "ext:http/save"
}

ˡpackage : Char

value · line 23

The native package behind these functions.

ˡpackage ← "http"