Bug 1783290 - Uppercase CAPA response in Pop3Client.jsm to fix fetching headers only. r=mkmelin
Differential Revision:
https://phabricator.services.mozilla.com/D153884
--- a/mailnews/local/src/Pop3Client.jsm
+++ b/mailnews/local/src/Pop3Client.jsm
@@ -460,17 +460,17 @@ class Pop3Client {
_actionCapaResponse = res => {
if (res.status && !res.success) {
this._actionChooseFirstAuthMethod();
return;
}
this._lineReader.read(
res.data,
line => {
- line = line.trim();
+ line = line.trim().toUpperCase();
if (line == "USER") {
this._supportedAuthMethods.push("USERPASS");
} else if (line.startsWith("SASL ")) {
this._supportedAuthMethods.push(...line.slice(5).split(" "));
} else {
this._capabilities.push(line.split(" ")[0]);
}
},
--- a/mailnews/local/test/unit/test_pop3Client.js
+++ b/mailnews/local/test/unit/test_pop3Client.js
@@ -1,13 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-let [daemon, server] = setupServerDaemon();
+let [daemon, server, handler] = setupServerDaemon();
+handler.kCapabilities = ["uidl", "top"]; // CAPA response is case-insensitive.
server.start();
registerCleanupFunction(() => {
server.stop();
});
/**
* Test when alwaysSTARTTLS is set, but the server doesn't support STARTTLS,
* should abort after CAPA response.
--- a/mailnews/test/fakeserver/Pop3d.jsm
+++ b/mailnews/test/fakeserver/Pop3d.jsm
@@ -190,17 +190,16 @@ POP3_RFC1939_handler.prototype = {
result += i + 1 + " " + this._daemon._messages[i].uidl + "\r\n";
}
result += ".";
return result;
},
TOP(args) {
let [messageNumber, numberOfBodyLines] = args.split(" ");
- console.log({ args });
if (this._state != kStateTransaction) {
return "-ERR invalid state";
}
let result = "+OK\r\n";
let msg = this._daemon._messages[messageNumber - 1].fileData;
let index = msg.indexOf("\r\n\r\n");
result += msg.slice(0, index);
if (numberOfBodyLines) {