From 4326cbbec13f44e6d8c757f1d07fd6100596bfb6 Mon Sep 17 00:00:00 2001 From: Bryan Chow Date: Wed, 3 Mar 2010 15:30:30 -0800 Subject: Factor headers data out of HeaderDebugPanel. --- debug_toolbar/debug/headers.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 debug_toolbar/debug/headers.py (limited to 'debug_toolbar/debug') diff --git a/debug_toolbar/debug/headers.py b/debug_toolbar/debug/headers.py new file mode 100644 index 0000000..08b5bbf --- /dev/null +++ b/debug_toolbar/debug/headers.py @@ -0,0 +1,30 @@ +class DebugHeaders(object): + + # List of headers we want to display + header_filter = ( + 'CONTENT_TYPE', + 'HTTP_ACCEPT', + 'HTTP_ACCEPT_CHARSET', + 'HTTP_ACCEPT_ENCODING', + 'HTTP_ACCEPT_LANGUAGE', + 'HTTP_CACHE_CONTROL', + 'HTTP_CONNECTION', + 'HTTP_HOST', + 'HTTP_KEEP_ALIVE', + 'HTTP_REFERER', + 'HTTP_USER_AGENT', + 'QUERY_STRING', + 'REMOTE_ADDR', + 'REMOTE_HOST', + 'REQUEST_METHOD', + 'SCRIPT_NAME', + 'SERVER_NAME', + 'SERVER_PORT', + 'SERVER_PROTOCOL', + 'SERVER_SOFTWARE', + ) + + def available_headers(self, request): + return dict( + [(k, request.META[k]) for k in self.header_filter if k in request.META] + ) -- cgit v1.2.3