parent
e44857c023
commit
d2a13f531a
@ -28,5 +28,5 @@
|
||||
>
|
||||
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
||||
|
||||
- xen-api patch
|
||||
- xen-api minor
|
||||
- @xen-orchestra/proxy patch
|
||||
|
@ -1,4 +1,4 @@
|
||||
const URL_RE = /^(?:(https?:)\/*)?(?:([^:]+):([^@]+)@)?(?:\[([^\]]+)\]|([^:/]+))(?::([0-9]+))?\/?$/
|
||||
const URL_RE = /^(?:(https?:)\/*)?(?:([^:]+):([^@]+)@)?(?:\[([^\]]+)\]|([^:/]+))(?::([0-9]+))?(\/[^?#]*)?$/
|
||||
|
||||
export default url => {
|
||||
const matches = URL_RE.exec(url)
|
||||
@ -6,8 +6,8 @@ export default url => {
|
||||
throw new Error('invalid URL: ' + url)
|
||||
}
|
||||
|
||||
const [, protocol = 'https:', username, password, ipv6, hostname = ipv6, port] = matches
|
||||
const parsedUrl = { protocol, hostname, port }
|
||||
const [, protocol = 'https:', username, password, ipv6, hostname = ipv6, port, pathname = '/'] = matches
|
||||
const parsedUrl = { protocol, hostname, port, pathname }
|
||||
if (username !== undefined) {
|
||||
parsedUrl.username = decodeURIComponent(username)
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import httpRequestPlus from 'http-request-plus'
|
||||
import { format, parse } from 'json-rpc-protocol'
|
||||
import { join } from 'path'
|
||||
|
||||
import XapiError from '../_XapiError'
|
||||
|
||||
@ -16,7 +17,7 @@ export default ({ secureOptions, url, agent }) => {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
path: '/jsonrpc',
|
||||
pathname: join(url.pathname, 'jsonrpc'),
|
||||
agent,
|
||||
})
|
||||
.readAll('utf8')
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { createClient, createSecureClient } from 'xmlrpc'
|
||||
import { join } from 'path'
|
||||
import { promisify } from 'promise-toolbox'
|
||||
|
||||
import XapiError from '../_XapiError'
|
||||
@ -70,13 +71,13 @@ const parseResult = result => {
|
||||
throw new UnsupportedTransport()
|
||||
}
|
||||
|
||||
export default ({ secureOptions, url: { hostname, port, protocol }, agent }) => {
|
||||
export default ({ secureOptions, url: { hostname, port, protocol, pathname }, agent }) => {
|
||||
const secure = protocol === 'https:'
|
||||
const client = (secure ? createSecureClient : createClient)({
|
||||
...(secure ? secureOptions : undefined),
|
||||
agent,
|
||||
host: hostname,
|
||||
path: '/json',
|
||||
path: join(pathname, 'json'),
|
||||
port,
|
||||
})
|
||||
const call = promisify(client.methodCall, client)
|
||||
|
@ -30,12 +30,13 @@ const parseResult = result => {
|
||||
return result.Value
|
||||
}
|
||||
|
||||
export default ({ secureOptions, url: { hostname, port, protocol }, agent }) => {
|
||||
export default ({ secureOptions, url: { hostname, pathname, port, protocol }, agent }) => {
|
||||
const secure = protocol === 'https:'
|
||||
const client = (secure ? createSecureClient : createClient)({
|
||||
...(secure ? secureOptions : undefined),
|
||||
agent,
|
||||
host: hostname,
|
||||
pathname,
|
||||
port,
|
||||
})
|
||||
const call = promisify(client.methodCall, client)
|
||||
|
Loading…
Reference in New Issue
Block a user