All contributions

pelican/wings

Pelican Wings

Pelican's daemon that runs each game server in its own Docker container. It provides an HTTP API for server control, logs and backups, plus its own SFTP server. Written in Go.

Language
Go
GitHub stars
334
Merged changes
1

What we changed

Pulling a file to a server from a URL now works when the response does not state its size, for example from raw.githubusercontent.com, from pastebin or with chunked transfer. The disk limit still applies, and if the file does not fit, the existing file stays untouched.

What this work shows

  • HTTP in Go: chunked transfer and gzip
  • Replacing a file only after a successful write
  • Game server disk limits
  • Tests with httptest in Go
What was broken

Downloads rejected responses without a size

Pulling a file from a URL failed with request is missing ContentLength for GitHub and pastebin links. Those servers gzip the response, Go decompresses it on its own and reports the length as -1, and chunked responses have no length at all. The check was there because of the disk limit.

How we fixed it

The disk limit is checked while writing

Filesystem.Write now treats a negative size as unknown: it writes the data to a temporary file under the disk limit and only renames it over the target once done. If the data does not fit, the temporary file goes away and the old file stays as it was. With an unknown size the progress stays at zero until the download finishes, and downloads with a known size work as before. Tests against an httptest server cover gzip, chunked transfer and going over the limit.

#216

Merged change 1

  1. #216 fix(downloader): allow remote downloads without a Content-Length Merged 19 November 2026

What it taught us

We do not remove a safeguard that blocks users, we move it to where it can be enforced: the disk limit is checked while writing to a temporary file, and the target is replaced only after the download succeeds.

More about this technology: Golang

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.