Notes › Tech Notes › A malformed URL into the parser page: example.com:80 is read as the protocol, and %e stops the segment table halfway

A malformed URL into the parser page: example.com:80 is read as the protocol, and %e stops the segment table halfway

Pasting malformed URLs into the parser page, measured: example.com:80 is swallowed whole as the protocol, a half-written escape %e stops the segment table halfway, only & splits parameters while the semicolon stays part of the value, and rebuilding after a delete re-encodes the string.

Before you paste a crooked URL, know that this page runs on one set of glue

The task at hand: dig a batch of URLs out of an old feeding log — strings that look alive but are actually bent — and drop them one by one into the parser page to check how it splits each into segments. The very first round steps on two landmines: example.com:80 gets swallowed whole as the protocol, and a half-written escape, %e, stops the segment table halfway down the render. Pin the expectations first: the decomposition on this page runs through one machine only, new URL() plus four pieces of hand-written glue — protocol filling, suffix checking, split-based segmentation, and parameter grabbing. Whatever you feed it, the structure table always prints 11 rows, while the page copy advertises 12 fields in total, so the two are off by one row. What follows records, entry by entry, the field values this glue spits out for malformed input, and every entry carries the exact input that produced it.

example.com:80/ is mislabeled as the protocol, whole

The nastiest paste of the batch: submit example.com:80/. The colon is picked up by this page's scheme regex as a protocol name, protocol comes out as example.com:, pathname becomes 80/, the safe-or-not column prints the uppercase EXAMPLE.COM, and the error column never writes a single character. Only after switching to http://example.com:80: does an invalid-format message finally appear. In other words, for any string that never states a protocol, this page's working rule is that everything before the first colon is a protocol candidate.

The sibling behavior of the protocol-filling branch swallows the protocol-relative form as well: //example.com/a/b?x=1#f gets https prepended, and href lands as a string 29 characters long; the page does not follow the current page's protocol here. A trailing space is trimmed and let through, giving an href of length 21; a space, tab, or newline embedded in the middle is blocked every time, with a fixed message stating that the URL contains a space or a line break and asking you to run it through the encoding step first and then paste the result back for parsing. Whitespace at the edges is a courtesy the page performs silently; whitespace inside the string is a hard stop.

Pasted input example.com:80/ --> Scheme regex misreads it --> protocol=example.com: pathname=80/ Safe column: EXAMPLE.COM Error column quiet throughout Contrast: only http://example.com:80: reports an invalid format

Figure 1: the route by which example.com:80/ ends up wearing the wrong labels on this page.

The half-written escape %e throws URIError, leaving the screen new on top and old below

The breaking point of https://e.com/%e is the hand-written per-segment decoding step, which throws URIError: URI malformed. The judgment here follows the code's write order (no browser screen check was run this round): before the throw, the structure table and the statistics line had already been written — this input has a total character count of 16 — while the segment table stays empty and the parameter editing area is not refreshed at all, with no try/catch anywhere in between to catch the fall. That ordering is enough to explain why the upper half of the page shows fresh content while the lower half still shows whatever you parsed last. Note that not every broken percent sign crashes: the escape sequence inside the parameter value q=1%zz2 is not valid, yet it is preserved as-is and displays 1%zz2; only a half-written %e that lands in the segment decoding flips the table over.

Parameters split only on &, and the semicolon belongs to the value

a=1;b=2&c=%E4%BD%A0%E5%A5%BD produces only 2 rows in the parameter table, the first one displaying a=1;b=2 — this page does not accept the semicolon as a separator. A keyless fragment like ?onlyvalue is kept as a row whose key name is literally onlyvalue, and + decodes into a space. Duplicate keys are two separate books: the input ?utm_source=x&utm_source=y&b=2 yields 3 rows in the parameter table but only 2 checkboxes, because the checkbox list deduplicates through a Set; untick once and both values under the same name disappear together, with the rebuilt result https://e.com/?b=2. And the rebuild step does not delete characters from the original string: %zz becomes %25zz, the semicolon becomes %3B, and the keyless fragment vanishes from the generated output entirely. So if you want to drop one parameter while keeping every other byte of the query spelled exactly as it arrived, this page cannot do it. To truly amend the record, paste the string back into the parser page and run another round — treating the rebuild as a re-encoding pass rather than a surgical edit. What you see decoded is this page's reading of your input; what comes out of a rebuild is this page's own spelling.

Input ?utm_source=x&utm_source=y&b=2 Parameter table: 3 rows Only 2 checkboxes Untick once, both values go Rebuilt result https://e.com/?b=2 Re-encoding ledger: %zz becomes %25zz; semicolon becomes %3B; keyless fragment gone

Figure 2: the two books kept for duplicate keys, and the double encoding that shows up when deleting a parameter triggers a rebuild.

Malformed input against this page's output

InputWhat this page outputsError column
example.com:80/protocol=example.com:, pathname=80/quiet throughout
//example.com/a/b?x=1#fhttps prepended, href 29 characters longnone
https://e.com/%estructure table and statistics line written, segment table left emptyURIError: URI malformed
a=1;b=2&c=%E4%BD%A0%E5%A5%BDparameter table 2 rows, first row shows a=1;b=2none
?utm_source=x&utm_source=y&b=23 parameter rows, 2 checkboxesnone
an empty ? next to an empty #search and hash display a dash with an empty marker, href keeps the symbols, total character count 21none

Chinese domains fall straight into punycode, and character counts use UTF-16 code units

Feed one of the internationalization-test regulars, such as https://例え.测试/路径, and hostname becomes xn--r8jz45g.xn--0zwm56d, the suffix column displays .xn--0zwm56d, and an input of 16 characters (occupying 28 bytes in UTF-8) produces an href of 50 characters, entirely ASCII. The total character count on the statistics line counts UTF-16 code units rather than bytes, so measuring it with a byte ruler never lines up. The protocol whitelist has its own fine print: only http, https, ws, wss and ftp — five of them — are subject to the missing-hostname check; javascript:alert(1) and mailto:a@b.com still print a full 11-row structure table, with the safe-or-not column showing JAVASCRIPT and MAILTO respectively — this paragraph only enumerates what the page does, without editorializing. For file:/// and data:, hostname displays a dash, origin displays the string null, and the default-port column fills in a plain none. The observation here stops at the fields on the screen.

Frequently asked questions

Q: Why does pasting example.com:80/ produce no error at all?

This page's scheme regex treats the stretch before the colon as a protocol name, and once a protocol counts as valid the structure table prints its usual 11 rows. The only trace of the misread is the safe-or-not column showing EXAMPLE.COM and pathname ending up as 80/. To make it complain you have to write a genuinely malformed form, such as http://example.com:80:.

Q: I pasted a URL containing %e and the lower half of the page stopped moving. What now?

The hand-written segment decoding throws URIError partway through, the render has no fallback, and the fields written before the throw stay on the page. Complete the half-written escape and paste the URL again.

Q: Why are there fewer checkboxes than rows in the parameter table?

Same-name keys are deduplicated through a Set on the checkbox side: 3 parameter rows can come with only 2 checkboxes, and a single untick removes the values of every same-name row together.

Q: The rebuilt string does not match the original character for character?

Deleting a parameter goes through re-encoding, not deletion: %zz becomes %25zz, the semicolon becomes %3B, and keyless fragments vanish. If you want a clearer picture of how the parts of a URL are divided in the first place, revisit the earlier note on how a URL splits into parts and how the query gets encoded.

📎 Related articles

Cron generator template button round trip: only 1 of 8 rebuilds word for word, and the previewer freezes the second on the wall clock 2026-11-21 Rejection sampling and the no-repeat cutoff: 60000 draws give chi-square 53.75, and ratio 0.05 is the switch point 2026-11-21 Is Pasted-Back SQL Byte-Identical After Formatting: 8 String Syntaxes Cross-Checked, 2 Unclosed Backticks Paired Silently 2026-11-20 84 Field Names Across 7 Tabs: 2nd_field Comes in 6 Spellings and 5 Switches Move Only the Java Column 2026-11-20 Excel to JSON trusts only two numeric regexes: 0012 becomes 12, 1e5 stays a string, and the 8-cell switch matrix lands between 99 and 192 bytes 2026-11-20