Bug 1610810 - FTP download prompt appears while authentication dialog is displayed, r=valentin

Set nsFtpChannel's content-type to application/octet-stream only when downloading a file.

Differential Revision: https://phabricator.services.mozilla.com/D61494

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michal Novotny 2020-02-03 19:22:37 +00:00
Родитель 757aa81959
Коммит 68a2a76615
2 изменённых файлов: 2 добавлений и 2 удалений

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

@ -6,7 +6,6 @@
#include "nsFTPChannel.h"
#include "nsFtpConnectionThread.h" // defines nsFtpState
#include "nsMimeTypes.h"
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
@ -92,7 +91,6 @@ nsresult nsFtpChannel::OpenContentStream(bool async, nsIInputStream** result,
nsIChannel** channel) {
if (!async) return NS_ERROR_NOT_IMPLEMENTED;
SetContentType(NS_LITERAL_CSTRING(APPLICATION_OCTET_STREAM));
RefPtr<nsFtpState> state = new nsFtpState();
nsresult rv = state->Init(this);

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

@ -1101,6 +1101,8 @@ nsFtpState::R_retr() {
}
if (mResponseCode / 100 == 1) {
mChannel->SetContentType(NS_LITERAL_CSTRING(APPLICATION_OCTET_STREAM));
Telemetry::ScalarAdd(
Telemetry::ScalarID::NETWORKING_FTP_OPENED_CHANNELS_FILES, 1);