11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_ciif (!common.hasCrypto) 71cb0ef41Sopenharmony_ci common.skip('missing crypto'); 81cb0ef41Sopenharmony_ciconst https = require('https'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst options = { 111cb0ef41Sopenharmony_ci key: fixtures.readKey('agent1-key.pem'), 121cb0ef41Sopenharmony_ci cert: fixtures.readKey('agent1-cert.pem'), 131cb0ef41Sopenharmony_ci ca: fixtures.readKey('ca1-cert.pem') 141cb0ef41Sopenharmony_ci}; 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ci// Test providing both a url and options, with the options partially 171cb0ef41Sopenharmony_ci// replacing address and port portions of the URL provided. 181cb0ef41Sopenharmony_ci{ 191cb0ef41Sopenharmony_ci const server = https.createServer( 201cb0ef41Sopenharmony_ci options, 211cb0ef41Sopenharmony_ci common.mustCall((req, res) => { 221cb0ef41Sopenharmony_ci assert.strictEqual(req.url, '/testpath'); 231cb0ef41Sopenharmony_ci res.end(); 241cb0ef41Sopenharmony_ci server.close(); 251cb0ef41Sopenharmony_ci }) 261cb0ef41Sopenharmony_ci ); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_ci server.listen( 291cb0ef41Sopenharmony_ci 0, 301cb0ef41Sopenharmony_ci common.mustCall(() => { 311cb0ef41Sopenharmony_ci https.get( 321cb0ef41Sopenharmony_ci 'https://example.com/testpath', 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci { 351cb0ef41Sopenharmony_ci hostname: 'localhost', 361cb0ef41Sopenharmony_ci port: server.address().port, 371cb0ef41Sopenharmony_ci rejectUnauthorized: false 381cb0ef41Sopenharmony_ci }, 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci common.mustCall((res) => { 411cb0ef41Sopenharmony_ci res.resume(); 421cb0ef41Sopenharmony_ci }) 431cb0ef41Sopenharmony_ci ); 441cb0ef41Sopenharmony_ci }) 451cb0ef41Sopenharmony_ci ); 461cb0ef41Sopenharmony_ci} 47