From 571a5196ef049cc1a948370753528a864653a7c0 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Sun, 7 Sep 2008 11:03:22 -0700 Subject: Adding a new panel to display HTTP headers --- debug_toolbar/panels/headers.py | 52 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 debug_toolbar/panels/headers.py (limited to 'debug_toolbar') diff --git a/debug_toolbar/panels/headers.py b/debug_toolbar/panels/headers.py new file mode 100644 index 0000000..ab39b85 --- /dev/null +++ b/debug_toolbar/panels/headers.py @@ -0,0 +1,52 @@ +from django.template import Context, Template +from debug_toolbar.panels import DebugPanel + +class HeaderDebugPanel(DebugPanel): + """ + A panel to display HTTP headers. + """ + name = 'Header' + # 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 title(self): + return 'HTTP Headers' + + def url(self): + return '' + + def content(self): + t = Template(''' +