How to fix Ruby Rack SessionId error Error: undefined class/module Rack::Session::SessionId when decoding the rack.session cookie
How to fix Ruby Rack SessionId error Error: undefined class/module Rack::Session::SessionId when decoding the rack.session cookie
在编写 ruby 脚本来解码机架会话 cookie 并使用 ruby 函数 Marshal load 加载对象时,我收到以下错误:
Error: undefined class/module Rack::Session::SessionId
这是我的 ruby 脚本:
require 'pp'
require 'base64'
require 'uri'
require 'rack' # solves the error: Error: undefined class/module Rack::
c = gets
cookie, signature = c.split("--")
decoded = Base64.decode64(URI.decode(cookie))
begin
object = Marshal.load(decoded)
pp object
rescue ArgumentError => e
puts "Error: " + e.to_s
end
我该如何解决这个问题?我尝试在 Whosebug 上寻找解决方案,但无法弄清楚。
感谢 Louis Nyffenegger (@snyff) 帮助我解决这个问题
https://twitter.com/snyff/status/1407054131697758211?s=20
这个错误可以通过创建 method stub
来解决
require 'pp'
require 'base64'
require 'uri'
require 'rack'
class Rack::Session::SessionId
end
c = gets
cookie, signature = c.split("--")
decoded = Base64.decode64(URI.decode(cookie))
begin
object = Marshal.load(decoded)
pp object
rescue ArgumentError => e
puts "Error: " + e.to_s
end
在编写 ruby 脚本来解码机架会话 cookie 并使用 ruby 函数 Marshal load 加载对象时,我收到以下错误:
Error: undefined class/module Rack::Session::SessionId
这是我的 ruby 脚本:
require 'pp'
require 'base64'
require 'uri'
require 'rack' # solves the error: Error: undefined class/module Rack::
c = gets
cookie, signature = c.split("--")
decoded = Base64.decode64(URI.decode(cookie))
begin
object = Marshal.load(decoded)
pp object
rescue ArgumentError => e
puts "Error: " + e.to_s
end
我该如何解决这个问题?我尝试在 Whosebug 上寻找解决方案,但无法弄清楚。
感谢 Louis Nyffenegger (@snyff) 帮助我解决这个问题 https://twitter.com/snyff/status/1407054131697758211?s=20
这个错误可以通过创建 method stub
来解决require 'pp'
require 'base64'
require 'uri'
require 'rack'
class Rack::Session::SessionId
end
c = gets
cookie, signature = c.split("--")
decoded = Base64.decode64(URI.decode(cookie))
begin
object = Marshal.load(decoded)
pp object
rescue ArgumentError => e
puts "Error: " + e.to_s
end