MCPcopy Create free account
hub / github.com/csound/csound / SanityCheckDirectory

Function SanityCheckDirectory

Emscripten/examples/httpd.py:32–42  ·  view source on GitHub ↗
(dirname)

Source from the content-addressed store, hash-verified

30# if the machine might be a multi-user machine and not all users are trusted.
31# We only serve via the loopback interface.
32def SanityCheckDirectory(dirname):
33 abs_serve_dir = os.path.abspath(dirname)
34
35 # Verify we don't serve anywhere above NACL_SDK_ROOT.
36 if abs_serve_dir[:len(NACL_SDK_ROOT)] == NACL_SDK_ROOT:
37 return
38 logging.error('For security, httpd.py should only be run from within the')
39 logging.error('example directory tree.')
40 logging.error('Attempting to serve from %s.' % abs_serve_dir)
41 logging.error('Run with --no_dir_check to bypass this check.')
42 sys.exit(1)
43
44
45class PluggableHTTPServer(BaseHTTPServer.HTTPServer):

Callers 1

mainFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected