summaryrefslogtreecommitdiff
path: root/test/web/catalog.py
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-12 17:15:03 -0300
committerGabriel Schneider <[email protected]>2026-11-17 12:15:16 -0300
commit7a07e24916cd5bc762996d81aa1faf550177cd6f (patch)
tree4530a8562fb3f068cc4340f1fab1f6c599721735 /test/web/catalog.py
parentf9ca3fb5ba767300bec3f1fbb13fc5e6552a90e3 (diff)
downloadcloud9-7a07e24916cd5bc762996d81aa1faf550177cd6f.tar.gz
cloud9-7a07e24916cd5bc762996d81aa1faf550177cd6f.zip
9web: serve prefixed sites through the composed 9P namespace
Post only the pure site/control/discovery tree, with a separate host-only adapter and no duplicate supervision. Serve websites, metadata and legacy controls through the ordinary 9P mux; retain whole-root filesystem browsing and compatibility paths. Pin public file descriptors across publication. Add opt-in build-time HTML/CSS prefix packaging with separate atomic preview generations and unchanged JavaScript/default output. Optional compatibility ports use ?u16. Deploy all five workstation sites on [::]:8090, with /mnt/9p/9web controls. Document Plan 9 references, companion build commits, shared-origin trust and live validation. Validated catalogue, host/FUSE, HTTP FS, mux, prefix and Chromium suites; original E2E 32 scenarios; all five live sites, blog navigation, IPv4/IPv6 and real cafe build through 9P.
Diffstat (limited to 'test/web/catalog.py')
-rw-r--r--test/web/catalog.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/web/catalog.py b/test/web/catalog.py
index e1b153e..87773d8 100644
--- a/test/web/catalog.py
+++ b/test/web/catalog.py
@@ -6,6 +6,7 @@ import json
import os
from pathlib import Path
import socket
+import shutil
import struct
import subprocess
import sys
@@ -145,8 +146,14 @@ def main():
assert http(site_port, '/nested/')[2] == b'nested page'
assert http(site_port, '/', 'HEAD')[2] == b''
assert http(site_port, '/style.css', headers={'Range':'bytes=0-3'})[2] == b'body'
+ assert http(dashboard, '/sites/fixture/')[2] == b'<h1>catalog fixture</h1>'
+ assert http(dashboard, '/sites/fixture/pretty')[2] == b'pretty page'
+ assert http(dashboard, '/sites/fixture/nested?x=1')[1]['location'] == '/sites/fixture/nested/?x=1'
+ assert http(dashboard, '/sites/fixture/style.css', headers={'Range':'bytes=-2'})[0] == 206
+ assert http(dashboard, '/sites/fixture/style.css', headers={'Range':'bytes=999999-'})[0] == 416
for path in ['/../secret', '/%2e%2e/secret', '/escape', '/escape-dir/secret', '/.git/config', '/%2fetc/passwd']:
assert http(site_port, path)[0] in (400,403,404), path
+ assert http(dashboard, '/sites/fixture' + path)[0] in (400,403,404), path
assert http(dashboard, headers={'Host':'attacker.invalid'})[0] == 403
ctl = '/_cloud9/sites/fixture/ctl'
assert http(dashboard, ctl, 'POST', 'build', {'Origin':'https://attacker.invalid'})[0] == 403
@@ -199,6 +206,17 @@ def main():
nine.write('sites/fixture/ctl', 'build')
eventually(lambda: json.loads(nine.read('sites/fixture/status'))['phase'] == 'failed')
assert http(site_port)[0] == 200
+ # A published generation replacement must not splice an open fid.
+ saved = (public/'style.css').read_bytes()
+ nine.walk('sites/fixture/public/style.css')
+ nine.rpc(112, struct.pack('<IB', 2, 0))
+ assert nine.rpc(116, struct.pack('<IQI', 2, 0, 2))[4:] == saved[:2]
+ public.rename(root/'previous-public')
+ shutil.copytree(root/'previous-public', public, symlinks=True)
+ (public/'style.css').write_bytes(b'new generation')
+ assert nine.rpc(116, struct.pack('<IQI', 2, 2, 30000))[4:] == saved[2:]
+ nine.rpc(120, struct.pack('<I', 2))
+ assert http(dashboard, '/sites/fixture/style.css')[2] == b'new generation'
nine.s.close()
print('catalog: HTTP serving, paths, MIME, HEAD/range, controls, watch, failure, cancellation, 9P events and passive discovery passed')
except BaseException: