forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The IE driver should now be able to return full information for most cookies, including expiration date and secure status. Additionally, the driver will now return HTTP-only cookies from IE. Note that some specific cookie information will still be incomplete. In particular, session cookies that may have been set with domain, path, or secure tokens in the cookie string will not have those tokens set in the returned cookie, as that information is not available via any API. Also note that this change introduces additional use of Windows APIs that are not supported when run from a service process, making that more completely unsupported. Fixes issue SeleniumHQ#391.
- Loading branch information
Showing
21 changed files
with
8,726 additions
and
8,543 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "BrowserCookie.h" | ||
#include "json.h" | ||
|
||
namespace webdriver { | ||
|
||
BrowserCookie::BrowserCookie(void) { | ||
this->name_ = ""; | ||
this->value_ = ""; | ||
this->domain_ = ""; | ||
this->path_ = ""; | ||
this->expiration_time_ = 0L; | ||
this->is_secure_ = false; | ||
this->is_httponly_ = false; | ||
} | ||
|
||
BrowserCookie::~BrowserCookie(void) { | ||
} | ||
|
||
Json::Value BrowserCookie::ToJson() { | ||
Json::Value cookie; | ||
cookie["name"] = this->name_; | ||
cookie["value"] = this->value_; | ||
cookie["secure"] = this->is_secure_; | ||
cookie["httpOnly"] = this->is_httponly_; | ||
if (this->domain_.size() > 0) { | ||
cookie["domain"] = this->domain_; | ||
} | ||
if (this->path_.size() > 0) { | ||
cookie["path"] = this->path_; | ||
} | ||
if (this->expiration_time_ > 0) { | ||
cookie["expiry"] = this->expiration_time_; | ||
} | ||
return cookie; | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Licensed to the Software Freedom Conservancy (SFC) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The SFC licenses this file | ||
// to you under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef WEBDRIVER_IE_BROWSERCOOKIE_H_ | ||
#define WEBDRIVER_IE_BROWSERCOOKIE_H_ | ||
|
||
namespace Json { | ||
class Value; | ||
} | ||
|
||
namespace webdriver { | ||
|
||
class BrowserCookie | ||
{ | ||
public: | ||
BrowserCookie(void); | ||
virtual ~BrowserCookie(void); | ||
|
||
Json::Value ToJson(void); | ||
|
||
std::string name(void) const { return this->name_; } | ||
void set_name(const std::string& name) { this->name_ = name; } | ||
|
||
std::string value(void) const { return this->value_; } | ||
void set_value(const std::string& value) { this->value_ = value; } | ||
|
||
std::string domain(void) const { return this->domain_; } | ||
void set_domain(const std::string& domain) { this->domain_ = domain; } | ||
|
||
std::string path(void) const { return this->path_; } | ||
void set_path(const std::string& path) { this->path_ = path; } | ||
|
||
bool is_secure(void) const { return this->is_secure_; } | ||
void set_is_secure(const bool is_secure) { this->is_secure_ = is_secure; } | ||
|
||
bool is_httponly(void) const { return this->is_httponly_; } | ||
void set_is_httponly(const bool is_httponly) { | ||
this->is_httponly_ = is_httponly; | ||
} | ||
|
||
long expiration_time(void) const { return this->expiration_time_; } | ||
void set_expiration_time(const long expiration_time) { | ||
this->expiration_time_ = expiration_time; | ||
} | ||
|
||
private: | ||
std::string name_; | ||
std::string value_; | ||
std::string domain_; | ||
std::string path_; | ||
long expiration_time_; | ||
bool is_secure_; | ||
bool is_httponly_; | ||
}; | ||
|
||
} // namespace webdriver | ||
|
||
#endif // WEBDRIVER_IE_BROWSERCOOKIE_H_ |
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
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
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
Oops, something went wrong.