go.chromium.org/luci@v0.0.0-20250314024836-d9a61d0730e6/tokenserver/testing/crlserver.sh (about)

     1  #!/bin/bash
     2  # Copyright 2016 The LUCI Authors. All rights reserved.
     3  # Use of this source code is governed under the Apache License, Version 2.0
     4  # that can be found in the LICENSE file.
     5  
     6  # crlserver.sh launches a local HTTP server that serves certificate revocation
     7  # list file to the token server.
     8  #
     9  # Its URL is specified as 'crl_url' in the token server config.
    10  
    11  cd $(dirname $0)
    12  . ./include.sh
    13  
    14  # Default SimpleHTTPServer tries to bind to '0.0.0.0' and it triggers firewall
    15  # warning on OS X.
    16  SCRIPT="
    17  import BaseHTTPServer as bhs, SimpleHTTPServer as shs;
    18  srv = bhs.HTTPServer(('127.0.0.1', $CRLSERVER_PORT), shs.SimpleHTTPRequestHandler);
    19  srv.serve_forever()
    20  "
    21  
    22  # Need to serve a parent of $CA_DIR, since $CA_DIR itself is recreated in
    23  # tests (and server continues to server delete directory).
    24  cd "$WORKING_DIR"
    25  python -c "$SCRIPT"