From 904bb144906d6fb2202ef67bc575fdb037387236 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 18 Jun 2009 21:49:28 +0000 Subject: [PATCH] - MGR: Fix the case where user visits Grid Republic with IE 7 and has a space character in their username. IE6 and below kept the space as part of the filename, IE7 and above replace the space with an underscore. clientgui/ browser.cpp svn path=/trunk/boinc/; revision=18450 --- checkin_notes | 9 +++++++++ clientgui/browser.cpp | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/checkin_notes b/checkin_notes index 9428a2cb07..347ed41bb9 100644 --- a/checkin_notes +++ b/checkin_notes @@ -5795,3 +5795,12 @@ Rom 18 June 2009 clientgui/ browser.cpp + +Rom 18 June 2009 + - MGR: Fix the case where user visits Grid Republic with IE 7 and + has a space character in their username. IE6 and below kept + the space as part of the filename, IE7 and above replace the + space with an underscore. + + clientgui/ + browser.cpp diff --git a/clientgui/browser.cpp b/clientgui/browser.cpp index 2a02601ff6..1726e366f8 100644 --- a/clientgui/browser.cpp +++ b/clientgui/browser.cpp @@ -836,7 +836,7 @@ bool find_site_cookie_ie( // undocumented. // bool detect_cookie_ie_unsupported(std::string& project_url, std::string& name, std::string& value) { - char buf[512]; + char buf[512], buf2[512]; int i; std::string cookie_path; std::string username; @@ -846,6 +846,7 @@ bool detect_cookie_ie_unsupported(std::string& project_url, std::string& name, s // Initialize variables i = 0; strcpy(buf, ""); + strcpy(buf2, ""); // Determine which path to look for the cookie files in get_internet_explorer_cookie_path(true, cookie_path); @@ -869,11 +870,20 @@ bool detect_cookie_ie_unsupported(std::string& project_url, std::string& name, s // // Construct the host cookie file name // + + // Original naming scheme snprintf(buf, sizeof(buf), "%s%s@%s[%d].txt", cookie_path.c_str(), username.c_str(), hostname.c_str(), i); if (find_site_cookie_ie((char*)&buf, hostname, name, value)) { break; } + // IE 7.x or better + string_substitute(buf, buf2, sizeof(buf2), " ", "_"); + if (find_site_cookie_ie((char*)&buf2, hostname, name, value)) { + break; + } + + // // Construct the domainname cookie file name // @@ -881,6 +891,12 @@ bool detect_cookie_ie_unsupported(std::string& project_url, std::string& name, s if (find_site_cookie_ie((char*)&buf, domainname, name, value)) { break; } + + // IE 7.x or better + string_substitute(buf, buf2, sizeof(buf2), " ", "_"); + if (find_site_cookie_ie((char*)&buf2, domainname, name, value)) { + break; + } } if (!name.empty() && !value.empty()) {