Plan 9 from Bell Labs’s /usr/web/sources/contrib/mospak/abaco-html4/README

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


abaco-html4: html(2) wiring, UTF-8 default, cookies, and bug fixes for the 9legacy abaco browser

Ten patches that bring the 9legacy abaco(1) web browser to a more
usable state on the modern web, without rewriting it.  The patches
fix NOTES-listed bugs in text selection and double-clicking, wire
up html(2) parser fields abaco ignored, flip the default character
set to UTF-8, enable webfs cookie storage so logged-in sites work,
mark failed fetches distinctly from in-flight ones in the status
area, and guard getbase against the relative-BASE-href crash.

The set is intentionally narrow: no new subsystems, no parser
replacement, no reflow layer.  Everything builds on what abaco and
libhtml already ship.

CHANGES
    v1 -- 2026-04-24 (initial)
        abaco-html2-wiring                Wire html(2) fields
                                          parsehtml already fills
                                          but abaco ignores: hr
                                          attrs, image placeholders,
                                          select defaults, maxlength,
                                          form-field percent-encoding,
                                          fragment anchors, link
                                          titles in status, hanging
                                          list indent, row
                                          backgrounds, cell valign,
                                          table captions, image
                                          maps, frame borders/margins,
                                          meta refresh.
        abaco-doubleclick-typo            text.c:727 one-char fix in
                                          textclickmatch call; fixes
                                          bracket/quote matching.
        abaco-pagedoubleclick-guard       page.c:595 nil guard on
                                          l->next; fixes crash on
                                          double-click past the last
                                          line of the last page.
        abaco-pageselect-ordering         page.c:541 same-line drag
                                          ordering via linewhich;
                                          fixes "complement selection"
                                          under 1-2 px mouse-Y wobble.
        abaco-wind-dangling-edit          wind.c:39 delete copy-paste
                                          leftover fragment.  No
                                          behaviour change.
        abaco-util-strcpy-bound           util.c:956 strcpy -> snprint;
                                          defensive tightening
                                          against oversized -t flag.
        abaco-charset-utf8-default        main.c:38 default fallback
                                          charset flipped iso-8859-1
                                          -> utf-8.  -t flag still
                                          overrides.
        abaco-cookies-enable              urls.c:93 enable webfs's
                                          sendcookies/acceptcookies
                                          per connection so RFC 6265
                                          cookie jar works.
        abaco-error-surface-prefix        page.c:276,296 prefix
                                          failure-path messages with
                                          "error: " to distinguish
                                          from in-flight status.

    v2 -- 2026-04-25
        abaco-base-href-guard             util.c:366 validurl-guard
                                          p->doc->base in getbase;
                                          falls through to the page
                                          URL when BASE href is
                                          relative or nil.  Stops
                                          crash on pages that set
                                          <BASE HREF="/foo">
                                          (libhtml's aurlval stores
                                          the relative value
                                          unresolved; the proper
                                          fix is in libhtml).


    v3 -- 2026-05-04 (ASCII normalization)
        all patches + README              Em-dash, arrow, and section-sign
                                          characters replaced with '--',
                                          '->', and 'Section N' for 9legacy
                                          stable convention.  Prose and
                                          comments throughout, plus one
                                          user-visible change in
                                          abaco-html2-wiring: the button-2
                                          status-bar separator between URL
                                          and link title attribute is now
                                          '--' instead of em-dash.  Two
                                          U+FFFD bytes remain in
                                          abaco-pageselect-ordering on a
                                          context line that mirrors
                                          upstream NOTES; a follow-on NOTES
                                          patch will clear them.

Scope limits
    - Bug fixes and low-risk wiring only.  No new rendering
      subsystems.  No CSS support (beyond what html(2) already
      parses), no JavaScript, no reflow.  abaco's single-pass
      Lay / Box / Line layout is preserved.
    - Modern HTTPS interop is delegated to the tls-1.2
      patch series.  These abaco patches assume tls-1.2
      is already applied if HTTPS is a requirement.
    - No change to webfs, libsec, or the /mnt/web file interface.
      abaco-cookies-enable uses webfs's existing cookie machinery;
      it does not add a new ABI.

RFCs in scope
    RFC 3629                               abaco-charset-utf8-default
    RFC 6265 Section 5.3, Section 5.4      abaco-cookies-enable

Files
    abaco-html2-wiring.diff          html(2) field wiring
    abaco-doubleclick-typo.diff      text.c bracket/quote typo
    abaco-pagedoubleclick-guard.diff page.c nil-deref guard
    abaco-pageselect-ordering.diff   page.c same-line ordering
    abaco-wind-dangling-edit.diff    wind.c cleanup
    abaco-util-strcpy-bound.diff     util.c strcpy bound
    abaco-charset-utf8-default.diff  main.c utf-8 default
    abaco-cookies-enable.diff        urls.c webfs cookie flags
    abaco-error-surface-prefix.diff  page.c error: prefix
    abaco-base-href-guard.diff       util.c relative-BASE guard

Apply order
    The patches are independent (order does not affect result) but
    presented in the order above for readability.  Inside the VM,
    from /:

        cd /
        patches=(abaco-html2-wiring abaco-doubleclick-typo \
            abaco-pagedoubleclick-guard abaco-pageselect-ordering \
            abaco-wind-dangling-edit abaco-util-strcpy-bound \
            abaco-charset-utf8-default abaco-cookies-enable \
            abaco-error-surface-prefix abaco-base-href-guard)
        for(p in $patches)
            ape/patch -p0 < /path/to/abaco-html4/$p.diff

    Applying all ten leaves a page.c.orig behind.  Four of these
    patches touch page.c, and abaco-html2-wiring adds thirty lines
    above the others' targets, so abaco-pagedoubleclick-guard lands
    thirty lines lower than its header says.  patch finds it by
    context, applies it correctly, and keeps a backup; ape/patch and
    patch both stay quiet about the offset unless run verbosely.
    The result is the same whatever the order, as above.  Remove the
    .orig after building, and after backing out -- reverting offsets
    the same way and keeps its own backups.

Rebuild
    Patches touch sys/src/cmd/abaco/{html.c, main.c, page.c, tabs.c,
    text.c, urls.c, util.c, wind.c, NOTES} only.  No libhtml change,
    no kernel change, no reboot.

        cd /sys/src/cmd/abaco && mk clean && mk install

    New /$cputype/bin/abaco; run it.

Prerequisites
    A 9legacy CD / source tree (the canonical 9legacy.iso or an
    install therefrom) has everything needed.  Sanity-check:

        test -d /sys/src/cmd/abaco        # abaco source present
        test -d /sys/src/libhtml          # libhtml source present

    For HTTPS interop, apply tls-1.2 first (see
    contrib/tls-1.2/ and <https://9p.io/sources/contrib/
    mospak/tls-1.2/>).  These abaco patches do not depend
    on tls-1.2 for HTTP pages; HTTPS is only relevant for
    the subset of test pages served over TLS.

Verification
    For the bugfix patches (doubleclick-typo, pagedoubleclick-guard,
    pageselect-ordering) interactive testing in rio is the acceptance
    gate.

    Real-hardware smoke suggestions:

        abaco http://example.com/        trivial baseline
        abaco http://9legacy.org/        plain-HTML site
        abaco https://9legacy.org/       HTTPS (needs tls-1.2)

Rollback
    Reverse order, -R flag:

        cd /
        rpatches=(abaco-base-href-guard abaco-error-surface-prefix \
            abaco-cookies-enable abaco-charset-utf8-default \
            abaco-util-strcpy-bound abaco-wind-dangling-edit \
            abaco-pageselect-ordering abaco-pagedoubleclick-guard \
            abaco-doubleclick-typo abaco-html2-wiring)
        for(p in $rpatches)
            ape/patch -R -p0 < /path/to/abaco-html4/$p.diff

    Then rebuild libhtml and abaco as above.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.