Bug 1733356 - Fix non-unified build errors in netwerk/protocol/http/ r=necko-reviewers,kershaw

Differential Revision: https://phabricator.services.mozilla.com/D127407
This commit is contained in:
Valentin Gosu 2021-10-14 12:58:01 +00:00
Родитель 9ea7bf77a1
Коммит 4cd661b6a5
29 изменённых файлов: 86 добавлений и 42 удалений

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

@ -7,6 +7,7 @@
#include "mozilla/net/AltDataOutputStreamParent.h"
#include "mozilla/Unused.h"
#include "nsIAsyncOutputStream.h"
namespace mozilla {
namespace net {

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

@ -23,6 +23,7 @@
#include "mozilla/dom/PContent.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/net/AltSvcTransactionParent.h"
#include "mozilla/net/AltSvcTransactionChild.h"
/* RFC 7838 Alternative Services
http://httpwg.org/http-extensions/opsec.html
@ -1313,6 +1314,8 @@ AltSvcOverride::GetAllow1918(bool* allow) {
return NS_OK;
}
template class AltSvcTransaction<AltSvcTransactionChild>;
NS_IMPL_ISUPPORTS(AltSvcOverride, nsIInterfaceRequestor,
nsISpeculativeConnectionOverrider)

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

@ -13,6 +13,8 @@
#include "nsICacheStorageService.h"
#include "nsICacheStorage.h"
#include "nsThreadUtils.h"
#include "CacheControlParser.h"
#include "nsHttpHandler.h"
namespace mozilla {
namespace net {

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

@ -18,6 +18,10 @@
#include "nsIURI.h"
#include "nsProxyRelease.h"
#include "nsQueryObject.h"
#include "NeckoChild.h"
#include "mozilla/ContentBlocking.h"
#include "nsIHttpChannel.h"
#include "nsIStreamListener.h"
namespace mozilla {
namespace net {

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

@ -10,6 +10,12 @@
#include "mozilla/ipc/URIUtils.h"
#include "nsIURI.h"
#include "mozilla/AntiTrackingUtils.h"
#include "nsIHttpChannelInternal.h"
#include "nsIHttpChannel.h"
#include "mozilla/net/NeckoChannelParams.h"
#include "mozilla/net/NeckoChild.h"
#include "mozilla/net/HttpBaseChannel.h"
#include "nsQueryObject.h"
namespace mozilla {
namespace net {

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

@ -10,6 +10,7 @@
#include "mozilla/Unused.h"
#include "nsIPrincipal.h"
#include "nsNetUtil.h"
#include "ClassifierDummyChannel.h"
namespace mozilla {
namespace net {

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

@ -15,6 +15,7 @@
#include "ConnectionEntry.h"
#include "nsQueryObject.h"
#include "mozilla/ChaosMode.h"
#include "nsHttpHandler.h"
namespace mozilla {
namespace net {

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

@ -13,6 +13,7 @@
#define LOG_ENABLED() LOG5_ENABLED()
#include "ConnectionHandle.h"
#include "nsHttpHandler.h"
namespace mozilla {
namespace net {

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

@ -6,6 +6,9 @@
#ifndef ConnectionHandle_h__
#define ConnectionHandle_h__
#include "nsAHttpConnection.h"
#include "HttpConnectionBase.h"
namespace mozilla {
namespace net {

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

@ -12,12 +12,17 @@
#include "nsIClassOfService.h"
#include "nsIDNSRecord.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsSocketTransportService2.h"
#include "nsDNSService2.h"
#include "nsQueryObject.h"
#include "nsURLHelper.h"
#include "mozilla/Components.h"
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/SyncRunnable.h"
#include "nsHttpHandler.h"
#include "ConnectionEntry.h"
#include "HttpConnectionUDP.h"
#include "nsServiceManagerUtils.h"
// Log on level :5, instead of default :4.
#undef LOG

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

@ -11,6 +11,8 @@
#include "nsIDNSService.h"
#include "nsHttpConnectionInfo.h"
#include "nsNetCID.h"
#include "nsAHttpTransaction.h"
#include "nsServiceManagerUtils.h"
namespace mozilla {
namespace net {

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

@ -9,6 +9,7 @@
#include "nsICancelable.h"
#include "nsIDNSListener.h"
#include "nsHttpConnectionInfo.h"
namespace mozilla {
namespace net {

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

@ -15,6 +15,7 @@
#include "nsISupportsPriority.h"
#include "SimpleBuffer.h"
#include "nsISupportsImpl.h"
#include "nsIURI.h"
class nsIInputStream;
class nsIOutputStream;

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

@ -29,24 +29,24 @@ namespace mozilla {
namespace net {
const uint64_t HTTP3_APP_ERROR_NO_ERROR = 0x100;
const uint64_t HTTP3_APP_ERROR_GENERAL_PROTOCOL_ERROR = 0x101;
const uint64_t HTTP3_APP_ERROR_INTERNAL_ERROR = 0x102;
const uint64_t HTTP3_APP_ERROR_STREAM_CREATION_ERROR = 0x103;
const uint64_t HTTP3_APP_ERROR_CLOSED_CRITICAL_STREAM = 0x104;
const uint64_t HTTP3_APP_ERROR_FRAME_UNEXPECTED = 0x105;
const uint64_t HTTP3_APP_ERROR_FRAME_ERROR = 0x106;
const uint64_t HTTP3_APP_ERROR_EXCESSIVE_LOAD = 0x107;
const uint64_t HTTP3_APP_ERROR_ID_ERROR = 0x108;
const uint64_t HTTP3_APP_ERROR_SETTINGS_ERROR = 0x109;
const uint64_t HTTP3_APP_ERROR_MISSING_SETTINGS = 0x10a;
// const uint64_t HTTP3_APP_ERROR_GENERAL_PROTOCOL_ERROR = 0x101;
// const uint64_t HTTP3_APP_ERROR_INTERNAL_ERROR = 0x102;
// const uint64_t HTTP3_APP_ERROR_STREAM_CREATION_ERROR = 0x103;
// const uint64_t HTTP3_APP_ERROR_CLOSED_CRITICAL_STREAM = 0x104;
// const uint64_t HTTP3_APP_ERROR_FRAME_UNEXPECTED = 0x105;
// const uint64_t HTTP3_APP_ERROR_FRAME_ERROR = 0x106;
// const uint64_t HTTP3_APP_ERROR_EXCESSIVE_LOAD = 0x107;
// const uint64_t HTTP3_APP_ERROR_ID_ERROR = 0x108;
// const uint64_t HTTP3_APP_ERROR_SETTINGS_ERROR = 0x109;
// const uint64_t HTTP3_APP_ERROR_MISSING_SETTINGS = 0x10a;
const uint64_t HTTP3_APP_ERROR_REQUEST_REJECTED = 0x10b;
const uint64_t HTTP3_APP_ERROR_REQUEST_CANCELLED = 0x10c;
const uint64_t HTTP3_APP_ERROR_REQUEST_INCOMPLETE = 0x10d;
const uint64_t HTTP3_APP_ERROR_EARLY_RESPONSE = 0x10e;
const uint64_t HTTP3_APP_ERROR_CONNECT_ERROR = 0x10f;
// const uint64_t HTTP3_APP_ERROR_REQUEST_INCOMPLETE = 0x10d;
// const uint64_t HTTP3_APP_ERROR_EARLY_RESPONSE = 0x10e;
// const uint64_t HTTP3_APP_ERROR_CONNECT_ERROR = 0x10f;
const uint64_t HTTP3_APP_ERROR_VERSION_FALLBACK = 0x110;
const uint32_t UDP_MAX_PACKET_SIZE = 4096;
// const uint32_t UDP_MAX_PACKET_SIZE = 4096;
const uint32_t MAX_PTO_COUNTS = 16;
const uint32_t TRANSPORT_ERROR_STATELESS_RESET = 20;

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

@ -11,6 +11,9 @@
#include "nsHttpRequestHead.h"
#include "nsISocketTransport.h"
#include "nsSocketTransportService2.h"
#include "mozilla/Telemetry.h"
#include "nsIOService.h"
#include "nsHttpHandler.h"
#include <stdio.h>

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

@ -7,6 +7,8 @@
#include "nsIURI.h"
#include "nsNetUtil.h"
#include "nsUnicharUtils.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
namespace mozilla {
namespace net {

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

@ -15,6 +15,7 @@
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Unused.h"
#include "mozilla/net/BackgroundChannelRegistrar.h"
#include "mozilla/net/ChannelEventQueue.h"
#include "nsNetCID.h"
#include "nsQueryObject.h"
#include "nsThreadUtils.h"

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

@ -93,6 +93,7 @@
#include "mozilla/RemoteLazyInputStreamUtils.h"
#include "mozilla/net/SFVService.h"
#include "mozilla/dom/ContentChild.h"
#include "nsQueryObject.h"
namespace mozilla {
namespace net {

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

@ -12,6 +12,7 @@
#include "mozilla/net/HttpTransactionParent.h"
#include "mozilla/net/WebSocketConnectionParent.h"
#include "nsHttpConnectionInfo.h"
#include "nsIHttpChannelInternal.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsISpeculativeConnect.h"

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

@ -28,6 +28,7 @@
class nsISocketTransport;
class nsISSLSocketControl;
class nsIDNSRecord;
namespace mozilla {
namespace net {

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

@ -18,6 +18,8 @@
#include "nsSerializationHelper.h"
#include "nsStreamUtils.h"
#include "nsStringStream.h"
#include "nsNetUtil.h"
#include "nsIThreadRetargetableStreamListener.h"
namespace mozilla {
namespace net {

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

@ -5,7 +5,7 @@
#ifndef HttpWinUtils_h__
#define HttpWinUtils_h__
class nsIURI;
class nsHttpChannel;
namespace mozilla {
namespace net {

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

@ -16,6 +16,7 @@
#include "nsIRedirectResultListener.h"
#include "nsStringStream.h"
#include "nsStreamUtils.h"
#include "nsQueryObject.h"
namespace mozilla {
namespace net {

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

@ -208,5 +208,3 @@ include("/tools/fuzzing/libfuzzer-config.mozbuild")
if CONFIG["MOZ_BUILD_APP"] == "browser":
DEFINES["MOZ_BUILD_APP_IS_BROWSER"] = True
REQUIRES_UNIFIED_BUILD = True

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

@ -4,6 +4,7 @@
* 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/. */
#include "nsString.h"
#include "mozilla/Assertions.h"
#include "mozilla/LinkedList.h"
#include "mozilla/StaticPrefs_content.h"
@ -17,6 +18,7 @@
#include "nsError.h"
#include "nsContentUtils.h"
#include "nsNetUtil.h"
#include "nsComponentManagerUtils.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsMimeTypes.h"
@ -47,6 +49,7 @@
#include "mozilla/StaticPrefs_network.h"
#include "mozilla/StaticPrefs_dom.h"
#include "mozilla/dom/nsHTTPSOnlyUtils.h"
#include "mozilla/dom/ReferrerInfo.h"
#include <algorithm>
using namespace mozilla;

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

@ -42,6 +42,7 @@
#include "nsIStreamTransportService.h"
#include "prnetdb.h"
#include "nsEscape.h"
#include "nsComponentManagerUtils.h"
#include "nsStreamUtils.h"
#include "nsIOService.h"
#include "nsDNSPrefetch.h"

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

@ -42,6 +42,7 @@
#include "sslt.h"
#include "NSSErrorsService.h"
#include "TunnelUtils.h"
#include "mozilla/StaticPrefs_network.h"
namespace mozilla {
namespace net {
@ -1804,8 +1805,7 @@ nsresult nsHttpConnection::OnSocketWritable() {
// transaction->readsegments() processing can proceed because we need to
// know how to format the request differently for http/1, http/2, spdy,
// etc.. and that is negotiated with NPN/ALPN in the SSL handshake.
if (mConnInfo->UsingHttpsProxy() &&
!EnsureNPNComplete()) {
if (mConnInfo->UsingHttpsProxy() && !EnsureNPNComplete()) {
MOZ_DIAGNOSTIC_ASSERT(!EarlyDataAvailable());
mSocketOutCondition = NS_BASE_STREAM_WOULD_BLOCK;
} else if (mProxyConnectStream) {
@ -1817,8 +1817,8 @@ nsresult nsHttpConnection::OnSocketWritable() {
&transactionBytes);
} else if (!EnsureNPNComplete() &&
(!EarlyDataUsed() || mTlsHandshakeComplitionPending)) {
// The handshake is not done and we cannot write 0RTT data or nss has already
// finished 0RTT data.
// The handshake is not done and we cannot write 0RTT data or nss has
// already finished 0RTT data.
mSocketOutCondition = NS_BASE_STREAM_WOULD_BLOCK;
} else if (!mTransaction) {
rv = NS_ERROR_FAILURE;
@ -1875,8 +1875,8 @@ nsresult nsHttpConnection::OnSocketWritable() {
rv = mTLSFilter->NudgeTunnel(this);
} else if (mEarlyDataState != EarlyData::CANNOT_BE_USED) {
// continue writing
// We are not going to poll for write if the handshake is in progress, but
// early data cannot be used.
// We are not going to poll for write if the handshake is in progress,
// but early data cannot be used.
rv = mSocketOut->AsyncWait(this, 0, 0, nullptr);
}
} else {
@ -2549,8 +2549,7 @@ nsHttpConnection::HandshakeDone() {
// nss locks.
RefPtr<nsHttpConnection> self(this);
NS_DispatchToCurrentThread(NS_NewRunnableFunction(
"nsHttpConnection::HandshakeDoneInternal",
[self{std::move(self)}]() {
"nsHttpConnection::HandshakeDoneInternal", [self{std::move(self)}]() {
if (self->mTlsHandshakeComplitionPending) {
self->HandshakeDoneInternal();
self->mTlsHandshakeComplitionPending = false;
@ -2601,8 +2600,9 @@ void nsHttpConnection::HandshakeDoneInternal() {
static_cast<uint32_t>(rv)));
if (NS_FAILED(rvEarlyData) ||
(mTransaction && NS_FAILED(mTransaction->Finish0RTT(
!earlyDataAccepted, negotiatedNPN != mEarlyNegotiatedALPN)))) {
(mTransaction &&
NS_FAILED(mTransaction->Finish0RTT(
!earlyDataAccepted, negotiatedNPN != mEarlyNegotiatedALPN)))) {
LOG(
("nsHttpConection::HandshakeDone [this=%p] closing transaction "
"%p",

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

@ -37,6 +37,7 @@
#include "nsUnicharUtils.h"
#include "mozilla/net/HttpAuthUtils.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/net/DNS.h"
namespace mozilla {
namespace net {

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

@ -59,8 +59,6 @@
//-----------------------------------------------------------------------------
static NS_DEFINE_CID(kMultiplexInputStream, NS_MULTIPLEXINPUTSTREAM_CID);
// Place a limit on how much non-compliant HTTP can be skipped while
// looking for a response header
#define MAX_INVALID_RESPONSE_BODY_SIZE (1024 * 128)
@ -1326,12 +1324,14 @@ void nsHttpTransaction::MaybeReportFailedSVCDomain(
}
bool nsHttpTransaction::ShouldRestartOn0RttError(nsresult reason) {
LOG(("nsHttpTransaction::ShouldRestartOn0RttError [this=%p, "
"mEarlyDataWasAvailable=%d error=%" PRIx32 "]\n", this,
mEarlyDataWasAvailable, static_cast<uint32_t>(reason)));
LOG(
("nsHttpTransaction::ShouldRestartOn0RttError [this=%p, "
"mEarlyDataWasAvailable=%d error=%" PRIx32 "]\n",
this, mEarlyDataWasAvailable, static_cast<uint32_t>(reason)));
return StaticPrefs::network_http_early_data_disable_on_error() &&
mEarlyDataWasAvailable &&
(reason == psm::GetXPCOMFromNSSError(SSL_ERROR_PROTOCOL_VERSION_ALERT));
(reason ==
psm::GetXPCOMFromNSSError(SSL_ERROR_PROTOCOL_VERSION_ALERT));
}
void nsHttpTransaction::Close(nsresult reason) {
@ -1467,7 +1467,6 @@ void nsHttpTransaction::Close(nsresult reason) {
(!(mCaps & NS_HTTP_STICKY_CONNECTION) ||
(mCaps & NS_HTTP_CONNECTION_RESTARTABLE) ||
(mEarlyDataDisposition == EARLY_425))) {
if (mForceRestart) {
SetRestartReason(TRANSACTION_RESTART_FORCED);
if (NS_SUCCEEDED(Restart())) {
@ -1506,8 +1505,7 @@ void nsHttpTransaction::Close(nsresult reason) {
if (reason ==
psm::GetXPCOMFromNSSError(SSL_ERROR_DOWNGRADE_WITH_EARLY_DATA) ||
reason ==
psm::GetXPCOMFromNSSError(SSL_ERROR_PROTOCOL_VERSION_ALERT) ||
reason == psm::GetXPCOMFromNSSError(SSL_ERROR_PROTOCOL_VERSION_ALERT) ||
(!mReceivedData && ((mRequestHead && mRequestHead->IsSafeMethod()) ||
!reallySentData || connReused)) ||
shouldRestartTransactionForHTTPSRR) {
@ -1548,8 +1546,8 @@ void nsHttpTransaction::Close(nsresult reason) {
} else if (reason == psm::GetXPCOMFromNSSError(
SSL_ERROR_DOWNGRADE_WITH_EARLY_DATA)) {
SetRestartReason(TRANSACTION_RESTART_DOWNGRADE_WITH_EARLY_DATA);
} else if (reason == psm::GetXPCOMFromNSSError(
SSL_ERROR_PROTOCOL_VERSION_ALERT)) {
} else if (reason ==
psm::GetXPCOMFromNSSError(SSL_ERROR_PROTOCOL_VERSION_ALERT)) {
SetRestartReason(TRANSACTION_RESTART_PROTOCOL_VERSION_ALERT);
}
// if restarting fails, then we must proceed to close the pipe,
@ -1693,10 +1691,10 @@ void nsHttpTransaction::Close(nsresult reason) {
if (isHttp2or3 &&
reason == psm::GetXPCOMFromNSSError(SSL_ERROR_PROTOCOL_VERSION_ALERT)) {
// Change reason to NS_ERROR_ABORT, so we avoid showing a missleading
// error page tthat TLS1.0 is disabled. H2 or H3 is used here so the
// TLS version is not a problem.
reason = NS_ERROR_ABORT;
// Change reason to NS_ERROR_ABORT, so we avoid showing a missleading
// error page tthat TLS1.0 is disabled. H2 or H3 is used here so the
// TLS version is not a problem.
reason = NS_ERROR_ABORT;
}
mStatus = reason;
mTransactionDone = true; // forcibly flag the transaction as complete