Skip to content

Commit 240038b

Browse files
dtauerbachpde
authored andcommitted
Add remote host ip
1 parent 33e7d32 commit 240038b

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/components/ssl-observatory.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ SSLObservatory.prototype = {
244244

245245
if (!this.observatoryActive()) return;
246246

247+
var host_ip = "-1";
248+
var httpchannelinternal = subject.QueryInterface(Ci.nsIHttpChannelInternal);
249+
try {
250+
host_ip = httpchannelinternal.remoteAddress;
251+
} catch(e) {
252+
this.log(WARN, "Could not get host IP address.");
253+
}
247254
subject.QueryInterface(Ci.nsIHttpChannel);
248255
var certchain = this.getSSLCert(subject);
249256
if (certchain) {
@@ -273,9 +280,9 @@ SSLObservatory.prototype = {
273280
}
274281

275282
if (subject.URI.port == -1) {
276-
this.submitChain(chainArray, fps, new String(subject.URI.host), subject);
283+
this.submitChain(chainArray, fps, new String(subject.URI.host), subject, host_ip);
277284
} else {
278-
this.submitChain(chainArray, fps, subject.URI.host+":"+subject.URI.port, subject);
285+
this.submitChain(chainArray, fps, subject.URI.host+":"+subject.URI.port, subject, host_ip);
279286
}
280287
}
281288
}
@@ -324,7 +331,7 @@ SSLObservatory.prototype = {
324331
return false;
325332
},
326333

327-
submitChain: function(certArray, fps, domain, channel) {
334+
submitChain: function(certArray, fps, domain, channel, host_ip) {
328335
var base64Certs = [];
329336
var rootidx = -1;
330337

@@ -377,10 +384,9 @@ SSLObservatory.prototype = {
377384
base64Certs.push(this.base64_encode(derData, false, false));
378385
}
379386

380-
// TODO: Server ip??
381387
var reqParams = [];
382388
reqParams.push("domain="+domain);
383-
reqParams.push("server_ip=-1");
389+
reqParams.push("server_ip="+host_ip);
384390
if (this.myGetBoolPref("testing")) {
385391
reqParams.push("testing=1");
386392
// The server can compute these, but they're a nice test suite item!

0 commit comments

Comments
 (0)