Source publiée
Télécharger la source ZIP
CH-J Server Manager
Parcourez les répertoires et les fichiers pour une version spécifique de l'application.
CH-J / Server Manager
196 fichiers
core-20261013T133631Z-faa4ab45100e
Ajouté: Date non enregistrée · Construit:
1
"use strict";2
// Integration check against the isolated NGINX QUIC fixture (not a public dependency).3
const assert = require('node:assert/strict');4
const path = require('node:path');5
const { curlRequest, HttpDiagnostics } = require('../src/main/diagnostics/httpDiagnostics');6
const { parseTarget, normalizeOptions } = require('../src/main/diagnostics/common');7
const { runtimePaths, validateRuntime } = require('../src/main/diagnostics/httpRuntime');8
async function main() {9
const runtime=validateRuntime();const signal=new AbortController().signal;10
const settings={timeoutMs:1200,caPath:path.resolve(__dirname,'../test/fixtures/diagnostics/ca.pem')};11
const ipv4=process.env.CHJ_TEST_QUIC_IPV4 || '127.0.0.1', ipv6=process.env.CHJ_TEST_QUIC_IPV6 || '::1';12
const records=[];13
for(const address of [ipv4,ipv6]) for(const protocol of ['1.1','2','3']) {14
const r=await curlRequest(new URL('https://localhost:18443/not-found?token=private'),address,protocol,settings,signal);15
assert.equal(r.status,'success',JSON.stringify(r));assert.equal(r.negotiated,protocol);assert.equal(r.statusCode,404);assert.equal(r.tls.verified,true);assert.equal(r.headers['set-cookie'],'[redacted]');assert.equal(r.downloadedBytes,11);delete r._body;records.push({address,protocol,...r});16
}17
const h2=await curlRequest(new URL('https://localhost:18444/'),ipv4,'2',settings,signal);assert.equal(h2.negotiated,'2');18
const noQuic=await curlRequest(new URL('https://localhost:18444/'),ipv4,'3',settings,signal);assert.notEqual(noQuic.status,'success');assert.ok(['HTTP3_UDP_TIMEOUT','CONNECTION_REFUSED'].includes(noQuic.code));19
const badCert=await curlRequest(new URL('https://localhost:18443/'),ipv4,'3',{timeoutMs:1200},signal);assert.equal(badCert.code,'TLS_CERT_INVALID');20
const wrongHost=await curlRequest(new URL('https://wrong.test:18443/'),ipv4,'3',settings,signal);assert.equal(wrongHost.code,'TLS_CERT_INVALID');21
const dns={resolve:async()=>[{address:ipv4,family:4}]};const service=new HttpDiagnostics(dns,{caPath:settings.caPath});const resources=service.resources();22
try {const options=normalizeOptions({target:'https://localhost:18443/redirect?token=private',tools:['http'],protocols:['3']});const result=await service.request(options.target,ipv4,'3',options,signal,resources);assert.equal(result.statusCode,404);assert.equal(result.redirectCount,1);records.push({...result,_body:undefined});}finally{service.dispose(resources);}23
for(const domain of ['www.ch-j.cz','www.sm.ch-j.de','www.sm.ch-j.eu']){const r=await curlRequest(new URL('https://'+domain+'/'),ipv4,'3',{timeoutMs:5000},signal);assert.equal(r.code,'HTTP3_CONFIRMED',domain+JSON.stringify(r));delete r._body;records.push({domain,...r});}24
console.log(JSON.stringify({platform:process.platform,arch:process.arch,runtime:runtime.manifest.version,records,negative:{noQuic,badCert,wrongHost}},null,2));25
}26
main().catch(error=>{console.error(error);process.exitCode=1;});SHA-256
a2f7c63addc0883fecefd6537301126333e978861196ae1aed63d6739f573dfeCH-J Proprietary Software License 1.14 · La source est fournie sous CH-J Proprietary Software License 1.14. Sa disponibilité ne modifie pas les termes de la licence ni n'accorde de droits supplémentaires.
Archive SHA-256
de757268dbc4f0226549f8b4f41f9b7e585c856ee97fa0d43b17a0e95c281449