Skip to content

Rewritten hostname extraction from resolver URL#164

Merged
aarond10 merged 1 commit intoaarond10:masterfrom
baranyaib90:master
Nov 19, 2023
Merged

Rewritten hostname extraction from resolver URL#164
aarond10 merged 1 commit intoaarond10:masterfrom
baranyaib90:master

Conversation

@baranyaib90
Copy link
Copy Markdown
Contributor

Hi, this change fixes #160
Beside that I would recommend to close all the current issues. I think all of them are answered or we have nothing to do with them.

@baranyaib90
Copy link
Copy Markdown
Contributor Author

Nope, do not merge it yet 😅
I have forgot to test with IP address in the URL.

@baranyaib90
Copy link
Copy Markdown
Contributor Author

Now it is fixed, should be working properly.
Piggyback: some very minor logging fix.

uri = tmp;
static int is_ipv4_address(char *str) {
struct in6_addr addr;
return inet_pton(AF_INET, str, &addr) == 1;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Much nicer. Thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I hoped so. You are welcome!

return inet_pton(AF_INET, str, &addr) == 1;
}

static int hostname_from_url(const char* url_in,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nit: May be worth keeping the return code comment (non-zero == success, zero = failure).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually I have left a very minimal trace of that comment by indicating which value means success. I thought it is enough.
res = 1; // success

@aarond10 aarond10 merged commit 489c57e into aarond10:master Nov 19, 2023
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.

Hostname is not resolved if it contains a port at the end

2 participants