Skip to content

Conversation

@XadillaX
Copy link
Contributor

No description provided.

@github-actionsgithub-actionsbot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels May 29, 2021
@XadillaXXadillaX changed the title url,src: simplify ipv6 code by using inet_pton[WIP] url,src: simplify ipv6 code by using inet_ptonMay 29, 2021
@XadillaXXadillaX changed the title [WIP] url,src: simplify ipv6 code by using inet_ptonurl,src: simplify ipv6 code by using inet_ptonMay 30, 2021
@XadillaXXadillaX changed the title url,src: simplify ipv6 code by using inet_ptonurl,src: simplify ipv6 logic by using uv_inet_ptonMay 30, 2021
src/node_url.cc Outdated
std::string domain_or_opaque;
uint32_t ipv4;
uint16_t ipv6[8];
uint16_t ipv6[NS_IN6ADDRSZ / NS_INT16SZ];
Copy link
Member

Choose a reason for hiding this comment

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

I think just 8 was a bit clearer here, to be honest…

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

I don’t think glibc is the gold standard for code readability here.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I've changed it back.🐣

memset(buf, 0, sizeof(buf));
memcpy(*ipv6, input, sizeof(constchar) * length);

int ret = uv_inet_pton(AF_INET6, *ipv6, buf);
Copy link
Member

Choose a reason for hiding this comment

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

In theory I'm +1 but we need to make sure that uv_inet_pton matches what the url standard expects here. The reason for the more complicated implementation is that it's what the standard spec specifically calls out.

Copy link
ContributorAuthor

@XadillaXXadillaXMay 31, 2021

Choose a reason for hiding this comment

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

  1. It passes wpt;
  2. uv_inet_ntop and inet_ntop breaks URLHost::ToString() because it does not match web standard ...:x.x.x.x. So I do not modify logic by using *_ntop.

@nodejs-github-bot
Copy link
Collaborator

XadillaX added a commit that referenced this pull request Jun 10, 2021
@XadillaX
Copy link
ContributorAuthor

Landed in c109a6c

targos pushed a commit that referenced this pull request Jun 11, 2021
@danielleadamsdanielleadams mentioned this pull request Jun 14, 2021
danielleadams pushed a commit that referenced this pull request Jun 17, 2021
richardlau pushed a commit that referenced this pull request Jul 19, 2021
richardlau pushed a commit that referenced this pull request Jul 20, 2021
@richardlaurichardlau mentioned this pull request Jul 20, 2021
foxxyz pushed a commit to foxxyz/node that referenced this pull request Oct 18, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++Issues and PRs that require attention from people who are familiar with C++.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@XadillaX@nodejs-github-bot@jasnell@addaleax