[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/fetchapi/node/main/benchmark/fixtures/simple-https-server.js [Back]  [Original]

'use strict';

const fixtures = require('../../test/common/fixtures');
const https = require('https');

const options = {
  key: fixtures.readKey('rsa_private.pem'),
  cert: fixtures.readKey('rsa_cert.crt')
};

const storedBytes = Object.create(null);
const storedBuffer = Object.create(null);

module.exports = https.createServer(options, (req, res) => {
  // URL format: ////chunkedEnc
  const params = req.url.split('/');
  const command = params[1];
  let body = '';
  const arg = params[2];
  const n_chunks = parseInt(params[3], 10);
  const chunkedEnc = params.length >= 5 && params[4] === '0' ? false : true;
  let status = 200;

  let n, i;
  if (command === 'bytes') {
    n = ~~arg;
    if (n 

Web Proxy Viewer  |  New URL  |  Original Page