Bug 1735803 - Convert server hostname to lowercase before connecting. r=mkmelin

Differential Revision: https://phabricator.services.mozilla.com/D158179
This commit is contained in:
Ping Chen 2022-09-27 05:39:23 +00:00
Родитель eb8fa81497
Коммит cc536d6dc2
5 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -41,12 +41,13 @@ class LDAPClient {
}
connect() {
let hostname = this._host.toLowerCase();
this._logger.debug(
`Connecting to ${this._useSecureTransport ? "ldaps" : "ldap"}://${
this._host
}:${this._port}`
`Connecting to ${
this._useSecureTransport ? "ldaps" : "ldap"
}://${hostname}:${this._port}`
);
this._socket = new TCPSocket(this._host, this._port, {
this._socket = new TCPSocket(hostname, this._port, {
binaryType: "arraybuffer",
useSecureTransport: this._useSecureTransport,
});

Просмотреть файл

@ -113,10 +113,11 @@ class SmtpClient {
* Initiate a connection to the server
*/
connect() {
let hostname = this._server.hostname.toLowerCase();
let port = this._server.port || (this.options.requireTLS ? 465 : 587);
this.logger.debug(`Connecting to smtp://${this._server.hostname}:${port}`);
this.logger.debug(`Connecting to smtp://${hostname}:${port}`);
this._secureTransport = this.options.requireTLS;
this.socket = new TCPSocket(this._server.hostname, port, {
this.socket = new TCPSocket(hostname, port, {
binaryType: "arraybuffer",
useSecureTransport: this._secureTransport,
});

Просмотреть файл

@ -99,12 +99,11 @@ class ImapClient {
// Reuse the connection.
this.onReady();
} else {
this._logger.debug(
`Connecting to ${this._server.hostName}:${this._server.port}`
);
let hostname = this._server.hostName.toLowerCase();
this._logger.debug(`Connecting to ${hostname}:${this._server.port}`);
this._capabilities = null;
this._secureTransport = this._server.socketType == Ci.nsMsgSocketType.SSL;
this._socket = new TCPSocket(this._server.hostName, this._server.port, {
this._socket = new TCPSocket(hostname, this._server.port, {
binaryType: "arraybuffer",
useSecureTransport: this._secureTransport,
});

Просмотреть файл

@ -130,15 +130,14 @@ class Pop3Client {
* Initiate a connection to the server
*/
connect() {
this._logger.debug(
`Connecting to pop://${this._server.hostName}:${this._server.port}`
);
let hostname = this._server.hostName.toLowerCase();
this._logger.debug(`Connecting to pop://${hostname}:${this._server.port}`);
this.runningUri
.QueryInterface(Ci.nsIMsgMailNewsUrl)
.SetUrlState(true, Cr.NS_OK);
this._server.serverBusy = true;
this._secureTransport = this._server.socketType == Ci.nsMsgSocketType.SSL;
this._socket = new TCPSocket(this._server.hostName, this._server.port, {
this._socket = new TCPSocket(hostname, this._server.port, {
binaryType: "arraybuffer",
useSecureTransport: this._secureTransport,
});

Просмотреть файл

@ -93,13 +93,14 @@ class NntpClient {
this.onOpen();
} else {
// Start a new connection.
let hostname = this._server.hostName.toLowerCase();
let useSecureTransport = this._server.isSecure;
this._logger.debug(
`Connecting to ${useSecureTransport ? "snews" : "news"}://${
this._server.hostName
}:${this._server.port}`
`Connecting to ${useSecureTransport ? "snews" : "news"}://${hostname}:${
this._server.port
}`
);
this._socket = new TCPSocket(this._server.hostName, this._server.port, {
this._socket = new TCPSocket(hostname, this._server.port, {
binaryType: "arraybuffer",
useSecureTransport,
});