Skip to content

Commit

Permalink
HH-27375 fix request query parameters logging
Browse files Browse the repository at this point in the history
  • Loading branch information
SuminAndrew committed Sep 5, 2012
1 parent 35b8818 commit fe1af6f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
19 changes: 3 additions & 16 deletions frontik/debug.xsl
Expand Up @@ -220,16 +220,9 @@
</xsl:template>

<xsl:template match="param">
<table>
<tr>
<td class="param__name">
<xsl:value-of select="@name"/><xsl:text>&#160;=&#160;</xsl:text>
</td>
<td class="param__value">
<xsl:apply-templates select="str:tokenize(string(.), '&#0013;&#0010;')" mode="line"/>
</td>
</tr>
</table>
<div>
<xsl:value-of select="@name"/><xsl:text>&#160;=&#160;</xsl:text><xsl:value-of select="."/>
</div>
</xsl:template>


Expand Down Expand Up @@ -282,12 +275,6 @@
display:block;
}

.param__name{
vertical-align:top;
}
.param__value{
vertical-align:top;
}
.servicelink{
color:#666;
font-size:.8em;
Expand Down
3 changes: 2 additions & 1 deletion frontik/handler_xml_debug.py
Expand Up @@ -17,6 +17,7 @@
import lxml.etree as etree
import tornado.options
from lxml.builder import E
from frontik.util import get_query_parameters


log = logging.getLogger('XML_debug')
Expand Down Expand Up @@ -79,7 +80,7 @@ def request_to_xml(request):
cookies.append(E.cookie(_cookies[cookie].value, name = cookie))

params = etree.Element("params")
query = urlparse.parse_qs(urlparse.urlparse(request.url).query, True)
query = get_query_parameters(request.url)
for name, values in query.iteritems():
for value in values:
params.append(E.param(unicode(value, "utf-8"), name = name))
Expand Down
6 changes: 6 additions & 0 deletions frontik/util.py
Expand Up @@ -5,8 +5,10 @@
import mimetools
import mimetypes
import logging.handlers
import re
import socket

import urlparse
from urllib import urlencode

from logging.handlers import SysLogHandler
Expand Down Expand Up @@ -52,6 +54,10 @@ def make_url(base, **query_args):
else:
return base

def get_query_parameters(url):
url = 'http://' + url if not re.match(r'[a-z]+://.+\??.*', url, re.IGNORECASE) else url
return urlparse.parse_qs(urlparse.urlparse(url).query, True)

def get_all_files(root, extension=None):
out = list()
for subdir, dirs, files in os.walk(root):
Expand Down

0 comments on commit fe1af6f

Please sign in to comment.