nx_urlcanon.nx
buildroot/runtime/nx_urlcanon.nx
about
nx_urlcanon.nx -- URL canonicalization for crawl de-duplication.
module: nishi-core.search.urlcanon
depends: nx_str.nx
capability: CORE_COMPUTE
wired_status: FULLY_WIRED
WHY: the same resource is reachable under many URL spellings (host-case,
#fragment, default :80/:443). Canonicalizing before the visited-set check
means we DON'T re-fetch the same page under a cosmetic variant -- saving
crawl budget and, crucially, not hammering hosts (-> not getting
blacklisted). RFC 3986 syntax-based normalization (the safe subset):
* lowercase scheme + host (case-insensitive per RFC 3986 sec 6.2.2.1)
* drop the fragment (never sent to the origin server)
* drop the default port (:80 for http, :443 for https)
Path + query are preserved verbatim (case- and order-significant). Tracking-
param stripping is a queued refinement.
dependencies 1 imports · 2 importers
imports: nx_str.nx
imported by: nx_crawl_main.nxnx_urlcanon_test.nx
structs
| none |
consts
| none |
functions
| 21 | func _uc_lc(c: i64) -> i64 { if c >= 0x41 { if c <= 0x5A { return c + 0x20 } } return c } called by 1: nx_url_canon |
| 24 | func nx_url_canon(url: *u8, n: i64, out: *u8, cap: i64) -> i64 |