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/backups minor
- @xen-orchestra/xapi major - @xen-orchestra/xapi major
- complex-matcher patch - complex-matcher patch
- xen-api patch
- xo-server patch - xo-server patch
- xo-server-audit patch - xo-server-audit patch
- xo-web minor - xo-web minor

View File

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

View File

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