Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@
prefixes are refused at registration; other methods get 405. Headers that could split the response, or that the server
owns (`Content-Length`, `Connection`, `Transfer-Encoding`), turn into a 500. Unencoded files of known size
(`fs::File::knownSize()`) are streamed the same way, so serving a large file no longer loads it into memory; encoded
files are still read whole. `Range` (#455) and the binding to a connection (#469) follow.
files are still read whole. The binding to a connection (#469) follows; `Range` is described below (#455).

- HTTP server: byte ranges (#455, ADR-020 prerequisite). Unencoded files of known size are served by `Range` (`bytes=a-b`,
`a-`, `-n`): `206` with `Content-Range` and only the selected bytes read, `416` with `bytes */size` for a range that
starts past the end, and `Accept-Ranges: bytes`. Several ranges, a unit other than
`bytes` and malformed ranges are ignored (`200`, whole file), as is any `Range` on `HEAD`; encoded or decoded responses say `Accept-Ranges: none`.
`If-Range` compares a strong `ETag` that a provider gives with `fs::File::setEntityTag`; nothing is derived from a path,
a size or a time, so native and embedded files have none and a conditioned range is answered in full. `fs::File`
gains `seek`, `entityTag` and `setEntityTag`. Dynamic routes serve a file by ranges with `http::fileReply`, or `http::range::select`. The binding
to a connection (#469) follows.

- Embedded frontends: `alert`, `confirm`, `prompt` and `beforeunload` (`beforeunload` is not handled under WKWebView, see `docs/FRONTENDS.md`; #452, ADR-020 rule 6). WKWebView implements the three
`WKUIDelegate` panel methods (an `NSAlert` sheet of the window; without them these calls did nothing); WebKitGTK, CEF and
Expand Down
34 changes: 32 additions & 2 deletions docs/HTTP_ASSETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,38 @@ connection closes) and a `body` callback filling the next chunk (0 ends it). The
thread, so a slow disk does not delay other connections. Route work runs on its own pool of 4 threads and the files of the providers on another of 2: a handler that blocks for seconds delays at most the routes queued behind four such handlers, never `WebFront.js` or a page. A route precedes the file providers, never masks the embedded
`WebFront.js`, and overlapping prefixes are refused when registered. Other methods get 405; a handler that throws, or sets a
header that could split the response or that the server owns (`Content-Length`, `Connection`, `Transfer-Encoding`), gets
500. The registration handle removes the route when destroyed; a request already running keeps its handler. `Range`
requests (#455) and the binding of a request to a connection (#469) are not part of this mechanism yet.
500. The registration handle removes the route when destroyed; a request already running keeps its handler. The
binding of a request to a connection (#469) is not part of this mechanism yet.

## Byte ranges (#455)

An unencoded file of known size, from any provider, is served by ranges (RFC 9110 §14) and says so with
`Accept-Ranges: bytes`. A single `Range: bytes=a-b`, `a-` or `-n` answers `206 Partial Content` with `Content-Range`
and the length of that part; only those bytes are read, on the worker, in chunks of `emissionBufferSize` (the file
positions itself with `fs::File::seek`). A range that starts at or past the end, an empty suffix (`-0`), or any range of an
empty file answers `416` with `Content-Range: bytes */size`; a last byte past the end is clamped, and a suffix longer than
the file selects all of it. Range is defined for `GET` only (RFC 9110 §14.2): a `HEAD` ignores it and describes the whole file, without a body.

What the server may ignore, it ignores, and the answer is a normal `200` with the whole file: several ranges (in one
field or several), a unit other than `bytes`, a malformed or inverted range (`5-2`), and a `Range` on a response that
cannot be ranged. Multipart answers (`multipart/byteranges`) are not produced. The responses of encoded files (served as
stored with `Content-Encoding`, or decoded by the gzip fallback) carry `Accept-Ranges: none` and are never partial, like
files whose size is unknown.

`If-Range` conditions a range on a validator, and only a strong entity tag is compared. WebFront derives none itself: a
pathname, a size or a modification time can describe another version than the stream that was opened (a replacement
between the open and the lookup, a rewrite that keeps the time), and a tag that is wrong would let a client join bytes of
two versions. A provider whose storage is versioned (a content hash, a revision) gives its tag with
`fs::File::setEntityTag`, which must change whenever the bytes change; it is sent as `ETag` on the 200 and 206 responses.
Native files of `NativeDebugFS` and the development root, and embedded data, have no tag: a conditioned range is answered
in full, while an unconditioned `Range` is still served. The server sends no `Last-Modified`, so a date in `If-Range`
never matches (and a browser applies no heuristic freshness to development files).

A dynamic route that serves a file, such as the services built on #454, calls `http::fileReply(request, file, contentType)`:
it applies the same rules to the route's `RouteRequest::request` and returns the `RouteReply` (200, 206 or 416) that the
handler completes with its own headers (`Cache-Control`, `Content-Disposition`...). A handler with its own storage
can use `http::range::select(request, size, entityTag)` directly. A file with a stored coding is sent as stored, with `Content-Encoding` and `Vary: Accept-Encoding`, in full and with `Accept-Ranges: none`; a client that does not accept the coding gets a 406, because `fileReply` does not decode. The read-only reply is repeatable: successive range
requests on one URL each open the file again.

## Validated representation cache

Expand Down
1 change: 1 addition & 0 deletions docs/adr/ADR-002-systemes-de-fichiers-composables.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| 2.3 | 2026-10-14 | Acceptée | Ambroise Leclerc | Composition facultative des ressources des composants avec DefaultFSWith. | [40f5621](https://github.com/ambroise-leclerc/WebFront/commit/40f5621928fdd188f230bf08ff062f9557619046) |
| 2.4 | 2026-10-14 | Acceptée | Ambroise Leclerc | Fournisseur PackageFS et stockage transactionnel des outils installés. | [4bcfc28](https://github.com/ambroise-leclerc/WebFront/commit/4bcfc28c7b78672603a2114a72d9decf25d36387) |
| 2.5 | 2026-11-03 | Acceptée | Ambroise Leclerc | `fs::File::knownSize()` : taille connue avant lecture (données embarquées, fichier natif sur flux positionnable), pour annoncer `Content-Length` et envoyer le fichier en flux (#454). Les routes dynamiques passent après le `WebFront.js` protégé et ne peuvent pas le masquer. | Branche `454-dynamic-routes` |
| 2.6 | 2026-11-04 | Acceptée | Ambroise Leclerc | `fs::File::seek`, `entityTag()` et `setEntityTag()` : positionnement dans un fichier de taille connue et validateur fort fourni par le fournisseur (jamais déduit d'un chemin, d'une taille ou d'une date), pour les requêtes `Range` et `If-Range` (#455). Le serveur traite les plages ; `fs::Provider` ne voit toujours pas la requête. | Branche `455-range-requests` |

## État et chronologie

Expand Down
3 changes: 3 additions & 0 deletions docs/adr/ADR-020-services-systeme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
| 1.1 | 2026-11-02 | Proposée, partiellement livrée | Ambroise Leclerc | Livraison partielle de l'étape 1 pour #451 (sélecteur de fichiers et téléchargements sous WebKitGTK, CEF, WKWebView et WebView2) ; #452 reste à faire. La section « État de l'étape 1 » distingue les preuves de validation par moteur et par révision ; `docs/FRONTENDS.md` précise les limites de couverture. | Branche `451-file-chooser-downloads` (PR #484), implémentation initiale `91049ab`, stockage privé WKWebView `52d8c68` |
| 1.2 | 2026-11-03 | Proposée, partiellement livrée | Ambroise Leclerc | Livraison de #452 (`alert`, `confirm`, `prompt` partout ; `beforeunload` sauf sous WKWebView, qui n'a pas de délégué public pour lui) : l'étape 1 n'est complète qu'avec cette limite. `docs/FRONTENDS.md` précise la couverture par moteur (WKWebView et WebView2 non exécutés localement ; `beforeunload` non exercé de bout en bout et jamais demandé à la fermeture de la fenêtre). | Branche `452-script-dialogs` |
| 1.3 | 2026-11-03 | Proposée, partiellement livrée | Ambroise Leclerc | Livraison de #454 (étape 2) : routes HTTP dynamiques (`addRoute`, désinscription par handle, priorité après `WebFront.js` et avant les fournisseurs, collision de préfixes refusée), envoi en flux par morceaux bornés d'une réponse produite à l'exécution et des fichiers non encodés de taille connue (`fs::File::knownSize`), gestionnaire et lectures sur un thread de travail du serveur. Les plages `Range` (#455) et la liaison à la connexion (#469) restent à faire ; elles s'appuient sur ces routes. | Branche `454-dynamic-routes` |
| 1.4 | 2026-11-04 | Proposée, partiellement livrée | Ambroise Leclerc | Livraison de #455 (étape 2) : requêtes partielles `Range` (206, 416, `Accept-Ranges`) pour les fichiers non encodés de taille connue et pour les routes dynamiques (`http::fileReply`, `http::range::select`), `If-Range` sur un `ETag` fort fourni par le fournisseur, plages multiples servies en entier. La liaison à la connexion (#469) reste à faire. | Branche `455-range-requests` |

## État et chronologie

Expand Down Expand Up @@ -374,6 +375,8 @@ limites par moteur. #452 est livré dans la version 1.2 (`beforeunload` n'est pa

#454 est livré dans la version 1.3 : `addRoute(préfixe, gestionnaire)` répond aux `GET` et `HEAD` sous un préfixe absolu terminé par `/`, par une réponse (`http::RouteReply`) dont le corps est lu morceau par morceau sur un thread de travail du serveur, sans mémoire proportionnelle à sa taille (mesure : 128 Mio envoyés sans croissance du pic mémoire). Les fichiers non encodés des fournisseurs dont la taille est connue sont envoyés de la même façon ; les fichiers encodés restent lus en entier pour la négociation de codage (ADR-009). Le gestionnaire ne reçoit ni jeton ni identité de connexion : ils viennent de #469.

#455 est livré dans la version 1.4 : un fichier non encodé de taille connue est servi par plages (`Range: bytes=a-b`, `a-`, `-n` sur une seule plage : `206` avec `Content-Range`, `416` pour une plage qui commence après la fin, `Accept-Ranges: bytes`), en ne lisant que la plage demandée. Les plages multiples sont servies en entier (`200`) ; il n'y a pas de réponse `multipart/byteranges`. Les réponses encodées ou décodées par le repli annoncent `Accept-Ranges: none`. `If-Range` n'accepte qu'un `ETag` fort fourni par le fournisseur (`fs::File::setEntityTag`) ; WebFront n'en déduit aucun d'un chemin, d'une taille ou d'une date, qui peuvent désigner une autre version que le flux ouvert. Sans validateur (fichiers natifs, données embarquées), la plage conditionnée est servie en entier. Une route dynamique sert un fichier par plages avec `http::fileReply`. Le jeton de lecture reste donc réutilisable pour plusieurs requêtes `Range` ; leur liaison à la connexion propriétaire vient de #469.

Après l'étape 4, le premier service (sélecteur HTML, poignées, import et export côté client) fera l'objet de sa propre
épique ; les dialogues natifs suivront l'étape 5. `PUT`/`POST` ne sont pas des préalables : les écritures passent par
des tableaux typés en morceaux ; leur ajout au serveur, utile aux très gros envois en flux et aux formulaires sans
Expand Down
4 changes: 2 additions & 2 deletions docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ verification evidence remain in [PROJECT_STATUS](../PROJECT_STATUS.md).
| ADR | Decision | Status | Initial creation | Current version |
| --- | --- | --- | --- | --- |
| [ADR-001](ADR-001-coeur-cpp23-header-only.md) | A header-only C++23 core embedded in the application | Accepted | 2020-04-19 | 1.5 — 2026-10-13 |
| [ADR-002](ADR-002-systemes-de-fichiers-composables.md) | An abstract, composable filesystem as the foundation for portability | Accepted | 2023-03-16 | 2.5 — 2026-11-03 |
| [ADR-002](ADR-002-systemes-de-fichiers-composables.md) | An abstract, composable filesystem as the foundation for portability | Accepted | 2023-03-16 | 2.6 — 2026-11-04 |
| [ADR-003](ADR-003-protocole-binaire-et-bornes.md) | A shared, typed and bounded binary protocol | Accepted through 1.13; 1.14 and 1.15 proposed | 2022-02-06 | 1.15 — 2026-11-04 |
| [ADR-004](ADR-004-appels-asynchrones-et-erreurs.md) | Asynchronous calls with deliberately asymmetric contracts | Accepted | 2022-02-06 | 2.4 — 2026-10-18 |
| [ADR-005](ADR-005-evolution-reseau-asio-stdnet.md) | From standalone ASIO to stdnet: anticipating standard networking without blocking progress | Accepted through 3.1; 3.2 proposed | 2022-01-21 | 3.2 — 2026-10-26 |
Expand All @@ -60,7 +60,7 @@ verification evidence remain in [PROJECT_STATUS](../PROJECT_STATUS.md).
| [ADR-017](ADR-017-acces-direct-aux-frontends.md) | Direct access to embedded frontends, with HTML kept normative | Proposed | 2026-10-24 | 1.1 — 2026-10-25 |
| [ADR-018](ADR-018-acces-au-dom.md) | DOM access from C++ through a bounded mutation stream, without contesting the DOM of UI libraries | Proposed, partially superseded, partially delivered | 2026-10-26 | 1.5 — 2026-10-30 |
| [ADR-019](ADR-019-developpement-automatisable-et-agents.md) | Automating the developer environment through shared operations and an optional local MCP adapter | Accepted | 2026-10-28 | 1.2 — 2026-10-29 |
| [ADR-020](ADR-020-services-systeme.md) | System services (files, clipboard, shell, notifications…) through optional C++ portals with per-connection backends, granting handles rather than paths | Proposed | 2026-10-31 | 1.3 — 2026-11-03 |
| [ADR-020](ADR-020-services-systeme.md) | System services (files, clipboard, shell, notifications…) through optional C++ portals with per-connection backends, granting handles rather than paths | Proposed | 2026-10-31 | 1.4 — 2026-11-04 |
| [ADR-021](ADR-021-publication-de-l-environnement-developpeur.md) | Simplifying the publication of the developer environment: automate the release, keep pinned hashes, no dedicated server | Accepted (domain delivered; phase 1 to implement) | 2026-11-02 | 1.0 — 2026-11-02 |

Numbering follows the reading topics; milestones and individual file histories provide
Expand Down
Loading
Loading