Skip to content

Instantly share code, notes, and snippets.

@joneskoo
Created November 26, 2011 13:33
Show Gist options
  • Save joneskoo/1395673 to your computer and use it in GitHub Desktop.
Save joneskoo/1395673 to your computer and use it in GitHub Desktop.
Print all headers available to the web server except some non-public headers
#!/usr/bin/python
print "Content-type: text/plain; charset=UTF-8"
print
import os
ignore_these = [
'PATH',
'DOCUMENT_ROOT',
'SCRIPT_FILENAME',
'SERVER_ADMIN',
'SERVER_NAME',
'GATEWAY_INTERFACE',
'SERVER_SOFTWARE',
'SERVER_SIGNATURE'
]
env = os.environ.items()
env.sort()
for (name, value) in env:
if name not in ignore_these:
print '%s = "%s"' % (name, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment