﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15152	Common middleware raises UnicodeDecodeError if receives non-ASCII QUERY_STRING from buggy web server	Loststylus	Aymeric Augustin	"So, FlaxCrawler seems to like my site and visits it very often always getting a 500 error.

Here's the common traceback:

{{{
Traceback (most recent call last):

 File ""/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py"", line 80, in get_response
   response = middleware_method(request)

 File ""/usr/local/lib/python2.6/dist-packages/django/middleware/common.py"", line 79, in process_request
   newurl += '?' + request.META['QUERY_STRING']

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 3: ordinal not in range(128)


<WSGIRequest
GET:<QueryDict: {u'q': [u'\u0427\u0430\u0439\u043a\u0430']}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'CONTENT_LENGTH': '',
 'CONTENT_TYPE': '',
 'HTTP_ACCEPT': 'text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2',
 'HTTP_ACCEPT_ENCODING': 'gzip,defalte',
 'HTTP_ACCEPT_LANGUAGE': 'ru,en-us;q=0.7,en;q=0.3',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'close',
 'HTTP_HOST': '{sorry, i've got that censored out}',
 'HTTP_PRAGMA': 'no-cache',
 'HTTP_USER_AGENT': 'FlaxCrawler/1.0',
 'PATH_INFO': u'/articles/ajaxsearch',
 'QUERY_STRING': 'q=\xd0\xa7\xd0\xb0\xd0\xb9\xd0\xba\xd0\xb0',
 'REMOTE_ADDR': '92.241.173.132',
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': u'',
 'SERVER_NAME': '{sorry, i've got that censored out}',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'wsgi.errors': <flup.server.fcgi_base.TeeOutputStream object at 0x2634850>,
 'wsgi.input': <flup.server.fcgi_base.InputStream object at 0x2634610>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>
}}}

The major problem i see here is that developer cannot do anything to catch the error :(

"	Bug	closed	Core (Other)	1.2	Normal	fixed	common middleware		Accepted	0	0	0	0	0	0
