In my feed that is published to feedburner I have Russian characters in campaign name in tracking settings Feed: ${feedUri} ${feedName}
. The problem is that it results as incorrect __utmz cookie set by Google Analytics, and cannot be processed by my backend (which is web.py).
File "/home/dw0rm/lib/ve/lib/python2.7/site-packages/web/session.py", line 96, in _load
self.session_id = web.cookies().get(cookie_name)
File "/home/dw0rm/lib/ve/lib/python2.7/site-packages/web/webapi.py", line 359, in cookies
cookie.load(ctx.env.get('HTTP_COOKIE', ''))
File "/usr/local/lib/python2.7/Cookie.py", line 627, in load
self.__ParseString(rawdata)
File "/usr/local/lib/python2.7/Cookie.py", line 660, in __ParseString
self.__set(K, rval, cval)
File "/usr/local/lib/python2.7/Cookie.py", line 580, in __set
M.set(key, real_value, coded_value)
File "/usr/local/lib/python2.7/Cookie.py", line 455, in set
raise CookieError("Illegal key value: %s" % key)
CookieError: Illegal key value: )|utmcmd
This error occurred in Firefox, and I have managed to fix it with this code:
def myinternalerror():
try:
web.cookies()
except CookieError:
if not "cookie_err" in web.input():
web.setcookie("__utmz", None, domain=web.ctx.host)
raise web.seeother(web.changequery(cookie_err=1))
return web.internalerror(render.site.e500())
app.internalerror = myinternalerror
But today I got this "cookie_err=1" redirect even in Chrome. I tried this on some other sites that are based on web.py and Analytics, and they all raise internal server error. And this error keeps until the illegal cookie is removed, which is a difficult thing to do by a regular visitor.
I want to know what other options I should consider. Maybe Python Cookie module is incorrect, or it is browser's bug that lets in incorrect cookie. This stuff can be used for malicious purposes, because there are many Python websites that use Google Analytics and Cookie module.
This is tracking query: utm_source=feedburner&utm_medium=twitter&utm_campaign=Feed%3A+cafenovru+%28%D0%9E%D0%BF%D0%B8%D1%81%D1%8C+%D1%82%D1%80%D0%B0%D0%BF%D0%B5%D0%B7%D0%BD%D1%8B%D1%85+%D0%92%D0%B5%D0%BB%D0%B8%D0%BA%D0%BE%D0%B3%D0%BE+%D0%9D%D0%BE%D0%B2%D0%B3%D0%BE%D1%80%D0%BE%D0%B4%D0%B0%29
Incorrect __utmz cookie value is 37098290.1322168259.5.3.utmcsr=feedburner|utmccn=Feed:%20cafenovru%20(Опись%20трапезных%20Великого%20Новгорода)|utmcmd=twitter
Illegal cookie is set by Analytics javascript on the first page access, and server side error appears on subsequent requests.