HTTP/2 (src/http2.rs): preface, SETTINGS, HEADERS/CONTINUATION, DATA, WINDOW_UPDATE, PING, RST_STREAM, GOAWAY; HPACK con tabella statica, dinamica e Huffman. Le tabelle sono generate dalla RFC 7541 (src/hpack_tabelle.rs) e validate sui suoi esempi, non trascritte a mano. Ambito dichiarato: una richiesta per connessione, senza multiplexing ne' push. Proxy (src/net.rs): http_proxy/https_proxy/all_proxy/no_proxy, tunnel CONNECT per https, Proxy-Authorization con base64. Provato con un finto proxy locale: forma assoluta per http, CONNECT per https, rifiuto del tunnel riportato. multipart/form-data e text/plain oltre a urlencoded (src/invio.rs): il corpo viaggia col tipo dichiarato, e il test verifica che il confine annunciato nell'intestazione separi davvero le parti che il server riceve. Processo di rete separato (src/bin/mosaic-net.rs): IPC a lunghezza prefissata su stdin/stdout, corpo in base64; il servizio tiene cookie e cache. Il desktop lo usa con --rete-esterna. Sul telefono la rete resta nel processo: un'app sandboxata non avvia figli in modo affidabile. Due difetti trovati dai test e non dalla lettura: - intero() in HPACK mascherava con AND invece di comporre con OR: ogni lunghezza di stringa finiva a zero. Era il GOAWAY dei siti veri. - rustls stringe la mano pigramente: alpn_protocol() era vuoto e si finiva sempre in HTTP/1.1 senza dirlo. Ora l'handshake e' forzato e MOSAIC_DEBUG lo stampa.
90 lines
3.2 KiB
Bash
Executable File
90 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Costruisce Mosaic-desktop-x.y.z-x86_64.AppImage senza appimagetool:
|
|
# [runtime ELF estratto da un'AppImage esistente] + [squashfs dell'AppDir]
|
|
# Richiede: cargo, python3+PIL per l'icona, mksquashfs (qui, o nel container del SDK).
|
|
set -eu
|
|
|
|
# cargo può non essere nel PATH di una shell non interattiva
|
|
if ! command -v cargo >/dev/null 2>&1; then
|
|
PATH="$HOME/.cargo/bin:$PATH"
|
|
export PATH
|
|
fi
|
|
|
|
set -o pipefail
|
|
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
ROOT="$(cd "$HERE/.." && pwd)"
|
|
BUILD="$HERE/build"
|
|
APPDIR="$BUILD/AppDir"
|
|
VER="${VERSION:-0.1.0}"
|
|
OUT="$ROOT/Mosaic-desktop-$VER-x86_64.AppImage"
|
|
RUNTIME="${RUNTIME:-$HERE/runtime-x86_64}"
|
|
SRC_APPIMAGE="${SRC_APPIMAGE:-$ROOT/../../mosaic/Mosaic-1.0.0-x86_64.AppImage}"
|
|
CONTAINER="${CONTAINER:-sailfish-sdk-build-engine_kaneda}"
|
|
|
|
echo "== binario (release)"
|
|
(cd "$ROOT" && cargo build --release)
|
|
BIN="$ROOT/target/release/mosaic-desktop"
|
|
[ -x "$BIN" ] || { echo "binario non prodotto" >&2; exit 1; }
|
|
|
|
echo "== runtime AppImage"
|
|
if [ ! -f "$RUNTIME" ]; then
|
|
python3 "$HERE/extract-runtime.py" "$SRC_APPIMAGE" "$RUNTIME"
|
|
fi
|
|
chmod +x "$RUNTIME"
|
|
|
|
echo "== AppDir"
|
|
rm -rf "$APPDIR"
|
|
mkdir -p "$APPDIR/usr/bin" "$APPDIR/usr/share/mosaic/fonts" \
|
|
"$APPDIR/usr/share/applications" "$APPDIR/usr/share/icons/hicolor/256x256/apps"
|
|
install -m 755 "$BIN" "$APPDIR/usr/bin/mosaic-desktop"
|
|
# il servizio di rete separato: il desktop lo usa con --rete-esterna. Il binario
|
|
# appartiene al crate del motore, non a quello del guscio.
|
|
cargo build --release --manifest-path "$ROOT/../engine/Cargo.toml" --bin mosaic-net >/dev/null
|
|
install -m 755 "$ROOT/../engine/target/release/mosaic-net" "$APPDIR/usr/bin/mosaic-net"
|
|
install -m 644 "$ROOT/demo.html" "$APPDIR/usr/share/mosaic/"
|
|
install -m 644 "$ROOT/fonts/DejaVuSans.ttf" "$ROOT/fonts/DejaVuSerif.ttf" "$APPDIR/usr/share/mosaic/fonts/"
|
|
|
|
python3 "$HERE/make-icon.py" 256 "$APPDIR/mosaic-desktop.png"
|
|
install -m 644 "$APPDIR/mosaic-desktop.png" "$APPDIR/usr/share/icons/hicolor/256x256/apps/mosaic-desktop.png"
|
|
|
|
cat > "$APPDIR/mosaic-desktop.desktop" <<'DESKTOP'
|
|
[Desktop Entry]
|
|
Type=Application
|
|
Name=Mosaic
|
|
GenericName=Web Browser
|
|
Comment=Browser Mosaic con motore di rendering indipendente
|
|
Exec=mosaic-desktop
|
|
Icon=mosaic-desktop
|
|
Terminal=false
|
|
Categories=Network;WebBrowser;
|
|
Keywords=web;browser;mosaic;retro;hypertext;
|
|
DESKTOP
|
|
cp "$APPDIR/mosaic-desktop.desktop" "$APPDIR/usr/share/applications/"
|
|
|
|
# AppRun: pagina demo e font interni al pacchetto, così non dipende dai font di sistema
|
|
cat > "$APPDIR/AppRun" <<'APPRUN'
|
|
#!/bin/sh
|
|
HERE="$(dirname "$(readlink -f "$0")")"
|
|
exec "$HERE/usr/bin/mosaic-desktop" \
|
|
--html "$HERE/usr/share/mosaic/demo.html" \
|
|
--font "$HERE/usr/share/mosaic/fonts/DejaVuSans.ttf" \
|
|
--zoom 1.25 "$@"
|
|
APPRUN
|
|
chmod +x "$APPDIR/AppRun"
|
|
|
|
echo "== squashfs"
|
|
if command -v mksquashfs >/dev/null 2>&1; then
|
|
mksquashfs "$APPDIR" "$BUILD/payload.squashfs" -comp gzip -b 131072 -root-owned -noappend -no-xattrs -no-progress
|
|
else
|
|
docker exec "$CONTAINER" mksquashfs "$APPDIR" "$BUILD/payload.squashfs" \
|
|
-comp gzip -b 131072 -root-owned -noappend -no-xattrs -no-progress
|
|
fi
|
|
|
|
echo "== immagine finale"
|
|
rm -f "$OUT"
|
|
cat "$RUNTIME" "$BUILD/payload.squashfs" > "$OUT"
|
|
chmod +x "$OUT"
|
|
echo "Creato: $OUT"
|
|
ls -lh "$OUT"
|