python-socketio icon indicating copy to clipboard operation
python-socketio copied to clipboard

redis_manager.py can not validate redis password correctly when use redis.Redis.from_url()

Open bgmango opened this issue 6 years ago • 5 comments

I use redis as queue, and my redis password contain some special symbol, like '@', '#' and so on. I find redis_manager.py can not parse my redis password correctly, because from_url(redis_url) function missed a decode_components argument. I readed python-redis source code, and geted this argument default is False, but i think python-socket can supply this argument to set decode_components = True. So i was troubled by this problem, and i must change my redis password?

bgmango avatar Jan 16 '19 09:01 bgmango

Why can't you pass your redis URL already decoded?

miguelgrinberg avatar Jan 16 '19 09:01 miguelgrinberg

For example, my redis url is "redis://:123@#!@localhost:6379/0", and then i use SocketIO(app, message_queue=redis_url) to initialize, what happened is that socketio can not connect redis server.

bgmango avatar Jan 17 '19 07:01 bgmango

Did you try a urlencoded URL, such as redis://123%40%23%21@localhost:6379/0? This isn't really a problem with this package, the URL that you pass is sent into the redis package as is.

miguelgrinberg avatar Jan 17 '19 09:01 miguelgrinberg

Yes, i had tried to use "redis://123%40%23%21@localhost:6379/0", but redis return invalid password. So i had to read redis(python package) source code and found decode_components argument. If i pass the url "redis://123%40%23%21@localhost:6379/0" to python redis package, I must set decode_components argument is True.

bgmango avatar Jan 17 '19 10:01 bgmango

Okay, I think I understand. I wonder why they chose to disable urldecoding by default...

miguelgrinberg avatar Jan 17 '19 11:01 miguelgrinberg

The decode_components=True option can be passed as an extra option when creating the RedisManager class instance and then Redis will apply urldecode to the passed URL.

miguelgrinberg avatar Jan 06 '24 18:01 miguelgrinberg