fix(xen-api): set hostnameRaw before creating transport

Fixes zammad#17423

Introduced by 158a8e14a

Fix XML-RPC transport.
This commit is contained in:
Julien Fontanet
2023-09-05 10:52:11 +02:00
parent 750fefe957
commit 22e7c126e6
2 changed files with 5 additions and 2 deletions

View File

@@ -12,6 +12,7 @@
> Users must be able to say: “I had this issue, happy to know it's fixed”
- [User] _Forget all connection tokens_ button should not delete other users' tokens, even when current user is an administrator (PR [#7014](https://github.com/vatesfr/xen-orchestra/pull/7014))
- [Settings/Servers] Fix connection to old XenServer hosts using XML-RPC protocol (broken in XO 5.85.0)
### Packages to release
@@ -29,6 +30,7 @@
<!--packages-start-->
- xen-api patch
- xo-server minor
- xo-web patch

View File

@@ -945,6 +945,9 @@ export class Xapi extends EventEmitter {
}
_setUrl(url) {
const { hostname } = url
url.hostnameRaw = hostname[0] === '[' ? hostname.slice(1, -1) : hostname
this._humanId = `${this._auth.user ?? 'unknown'}@${url.hostname}`
this._transport = this._createTransport({
secureOptions: {
@@ -954,8 +957,6 @@ export class Xapi extends EventEmitter {
url,
agent: this.httpAgent,
})
const { hostname } = url
url.hostnameRaw = hostname[0] === '[' ? hostname.slice(1, -1) : hostname
this._url = url
}