ludic/docs/language/http/http-expected.md
Orkuncakilkaya 43d5eb5b88 feat(launcher): Process.*, Http.save_to/received/expected, App.window_hide/show
Process.spawn/poll/kill/free - non-blocking child processes with no shell: posix_spawn on
macOS (process.ll), CreateProcessW with MSVC-quoted arguments and no console window on
Windows (process_win.ll), linked only when a program uses Process.*.

Http.save_to streams a response body into a file (NSURLSession with a run-time delegate
class on macOS, the WinHTTP read loop on Windows); Http.received / Http.expected report
progress while it is pending. Freeing a pending request cancels it and parks the slot
until the worker has finished.

App.window_hide / App.window_show take the game's window off the screen and back without
closing it; the run goes on while hidden. Docs, examples, tests and a changeset.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 13:32:23 +03:00

25 lines
915 B
Markdown

---
id: http-expected
name: Http.expected
category: http
kind: namespace-method
tokens: Http.expected
sig: Http.expected(handle) -> int
tip: The body length the server announced, or -1.
order: 18
ns: Http
member: expected
---
Returns the length of the response body as the server announced it (<code>Content-Length</code>), or <code>-1</code> while that is not known. For a request given <a href="http-save_to.html"><code>Http.save_to</code></a> it is known as soon as the headers arrive, and stays <code>-1</code> for a reply sent without a length (chunked) — draw an indeterminate bar then. For an ordinary in-memory request it is <code>-1</code> until the reply lands, then the body length.
```ludic
program Demo {
entry {
let h = Http.open("GET", "https://example.com/big.bin")
Http.save_to(h, "big.bin.part")
Http.send(h)
print(Http.expected(h)) # -1: nothing has arrived yet
}
}
```