| 536 | } |
| 537 | |
| 538 | function parseUrl(url) { |
| 539 | if (!url || typeof url !== 'string') |
| 540 | return { url: { searchParams: new Map() } } |
| 541 | |
| 542 | let host = url |
| 543 | host = host.slice(host.indexOf('://') + 3).split(/[?/]/)[0] |
| 544 | host = decodeURIComponent(host.slice(host.indexOf('@') + 1)) |
| 545 | |
| 546 | const urlObj = new URL(url.replace(host, host.split(',')[0])) |
| 547 | |
| 548 | return { |
| 549 | url: { |
| 550 | username: decodeURIComponent(urlObj.username), |
| 551 | password: decodeURIComponent(urlObj.password), |
| 552 | host: urlObj.host, |
| 553 | hostname: urlObj.hostname, |
| 554 | port: urlObj.port, |
| 555 | pathname: urlObj.pathname, |
| 556 | searchParams: urlObj.searchParams |
| 557 | }, |
| 558 | multihost: host.indexOf(',') > -1 && host |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | function osUsername() { |
| 563 | try { |