Skip to content

Commit

Permalink
Set the cookie "path" property when a document is specified in IE
Browse files Browse the repository at this point in the history
  • Loading branch information
jimevans committed Aug 6, 2018
1 parent 921f489 commit bfe567d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
15 changes: 15 additions & 0 deletions cpp/iedriver/CommandHandlers/AddCookieCommandHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ void AddCookieCommandHandler::ExecuteInternal(
return;
}

size_t last_path_slash_index = cookie.path().find_last_of("/");
if (last_path_slash_index != std::string::npos) {
std::string last_path_segment = cookie.path().substr(last_path_slash_index);
if (last_path_segment.size() > 1 &&
last_path_segment.find(".") != std::string::npos) {
// This algorithm is far from perfect. If the "path" property of the
// cookie includes the document name, the cookie won't be properly set,
// as IE's cookie handling expects a directory for path, not a file
// or document name. Strip the last segment of the path property (if
// if the path segment doesn't already end in a slash, and contains
// a period).
cookie.set_path(cookie.path().substr(0, last_path_slash_index));
}
}

status_code = browser_wrapper->cookie_manager()->SetCookie(
browser_wrapper->GetCurrentUrl(),
cookie);
Expand Down
8 changes: 4 additions & 4 deletions cpp/iedriver/IEDriver.rc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,14,0,0
PRODUCTVERSION 3,14,0,0
FILEVERSION 3,14,0,1
PRODUCTVERSION 3,14,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,12 +68,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Software Freedom Conservancy"
VALUE "FileDescription", "Driver library for the IE driver"
VALUE "FileVersion", "3.14.0.0"
VALUE "FileVersion", "3.14.0.1"
VALUE "InternalName", "IEDriver.dll"
VALUE "LegalCopyright", "Copyright (C) 2018"
VALUE "OriginalFilename", "IEDriver.dll"
VALUE "ProductName", "Selenium WebDriver"
VALUE "ProductVersion", "3.14.0.0"
VALUE "ProductVersion", "3.14.0.1"
END
END
BLOCK "VarFileInfo"
Expand Down
5 changes: 5 additions & 0 deletions cpp/iedriverserver/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ available via the project downloads page. Changes in "revision" field indicate
private releases checked into the prebuilts directory of the source tree, but
not made generally available on the downloads page.

v3.14.0.1
=========
* Updating to properly set the "path" property on cookies when a document
is specified in the property.

v3.14.0.0
=========
* Release to synchronize with release of Selenium project.
Expand Down
8 changes: 4 additions & 4 deletions cpp/iedriverserver/IEDriverServer.rc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,14,0,0
PRODUCTVERSION 3,14,0,0
FILEVERSION 3,14,0,1
PRODUCTVERSION 3,14,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,12 +68,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Software Freedom Conservancy"
VALUE "FileDescription", "Command line server for the IE driver"
VALUE "FileVersion", "3.14.0.0"
VALUE "FileVersion", "3.14.0.1"
VALUE "InternalName", "IEDriverServer.exe"
VALUE "LegalCopyright", "Copyright (C) 2018"
VALUE "OriginalFilename", "IEDriverServer.exe"
VALUE "ProductName", "Selenium WebDriver"
VALUE "ProductVersion", "3.14.0.0"
VALUE "ProductVersion", "3.14.0.1"
END
END
BLOCK "VarFileInfo"
Expand Down
Binary file modified cpp/prebuilt/Win32/Release/IEDriverServer.exe
Binary file not shown.
Binary file modified cpp/prebuilt/x64/Release/IEDriverServer.exe
Binary file not shown.

0 comments on commit bfe567d

Please sign in to comment.