Skip to content

Commit

Permalink
Release RequestPolicyContinued 1.0.beta9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
myrdd committed Apr 30, 2015
2 parents 6eaf8f5 + eea5892 commit c295bff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Note: ChangeLogs for the source code and unit tests, both not relevant for
users, you can find in the dedicated subdirectories.

#### Version 1.0.beta9.1 (bugfix)
* rules with a port specified in the origin or destination haven't
been working (#627)

#### Version 1.0.beta9
* new features
* RPC is now a bootstrapped addon. (#489)
Expand Down
31 changes: 9 additions & 22 deletions src/content/lib/ruleset.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,12 @@ function Rule(scheme, port) {
Rule.prototype = {

scheme : null,

/**
* @type {?string}
*/
port : null,

path : null,

// Either null, RULE_ACTION_ALLOW, or RULE_ACTION_DENY.
Expand Down Expand Up @@ -612,7 +617,7 @@ Rule.prototype = {
// If the rule's port is "*" it means any port. We use this convention
// because we assume an empty port in a rule means default ports rather
// than any port.
if (this.port !== uriObj.port && this.port !== "*") {
if (parseInt(this.port, 10) !== uriObj.port && this.port !== "*") {
//dprint("isMatch: wrong port (not the port specified by the rule)");
return false;
}
Expand Down Expand Up @@ -780,24 +785,6 @@ Ruleset.prototype = {
this.rules.print(depth + 1);
},

// fixme: this static function should be `Ruleset.isIPAddress()`
/**
* @static
*/
_isIPAddress : function(host) {
// Check if it's an IPv6 address.
if (host.indexOf(":") != -1) {
return true;
}
var parts = host.split(".");
for (var i = 0; i < parts.length; i++) {
if (!parseInt(parts[i])) {
return false;
}
}
return true;
},

_getIPAddress : function(address) {
// TODO: Canonicalize IPv6 addresses.
return this._ipAddr[address];
Expand Down Expand Up @@ -851,7 +838,7 @@ Ruleset.prototype = {
if (!host) {
throw "INVALID_HOST";
}
if (this._isIPAddress(host)) {
if (DomainUtil.isIPAddress(host)) {
return this._getIPAddress(host);
} else {
return this._getDomain(host);
Expand All @@ -862,7 +849,7 @@ Ruleset.prototype = {
if (!host) {
throw "INVALID_HOST";
}
if (this._isIPAddress(host)) {
if (DomainUtil.isIPAddress(host)) {
return this._addIPAddress(host);
} else {
return this._addDomain(host);
Expand Down Expand Up @@ -893,7 +880,7 @@ Ruleset.prototype = {
return;
}

if (this._isIPAddress(host)) {
if (DomainUtil.isIPAddress(host)) {
var addrEntry = this._ipAddr[host];
if (addrEntry) {
yield addrEntry;
Expand Down
2 changes: 1 addition & 1 deletion src/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<Description about="urn:mozilla:install-manifest">
<em:name>RequestPolicy</em:name>
<em:version>1.0.beta9</em:version>
<em:version>1.0.beta9.1</em:version>
<em:type>2</em:type>
<em:description>Control which cross-site requests are allowed. Improve the privacy of your browsing. Secure yourself from Cross-Site Request Forgery (CSRF) and other attacks.</em:description>
<em:id>requestpolicy@requestpolicy.com</em:id>
Expand Down

0 comments on commit c295bff

Please sign in to comment.