andrewrk / andrewrk/StaticHttpFileServer

`serve` hangs on multiple TCP connections sending request data out-of-order

Offen
#1 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Zig
Sterne
67
Forks
5
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi, I have found a bug as described in the title. The `serve` command hangs when a client attempts to open multiple connections and decides to send requests out-of-order, which actually seems be the behavior of real web browsers when dealing with multiple calls to the `window.fetch(...)` JS function. I can reproduce it with both the latest Firefox and Chromium.

[This "httptest" repository](https://github.com/Spiffyk/httptest) is a simple reproducer - just clone it, serve it, and open the served `index.html` in a browser. It just runs the `fetch()` function on 10 files filled with zeroes. When everything loads, a paragraph should pop up saying `Loaded all.`. In the current `main` it stays on `Loading...` indefinitely.

[I have a fix ready using `epoll` to make the TCP `accept` and the actual serving asynchronous relatively to each other](https://github.com/Spiffyk/StaticHttpFileServer/tree/epoll), but that limits the `serve` command to Linux, so it's probably not usable as-is? I can open a PR nevertheless, if desirable.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.