---
title: "Pelican Wings: downloads without Content-Length in Go"
description: "In Pelican Wings, in Go, pulling a file from a URL works without a Content-Length header, and the disk limit is checked while writing to a temporary file."
url: "https://vulcode.com/en/opensource/contributions/pelican-wings"
lang: "en"
---

[All contributions](https://vulcode.com/en/opensource/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.

[See the repository](https://github.com/pelican/wings) [All contributions](https://vulcode.com/en/opensource/contributions)

- **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](https://github.com/pelican/wings/pull/216)

## Merged change 1

- [#216 fix(downloader): allow remote downloads without a Content-Length Merged 19 November 2026](https://github.com/pelican/wings/pull/216)

## 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](https://vulcode.com/en/technologies/go)

## Other projects we write code for

- [**urfave/cli** Go · 24,329 stars A declarative Go package for building command line tools.](https://vulcode.com/en/opensource/contributions/urfave-cli)

- [**chezmoi** Go · 22,342 stars A dotfiles manager that keeps the same settings on many different machines, securely.](https://vulcode.com/en/opensource/contributions/chezmoi)

- [**goquery** Go · 14,995 stars A Go library for traversing and changing HTML documents in the style of jQuery, built on the golang.org/x/net/html parser.](https://vulcode.com/en/opensource/contributions/goquery)

- [**Ebitengine** Go · 13,647 stars A 2D game engine in Go, used in games released for computers, phones, browsers and consoles.](https://vulcode.com/en/opensource/contributions/ebiten)

- [**Fission** Go · 8,950 stars A serverless functions framework for Kubernetes that runs code as functions and scales them down to zero when they are idle.](https://vulcode.com/en/opensource/contributions/fission)

- [**Concourse** Go · 7,944 stars A container-based automation system written in Go and used mostly for CI/CD. Pipelines and tasks are described in YAML files.](https://vulcode.com/en/opensource/contributions/concourse)

## Describe your project.

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

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)
