How to decode a cookie from the header of a websocket connection handshake? (Ruby)

我们两清 提交于 2019-11-29 11:21:29

The answer is to use Rack::Utils.unencode.

I now have this working

Marshal.load(rack_cookie.coder.decode(Rack::Utils.unescape(bakesale.split('--').first))) decodes perfectly to the hash I need, allowing me to extract the user ID. W00t!

Many thanks to User spastorino over at https://github.com/rack/rack/issues/551 for pointing me in the right direction.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!