chore(xen-api): expose bracketless IPv6 as hostnameRaw

This commit is contained in:
Julien Fontanet 2023-07-18 16:40:34 +02:00
parent 0c97910349
commit 158a8e14a2
3 changed files with 5 additions and 4 deletions

View File

@ -36,6 +36,7 @@
- @xen-orchestra/backups minor
- @xen-orchestra/xapi major
- complex-matcher patch
- xen-api patch
- xo-server patch
- xo-server-audit patch
- xo-web minor

View File

@ -954,6 +954,8 @@ export class Xapi extends EventEmitter {
url,
agent: this.httpAgent,
})
const { hostname } = url
url.hostnameRaw = hostname[0] === '[' ? hostname.slice(1, -1) : hostname
this._url = url
}

View File

@ -30,14 +30,12 @@ const parseResult = result => {
return result.Value
}
const removeBrackets = hostname => (hostname[0] === '[' ? hostname.slice(1, -1) : hostname)
export default ({ secureOptions, url: { hostname, pathname, port, protocol }, agent }) => {
export default ({ secureOptions, url: { hostnameRaw, pathname, port, protocol }, agent }) => {
const secure = protocol === 'https:'
const client = (secure ? createSecureClient : createClient)({
...(secure ? secureOptions : undefined),
agent,
host: removeBrackets(hostname),
host: hostnameRaw,
pathname,
port,
})