Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4a4f719
xftp: implementation of XFTP client as web page (rfc, low level funct…
epoberezkin Jan 31, 2026
b6c4c8f
protocol, file descriptions, more cryptogrpahy, handshake encoding, etc.
epoberezkin Jan 31, 2026
ad24813
xftp server changes to support web slients: SNI-based certificate cho…
epoberezkin Feb 1, 2026
947edc2
web handshake
epoberezkin Feb 2, 2026
6408983
test for xftp web handshake
epoberezkin Feb 2, 2026
2603804
xftp-web client functions, fix transmission encoding
epoberezkin Feb 2, 2026
9a2279d
support description "redirect" in agent.ts and cross-platform compati…
epoberezkin Feb 3, 2026
3f15fa2
rfc: web transport
epoberezkin Feb 3, 2026
3eb6f40
client transport abstraction
epoberezkin Feb 3, 2026
af3a183
browser environment
evgeny-simplex Feb 4, 2026
41d474f
persistent client sessions
evgeny-simplex Feb 4, 2026
3574df1
move rfcs
epoberezkin Feb 4, 2026
e0bc43c
web page plan
evgeny-simplex Feb 4, 2026
3eee58a
improve plan
evgeny-simplex Feb 4, 2026
97773f0
webpage implementation (not tested)
evgeny-simplex Feb 5, 2026
289f02a
fix test
evgeny-simplex Feb 5, 2026
d38f278
fix test 2
evgeny-simplex Feb 5, 2026
df3b7a5
fix test 3
evgeny-simplex Feb 5, 2026
78dc2cd
fixes and page test plan
evgeny-simplex Feb 5, 2026
dfda816
allow sending xftp client hello after handshake - for web clients tha…
evgeny-simplex Feb 8, 2026
9333777
page tests pass
evgeny-simplex Feb 9, 2026
6f11e2a
concurrent and padded hellos in the server
evgeny-simplex Feb 10, 2026
25c08ec
update TS client to pad hellos
evgeny-simplex Feb 10, 2026
3784619
fix tests
evgeny-simplex Feb 10, 2026
9c0b656
preview:local
evgeny-simplex Feb 10, 2026
42b2fa0
local preview over https
evgeny-simplex Feb 10, 2026
cc7a7ee
fixed https in the test page
evgeny-simplex Feb 10, 2026
9a55137
web test cert fixtures
evgeny-simplex Feb 10, 2026
442a3ba
debug logging in web page and server
evgeny-simplex Feb 11, 2026
74eb22c
remove debug logging in server/browser, run preview xftp server via c…
evgeny-simplex Feb 11, 2026
51c5615
debug logging for page sessions
evgeny-simplex Feb 11, 2026
57c144d
add plan
epoberezkin Feb 11, 2026
59e740c
improve error handling, handle browser reconnections/re-handshake
evgeny-simplex Feb 11, 2026
e00e9a7
fix
evgeny-simplex Feb 11, 2026
3958e06
debugging
evgeny-simplex Feb 11, 2026
1a1ca91
opfs fallback
evgeny-simplex Feb 12, 2026
6c0e5cb
delete test screenshot
epoberezkin Feb 12, 2026
0bc3210
xftp CLI to support link
evgeny-simplex Feb 16, 2026
37b1d15
fix encoding for XFTPServerHandshake
evgeny-simplex Feb 17, 2026
ff98a2b
support redirect file descriptions in xftp CLI receive
shumvgolove Feb 18, 2026
7305c02
refactor CLI redirect
evgeny-simplex Feb 19, 2026
1aba155
xftp-web: fixes and multi-server upload (#1714)
shumvgolove Feb 20, 2026
396ec2e
fix TypeScript errors in check:web (#1716)
shumvgolove Feb 20, 2026
0757db9
fix: serialize worker message processing to prevent OPFS handle race
shumvgolove Feb 21, 2026
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ cabal.project.local~
.hpc/
*.tix
.coverage

53 changes: 53 additions & 0 deletions 2026-02-04-xftp-web-persistent-connections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# XFTPClientAgent Pattern

## TOC
1. Executive Summary
2. Changes: client.ts
3. Changes: agent.ts
4. Changes: test/browser.test.ts
5. Verification

## Executive Summary

Add `XFTPClientAgent` — a per-server connection pool matching the Haskell pattern. The agent caches `XFTPClient` instances by server URL. All orchestration functions (`uploadFile`, `downloadFile`, `deleteFile`) take `agent` as first parameter and use `getXFTPServerClient(agent, server)` instead of calling `connectXFTP` directly. Connections stay open on success; the caller creates and closes the agent.

`connectXFTP` and `closeXFTP` stay exported (used by `XFTPWebTests.hs` Haskell tests). The `browserClients` hack, per-function `connections: Map`, and `getOrConnect` are deleted.

## Changes: client.ts

**Add** after types section: `XFTPClientAgent` interface, `newXFTPAgent`, `getXFTPServerClient`, `closeXFTPServerClient`, `closeXFTPAgent`.

**Delete**: `browserClients` Map and all `isNode` browser-cache checks in `connectXFTP` and `closeXFTP`.

**Revert `closeXFTP`** to unconditional `c.transport.close()` (browser transport.close() is already a no-op).

`connectXFTP` stays exported (backward compat) but becomes a raw low-level function — no caching.

## Changes: agent.ts

**Imports**: replace `connectXFTP`/`closeXFTP` with `getXFTPServerClient`/`closeXFTPAgent` etc.

**Re-export** from agent.ts: `newXFTPAgent`, `closeXFTPAgent`, `XFTPClientAgent`.

**`uploadFile`**: add `agent: XFTPClientAgent` as first param. Replace `connectXFTP` → `getXFTPServerClient`. Remove `finally { closeXFTP }`. Pass `agent` to `uploadRedirectDescription`.

**`uploadRedirectDescription`**: change from `(client, server, innerFd)` to `(agent, server, innerFd)`. Get client via `getXFTPServerClient`.

**`downloadFile`**: add `agent` param. Delete local `connections: Map`. Replace `getOrConnect` → `getXFTPServerClient`. Remove finally cleanup. Pass `agent` to `downloadWithRedirect`.

**`downloadWithRedirect`**: add `agent` param. Same replacements. Remove try/catch cleanup. Recursive call passes `agent`.

**`deleteFile`**: add `agent` param. Same pattern.

**Delete**: `getOrConnect` function entirely.

## Changes: test/browser.test.ts

Create agent before operations, pass to upload/download, close in finally.

## Verification

1. `npx vitest --run` — browser round-trip test passes
2. No remaining `browserClients`, `getOrConnect`, or per-function `connections: Map` locals
3. `connectXFTP` and `closeXFTP` still exported (XFTPWebTests.hs compat)
4. All orchestration functions take `agent` as first param
17 changes: 16 additions & 1 deletion contributing/CODE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

This file provides guidance on coding style and approaches and on building the code.

## Code Style and Formatting
## Code Security

When designing code and planning implementations:
- Apply adversarial thinking, and consider what may happen if one of the communicating parties is malicious.
- Formulate an explicit threat model for each change - who can do which undesirable things and under which circumstances.

## Code Quality Standards

Haskell client and server code serves as system specification, not just implementation — we use type-driven design to reflect the business domain in types. Quality, conciseness, and clarity of Haskell code are critical.

## Code Style, Formatting and Approaches

The project uses **fourmolu** for Haskell code formatting. Configuration is in `fourmolu.yaml`.

Expand Down Expand Up @@ -41,6 +51,11 @@ Some files that use CPP language extension cannot be formatted as a whole, so in
- Never do refactoring unless it substantially reduces cost of solving the current problem, including the cost of refactoring
- Aim to minimize the code changes - do what is minimally required to solve users' problems

**Document and code structure:**
- **Never move existing code or sections around** - add new content at appropriate locations without reorganizing existing structure.
- When adding new sections to documents, continue the existing numbering scheme.
- Minimize diff size - prefer small, targeted changes over reorganization.

**Code analysis and review:**
- Trace data flows end-to-end: from origin, through storage/parameters, to consumption. Flag values that are discarded and reconstructed from partial data (e.g. extracted from a URI missing original fields) — this is usually a bug.
- Read implementations of called functions, not just signatures — if duplication involves a called function, check whether decomposing it resolves the duplication.
Expand Down
23 changes: 0 additions & 23 deletions notes-flow.txt

This file was deleted.

Loading
Loading