Created
February 1, 2009 03:02
-
-
Save brandon-beacher/55772 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class KookieStore < CGI::Session::CookieStore | |
private | |
def read_cookie | |
# use the real cookie if we can | |
cookie = super | |
unless cookie | |
# didn't find the real cookie, is this a multipart upload? | |
match_data = /^multipart\/form-data; boundary=(.+)/.match @session.cgi.env_table["CONTENT_TYPE"] | |
if match_data | |
# it is a multipart upload - use cookie value in form data (if present) | |
boundary = WEBrick::HTTPUtils::dequote match_data[1] | |
form_data = WEBrick::HTTPUtils.parse_form_data @session.cgi.stdinput, boundary | |
cookie = form_data[@cookie_options["name"]] | |
end | |
end | |
cookie | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment