Skip to content

Comments

fix: ipv4 is never normalized#144

Merged
Uzlopak merged 3 commits intomainfrom
ipv4
Aug 17, 2025
Merged

fix: ipv4 is never normalized#144
Uzlopak merged 3 commits intomainfrom
ipv4

Conversation

@Uzlopak
Copy link
Contributor

@Uzlopak Uzlopak commented Aug 16, 2025

@zekth
PTAL

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Aug 16, 2025

The thing is, that since the initial commit the regex for ipv4 is very strict. I guess in uri-js the ip with octet with preceding 0 are allowed, but in fast-uri they were forbidden since the beginning.

@gurgunday gurgunday requested a review from Copilot August 17, 2025 06:38
@zekth
Copy link
Member

zekth commented Aug 17, 2025

Should we add tests for equal? Like fasturi.equal('1.1.1.1','1.01.1.1') ?

What a about serialization?

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Aug 17, 2025

@zekth

Nodejs itself does not allow for IPs with 0 prefixes. So 127.000.000.001 is considered invalid. Also, i dont know where it is specified and if I remember correctly, a 0 prefixed octet marks the number as an octal number. So e.g. 009 is an invalid octet. So 127.0.0.010 is basically 127.0.0.8.

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Aug 17, 2025

I will Update the Benchmarks as it improves the performance significantly.

@zekth
Copy link
Member

zekth commented Aug 17, 2025

I will Update the Benchmarks as it improves the performance significantly.

Great let's do this then.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Uzlopak
Copy link
Contributor Author

Uzlopak commented Aug 17, 2025

@zekth

Done. as you can see it is about 57% faster for ipv4.

@Uzlopak Uzlopak merged commit ee22a06 into main Aug 17, 2025
29 checks passed
@Uzlopak Uzlopak deleted the ipv4 branch August 17, 2025 18:56
mergify bot added a commit to ArcadeData/arcadedb that referenced this pull request Oct 12, 2025
…n /studio [skip ci]

Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.0.6 to 3.1.0.
Release notes

*Sourced from [fast-uri's releases](https://github.com/fastify/fast-uri/releases).*

> v3.1.0
> ------
>
> What's Changed
> --------------
>
> * ci: remove master branch support by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#126](https://redirect.github.com/fastify/fast-uri/pull/126)
> * chore(test) remove .gitkeep by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#128](https://redirect.github.com/fastify/fast-uri/pull/128)
> * ci(ci): set job permissions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#129](https://redirect.github.com/fastify/fast-uri/pull/129)
> * ci: set permissions at workflow level by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#131](https://redirect.github.com/fastify/fast-uri/pull/131)
> * ci: set workflow permissions to read-only by default by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#132](https://redirect.github.com/fastify/fast-uri/pull/132)
> * ci(ci): restore job level permissions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#133](https://redirect.github.com/fastify/fast-uri/pull/133)
> * build(deps-dev): bump tsd from 0.31.2 to 0.32.0 by [`@​dependabot`](https://github.com/dependabot)[bot] in [fastify/fast-uri#134](https://redirect.github.com/fastify/fast-uri/pull/134)
> * ci(ci): pin actions to commit-hash by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#135](https://redirect.github.com/fastify/fast-uri/pull/135)
> * ci: add node 24 to test matrix by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#136](https://redirect.github.com/fastify/fast-uri/pull/136)
> * ci: use tags for immutable github actions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#137](https://redirect.github.com/fastify/fast-uri/pull/137)
> * chore(license): update date ranges; standardise style by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#138](https://redirect.github.com/fastify/fast-uri/pull/138)
> * fix(lib/utils): simpler algorithm for removeDotSegments by [`@​wooffie`](https://github.com/wooffie) in [fastify/fast-uri#140](https://redirect.github.com/fastify/fast-uri/pull/140)
> * chore: remove uri-js by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#142](https://redirect.github.com/fastify/fast-uri/pull/142)
> * chore: replace benchmark with tinybench by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#143](https://redirect.github.com/fastify/fast-uri/pull/143)
> * fix: ipv4 is never normalized by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#144](https://redirect.github.com/fastify/fast-uri/pull/144)
> * feat: add browser testing by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#146](https://redirect.github.com/fastify/fast-uri/pull/146)
> * Update README.md by [`@​zekth`](https://github.com/zekth) in [fastify/fast-uri#145](https://redirect.github.com/fastify/fast-uri/pull/145)
> * chore: use jsdoc for static code analysis by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#147](https://redirect.github.com/fastify/fast-uri/pull/147)
> * fix(lib/schemes/urn): check nid for undefined by [`@​wooffie`](https://github.com/wooffie) in [fastify/fast-uri#141](https://redirect.github.com/fastify/fast-uri/pull/141)
>
> New Contributors
> ----------------
>
> * [`@​wooffie`](https://github.com/wooffie) made their first contribution in [fastify/fast-uri#140](https://redirect.github.com/fastify/fast-uri/pull/140)
>
> **Full Changelog**: <fastify/fast-uri@v3.0.6...v3.1.0>


Commits

* [`2d08e68`](fastify/fast-uri@2d08e68) v3.1.0
* [`4f8cdd1`](fastify/fast-uri@4f8cdd1) fix(lib/schemes/urn): check nid for undefined ([#141](https://redirect.github.com/fastify/fast-uri/issues/141))
* [`eedf840`](fastify/fast-uri@eedf840) chore: use jsdoc for static code analysis ([#147](https://redirect.github.com/fastify/fast-uri/issues/147))
* [`fbf4545`](fastify/fast-uri@fbf4545) Update README.md ([#145](https://redirect.github.com/fastify/fast-uri/issues/145))
* [`56b0c74`](fastify/fast-uri@56b0c74) feat: add browser testing ([#146](https://redirect.github.com/fastify/fast-uri/issues/146))
* [`ee22a06`](fastify/fast-uri@ee22a06) fix: ipv4 is never normalized ([#144](https://redirect.github.com/fastify/fast-uri/issues/144))
* [`509dd94`](fastify/fast-uri@509dd94) chore: replace benchmark with tinybench ([#143](https://redirect.github.com/fastify/fast-uri/issues/143))
* [`7a16582`](fastify/fast-uri@7a16582) chore: remove uri-js ([#142](https://redirect.github.com/fastify/fast-uri/issues/142))
* [`f0160b0`](fastify/fast-uri@f0160b0) fix(lib/utils): simpler algorithm for removeDotSegments ([#140](https://redirect.github.com/fastify/fast-uri/issues/140))
* [`14d12da`](fastify/fast-uri@14d12da) chore(license): update date ranges; standardise style ([#138](https://redirect.github.com/fastify/fast-uri/issues/138))
* Additional commits viewable in [compare view](fastify/fast-uri@v3.0.6...v3.1.0)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=fast-uri&package-manager=npm\_and\_yarn&previous-version=3.0.6&new-version=3.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
You can trigger a rebase of this PR by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
> \*\*Note\*\*
> Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
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.

2 participants