Mercurial > prosody-hg
comparison net/resolvers/basic.lua @ 14112:59064f0f8b4e
Merge 13.0->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 24 Mar 2026 17:28:53 +0100 |
| parents | bc33a7269f5a 1cf6e3f49d10 |
| children |
comparison
equal
deleted
inserted
replaced
| 14109:3d1ac10a7901 | 14112:59064f0f8b4e |
|---|---|
| 71 end | 71 end |
| 72 cb(next_target[1], next_target[2], next_target[3], next_target[4], not not self.targets[1]); | 72 cb(next_target[1], next_target[2], next_target[3], next_target[4], not not self.targets[1]); |
| 73 return; | 73 return; |
| 74 end | 74 end |
| 75 | 75 |
| 76 if not self.port then | |
| 77 self.last_error = "indeterminate port"; | |
| 78 cb(nil); | |
| 79 return; | |
| 80 end | |
| 81 | |
| 76 if not self.hostname then | 82 if not self.hostname then |
| 77 self.last_error = "hostname failed IDNA"; | 83 self.last_error = "hostname failed IDNA"; |
| 78 cb(nil); | 84 cb(nil); |
| 79 return; | 85 return; |
| 80 end | 86 end |
| 129 | 135 |
| 130 local is_ip = inet_pton(hostname); | 136 local is_ip = inet_pton(hostname); |
| 131 if not is_ip and hostname:sub(1,1) == '[' then | 137 if not is_ip and hostname:sub(1,1) == '[' then |
| 132 is_ip = inet_pton(hostname:sub(2,-2)); | 138 is_ip = inet_pton(hostname:sub(2,-2)); |
| 133 end | 139 end |
| 134 if is_ip then | 140 if is_ip and port then |
| 135 hostname = inet_ntop(is_ip); | 141 hostname = inet_ntop(is_ip); |
| 136 if #is_ip == 16 then | 142 if #is_ip == 16 then |
| 137 targets = { { conn_type.."6", hostname, port, extra } }; | 143 targets = { { conn_type.."6", hostname, port, extra } }; |
| 138 elseif #is_ip == 4 then | 144 elseif #is_ip == 4 then |
| 139 targets = { { conn_type.."4", hostname, port, extra } }; | 145 targets = { { conn_type.."4", hostname, port, extra } }; |
