Skip to content

Fix URL fragments, empty queries and locale-dependent validation - #651

Merged
bsergean merged 3 commits into
masterfrom
fix/url-parser-components
Nov 17, 2026
Merged

bsergean merged 3 commits into
masterfrom
fix/url-parser-components

Conversation

@bsergean

@bsergean bsergean commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

The URL parser includes a fragment in the hostname when the URL has no slash, drops an explicitly empty query, accepts non-ASCII schemes in single-byte locales, and allows raw spaces/control bytes into connection/request components.

  • Treat # as an authority boundary, including hosts with explicit ports and bracketed IPv6.
  • Preserve the distinction between /path and /path? when reconstructing the request target.
  • Validate and lowercase schemes with explicit ASCII rules, independent of locale.
  • Reject raw whitespace, NUL and other ASCII control characters; percent-encoded values remain supported.

These rules follow RFC 3986. Port range checks and schemes containing digits remain covered by the tests.

Validation: the added regressions produce 24 failing assertions on master; all 159 URL-parser assertions pass with the fix. Tests are entirely in memory and measure under 1 ms per generated case. Combined plain-socket suite: 30/30 passed; targeted ASan/UBSan and MinGW compilation checks passed. Strict C++11 production build, formatting and diff checks passed.

The OpenSSL TSan failures were reproduced on current master and reduced to a standalone C++11 program using only std::thread and errno, without IXWebSocket or OpenSSL. Concurrent groups creating/joining short-lived threads cause Darwin TSan to attribute a previous thread's error-state access to a later thread reusing the same storage.

Both this PR and #653/#651 now carry the same narrow workaround: disable plain-memory TSan instrumentation only inside Socket::getErrno() and Socket::setErrno() on Apple Clang. Each function touches only OS thread-local error state. Callers, socket fields, locks and the rest of the library remain instrumented. A new thread-isolation regression test takes about 1 ms locally.

Validation of the workaround: the standalone errno reproducer is clean; an otherwise identical control with an intentional shared-variable race still reports that race. The formerly failing SOCKS5 binary passed ten consecutive TSan runs (9 seconds total). No retries, global suppressions or sleeps were added to CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant