Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/netwerk/test/mochitests/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 723 B image not shown  

Quelle  authenticate.sjs  Sprache: unbekannt

 
Spracherkennung für: .sjs vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

function handleRequest(request, response) {
  const expectedAuth = "Basic " + btoa("user:pass");

  let actualAuth = request.hasHeader("Authorization")
    ? request.getHeader("Authorization")
    : null;

  if (actualAuth === expectedAuth) {
    response.setStatusLine("1.1", 200, "OK");
    response.write("Authenticated");
  } else {
    response.setStatusLine("1.1", 401, "Unauthorized");
    response.setHeader("WWW-Authenticate", 'Basic realm="TestRealm"');
    response.write("Authentication required");
  }
}

[Dauer der Verarbeitung: 0.16 Sekunden, vorverarbeitet 2026-10-01]