11cb0ef41Sopenharmony_ci/* eslint-disable node-core/crypto-check */ 21cb0ef41Sopenharmony_ci// Flags: --expose-internals 31cb0ef41Sopenharmony_ci'use strict'; 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst common = require('../common'); 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst { kOutHeaders } = require('internal/http'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst http = require('http'); 111cb0ef41Sopenharmony_ciconst modules = { http }; 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciif (common.hasCrypto) { 141cb0ef41Sopenharmony_ci const https = require('https'); 151cb0ef41Sopenharmony_ci modules.https = https; 161cb0ef41Sopenharmony_ci} 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciObject.keys(modules).forEach((module) => { 191cb0ef41Sopenharmony_ci const doNotCall = common.mustNotCall( 201cb0ef41Sopenharmony_ci `${module}.request should not connect to ${module}://example.com%60x.example.com` 211cb0ef41Sopenharmony_ci ); 221cb0ef41Sopenharmony_ci const req = modules[module].request(`${module}://example.com%60x.example.com`, doNotCall); 231cb0ef41Sopenharmony_ci assert.deepStrictEqual(req[kOutHeaders].host, [ 241cb0ef41Sopenharmony_ci 'Host', 251cb0ef41Sopenharmony_ci 'example.com`x.example.com', 261cb0ef41Sopenharmony_ci ]); 271cb0ef41Sopenharmony_ci req.abort(); 281cb0ef41Sopenharmony_ci}); 29