librelist archives

« back to archive

Flask-Login incorrect user-agent headers fix

Flask-Login incorrect user-agent headers fix

From:
Alex K
Date:
2012-01-08 @ 07:49
We use Flask-Login extension, and it has bug with incorrect user-agent
headers.

*Traceback (most recent call last):
File "/local/lib/python2.7/site-packages/flask/app.py", line 1504, in
wsgi_app
  response = self.full_dispatch_request()
File "/local/lib/python2.7/site-packages/flask/app.py", line 1264, in
full_dispatch_request
  rv = self.handle_user_exception(e)
File "/local/lib/python2.7/site-packages/flask/app.py", line 1260, in
full_dispatch_request
  rv = self.preprocess_request()
File "/local/lib/python2.7/site-packages/flask/app.py", line 1387, in
preprocess_request
  rv = func()
File "/local/lib/python2.7/site-packages/flaskext/login.py", line 296, in
_load_user
  deleted = self._session_protection()
File "/local/lib/python2.7/site-packages/flaskext/login.py", line 310, in
_session_protection
  ident = _create_identifier()
File "/local/lib/python2.7/site-packages/flaskext/login.py", line 132, in
_create_identifier
  base = u"%s|%s" % (request.remote_addr, request.headers.get("User-Agent"))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 180:
ordinal not in range(128)*
*
*
*
*
*In Flask-Login issues created ticket 4 months ago, and seems it not fixed
:(*
*
*

https://bitbucket.org/leafstorm/flask-login/issue/4/unicodedecodeerror-in-_create_identifier

I don't want create fork, author can fix this bug?



Thanks!




*
*
*
*

Re: [flask] Flask-Login incorrect user-agent headers fix

From:
Max Countryman
Date:
2012-01-08 @ 12:51
Why don't you fork it and create a pull request? Be sure to include unit 
tests otherwise those responsible don't have a way of knowing if your 
changes were successful.

HTH,


Max

On Jan 8, 2012, at 2:49 AM, Alex K wrote:

> We use Flask-Login extension, and it has bug with incorrect user-agent headers.
> 
> Traceback (most recent call last):
>  File "/local/lib/python2.7/site-packages/flask/app.py", line 1504, in wsgi_app
>    response = self.full_dispatch_request()
>  File "/local/lib/python2.7/site-packages/flask/app.py", line 1264, in 
full_dispatch_request
>    rv = self.handle_user_exception(e)
>  File "/local/lib/python2.7/site-packages/flask/app.py", line 1260, in 
full_dispatch_request
>    rv = self.preprocess_request()
>  File "/local/lib/python2.7/site-packages/flask/app.py", line 1387, in 
preprocess_request
>    rv = func()
>  File "/local/lib/python2.7/site-packages/flaskext/login.py", line 296, 
in _load_user
>    deleted = self._session_protection()
>  File "/local/lib/python2.7/site-packages/flaskext/login.py", line 310, 
in _session_protection
>    ident = _create_identifier()
>  File "/local/lib/python2.7/site-packages/flaskext/login.py", line 132, 
in _create_identifier
>    base = u"%s|%s" % (request.remote_addr, request.headers.get("User-Agent"))
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 
180: ordinal not in range(128)
> 
> 
> 
> In Flask-Login issues created ticket 4 months ago, and seems it not fixed :(
> 
> 
https://bitbucket.org/leafstorm/flask-login/issue/4/unicodedecodeerror-in-_create_identifier
> 
> I don't want create fork, author can fix this bug?
> 
> 
> 
> 
> Thanks!
> 
> 
> 
> 
> 
> 
> 
> 
>