[mod_python] Re: Cookie problems with mobile phones

Jason Stubbs jstubbs at work-at.co.jp
Thu Nov 10 20:07:20 EST 2005


Robert Wallner wrote:
> On 11/10/05, Sebastjan Trepca <trepca at gmail.com> wrote:
>>we have a problem when users access our site with mobile devices, it
>>seems that Cookie class has some problems with them...
>>
>>Apache access log:
>>213.229.249.42 - - [10/Nov/2005:11:50:32 +0100] "GET / HTTP/1.1" 500
>>601 "-" "SonyEricssonZ1010/R1H SEMC-Browser/4.0.2 Profile/MIDP-2.0
>>Configuration/CLDC-1.1"
>>213.229.249.42 - - [10/Nov/2005:11:50:45 +0100] "GET / HTTP/1.1" 500
>>601 "-" "SonyEricssonZ1010/R1H SEMC-Browser/4.0.2 Profile/MIDP-2.0
>>Configuration/CLDC-1.1"
>>213.229.249.42 - - [10/Nov/2005:11:51:44 +0100] "GET / HTTP/1.1" 500
>>601 "-" "SonyEricssonZ1010/R1H SEMC-Browser/4.0.2 Profile/MIDP-2.0
>>Configuration/CLDC-1.1"
>>
>>Apache error log:
>>[Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
>>PythonHandler test.portal.handler:   File
>>"/usr/lib64/python2.4/site-packages/mod_python/Session.py", line 114,
>>in __init__\n    cookies = Cookie.get_cookies(req)
>>[Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
>>PythonHandler test.portal.handler:   File
>>"/usr/lib64/python2.4/site-packages/mod_python/Cookie.py", line 369,
>>in get_cookies\n    return Class.parse(cookies, **kw)
>>[Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
>>PythonHandler test.portal.handler:   File
>>"/usr/lib64/python2.4/site-packages/mod_python/Cookie.py", line 115,
>>in parse\n    dict = _parse_cookie(str, Class)
>>[Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
>>PythonHandler test.portal.handler:   File
>>"/usr/lib64/python2.4/site-packages/mod_python/Cookie.py", line 329,
>>in _parse_cookie\n    setattr(c, l_key, val)
>>[Thu Nov 10 11:51:44 2005] [error] [client 213.229.249.42]
>>PythonHandler test.portal.handler: AttributeError: 'Cookie' object has
>>no attribute '$version'
 >
> I have the same problem with mobile devices. Changing line 329 in
> /usr/lib/python2.4/site-packages/mod_python/Cookie.py from:
> 
> if (l_key in valid or key[0] == '$'):
> 
> to:
> 
> if (l_key in valid):
> 
> seems to resolve the problem for mobile devices, while not affecting
> other browsers. Still, I don't know what other side effects may this
> change have, as I didn't find anything about this problem on the net.

Not sure if it's the same in your countr(y/ies) as it is in Japan, but 
the current
available mobile phones do not support client-side cookies at all. Try 
disabling
cookies in your PC's browser and see if the same issue arises. Can't 
offer any
help other than that, but lack of support for client-side cookies is 
probably
what is triggering the bug.

--
Jason Stubbs


More information about the Mod_python mailing list