From e311afcf95024c9da59754087bfed3cfa083d594 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 15 Sep 2023 22:38:35 +0000 Subject: [PATCH] Backed out 3 changesets (bug 1820807, bug 1853025, bug 1848763) for causing frequent network-related startup crashes (bug 1853231). a=backout Backed out changeset 92d80b858050 (bug 1848763) Backed out changeset c08cba545d2c (bug 1853025) Backed out changeset 2fae28575ca8 (bug 1820807) UltraBlame original commit: f4b0e304ecebf431616ce014dd198c1d361b37c1 --- modules/libpref/init/StaticPrefList.yaml | 30 - netwerk/base/nsIChannelEventSink.idl | 72 - netwerk/protocol/http/HttpBaseChannel.cpp | 46 - netwerk/protocol/http/HttpChannelParent.cpp | 83 +- netwerk/protocol/http/HttpChannelParent.h | 7 - .../protocol/http/HttpTransactionChild.cpp | 12 +- .../protocol/http/HttpTransactionParent.cpp | 28 +- netwerk/protocol/http/HttpTransactionParent.h | 16 +- netwerk/protocol/http/PHttpTransaction.ipdl | 4 +- netwerk/protocol/http/nsHttpChannel.cpp | 1297 +++-------------- netwerk/protocol/http/nsHttpChannel.h | 45 +- netwerk/test/unit/test_authentication.js | 572 ++------ netwerk/test/unit/test_ntlm_proxy_auth.js | 502 ++----- 13 files changed, 520 insertions(+), 2194 deletions(-) diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 4afb43a65f75c..c424dbc3d8c28 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -68424,36 +68424,6 @@ mirror : always # -whether -to -redirect -the -channel -for -auth -redirects -. -See -Bug -1820807 -- -name -: -network -. -auth -. -use_redirect_for_retries -type -: -RelaxedAtomicBool -value -: -IS_EARLY_BETA_OR_EARLIER -mirror -: -always -# Whether to allow diff --git a/netwerk/base/nsIChannelEventSink.idl b/netwerk/base/nsIChannelEventSink.idl index d53e9eb33c5c0..55378853b043c 100644 --- a/netwerk/base/nsIChannelEventSink.idl +++ b/netwerk/base/nsIChannelEventSink.idl @@ -440,78 +440,6 @@ REDIRECT_STS_UPGRADE * * * -This -is -a -internal -redirect -used -to -handle -http -authentication -retries -. -* -Upon -receiving -a -401 -or -407 -the -channel -gets -redirected -to -a -new -channel -* -( -same -URL -) -that -performs -the -request -with -the -appropriate -credentials -. -* -Auth -retry -to -the -server -must -be -made -after -redirecting -to -a -new -channel -* -/ -const -unsigned -long -REDIRECT_AUTH_RETRY -= -1 -< -< -4 -; -/ -* -* -* Called when a diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp index c20a8594794c9..75ec6dac9d2ab 100644 --- a/netwerk/protocol/http/HttpBaseChannel.cpp +++ b/netwerk/protocol/http/HttpBaseChannel.cpp @@ -35858,52 +35858,6 @@ REDIRECT_INTERNAL { / / -for -internal -redirect -due -to -auth -retry -we -do -not -have -any -limit -/ -/ -as -we -might -restrict -the -number -of -times -a -user -might -retry -/ -/ -authentication -if -( -aRedirectFlags -& -nsIChannelEventSink -: -: -REDIRECT_AUTH_RETRY -) -{ -return -NS_OK -; -} -/ -/ Some platform features diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index cb857538310a9..130e6f9055090 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -11845,27 +11845,6 @@ return NS_OK ; } -bool -HttpChannelParent -: -: -IsRedirectDueToAuthRetry -( -uint32_t -redirectFlags -) -{ -return -( -redirectFlags -& -nsIChannelEventSink -: -: -REDIRECT_AUTH_RETRY -) -; -} / / - @@ -12173,23 +12152,14 @@ for service worker interception -or +then / / -internal -redirect -due -to -auth -retries -then hide it from the child -/ -/ process . The @@ -12197,13 +12167,13 @@ original e10s interception code +/ +/ was not designed with this -/ -/ in mind and @@ -12212,12 +12182,12 @@ not necessary to replace +/ +/ the HttpChannelChild / Parent -/ -/ objects in this @@ -12268,8 +12238,6 @@ newChannel ; / / -1 -. We only want @@ -12278,18 +12246,14 @@ hide the special internal -redirects +redirect from +nsHttpChannel / / -nsHttpChannel to InterceptedHttpChannel . -/ -/ -2 -. We want to @@ -12333,31 +12297,6 @@ reset / case . -/ -/ -3 -. -If -this -is -an -internal -redirect -due -to -auth -retry -then -we -will -/ -/ -hide -it -from -the -child -process if ( ( @@ -12384,14 +12323,6 @@ IsReset ( ) ) -| -| -( -IsRedirectDueToAuthRetry -( -redirectFlags -) -) ) { / diff --git a/netwerk/protocol/http/HttpChannelParent.h b/netwerk/protocol/http/HttpChannelParent.h index 563983d06eabb..69192a3d90eb6 100644 --- a/netwerk/protocol/http/HttpChannelParent.h +++ b/netwerk/protocol/http/HttpChannelParent.h @@ -1633,13 +1633,6 @@ NeedFlowControl ( ) ; -bool -IsRedirectDueToAuthRetry -( -uint32_t -redirectFlags -) -; int32_t mSendWindowSize ; diff --git a/netwerk/protocol/http/HttpTransactionChild.cpp b/netwerk/protocol/http/HttpTransactionChild.cpp index cf136d1fad579..1520bdce06c26 100644 --- a/netwerk/protocol/http/HttpTransactionChild.cpp +++ b/netwerk/protocol/http/HttpTransactionChild.cpp @@ -3261,12 +3261,6 @@ GetSupportsHTTP3 ) mode reason -mTransaction -- -> -Caps -( -) ) ; return @@ -3790,6 +3784,12 @@ Timings responseTrailers mTransactionObserverResult lastActTabOpt +mTransaction +- +> +Caps +( +) infoArgs ) ; diff --git a/netwerk/protocol/http/HttpTransactionParent.cpp b/netwerk/protocol/http/HttpTransactionParent.cpp index 296e2411a0f5a..6b4c4652cb99b 100644 --- a/netwerk/protocol/http/HttpTransactionParent.cpp +++ b/netwerk/protocol/http/HttpTransactionParent.cpp @@ -2598,10 +2598,6 @@ const TRRSkippedReason & aTrrSkipReason -const -uint32_t -& -aCaps ) { mEventQ @@ -2653,7 +2649,6 @@ aHTTPSSVCReceivedStage aSupportsHttp3 aMode aTrrSkipReason -aCaps ] ( ) @@ -2684,7 +2679,6 @@ aHTTPSSVCReceivedStage aSupportsHttp3 aMode aTrrSkipReason -aCaps ) ; } @@ -2930,10 +2924,6 @@ const TRRSkippedReason & aSkipReason -const -uint32_t -& -aCaps ) { LOG @@ -3008,10 +2998,6 @@ mTRRSkipReason = aSkipReason ; -mCaps -= -aCaps -; mSecurityInfo = aSecurityInfo @@ -3780,6 +3766,10 @@ TimeStamp & aLastActiveTabOptHit const +uint32_t +& +aCaps +const HttpConnectionInfoCloneArgs & aArgs @@ -3886,6 +3876,7 @@ move aTransactionObserverResult ) } +aCaps cinfo { std @@ -3918,6 +3909,7 @@ move ( aTransactionObserverResult ) +aCaps cinfo ) ; @@ -3967,6 +3959,10 @@ TransactionObserverResult & & aTransactionObserverResult +const +uint32_t +& +aCaps nsHttpConnectionInfo * aConnInfo @@ -4065,6 +4061,10 @@ ref ) ; } +mCaps += +aCaps +; mConnInfo = aConnInfo diff --git a/netwerk/protocol/http/HttpTransactionParent.h b/netwerk/protocol/http/HttpTransactionParent.h index 63b572445bca5..6aa2486196a6d 100644 --- a/netwerk/protocol/http/HttpTransactionParent.h +++ b/netwerk/protocol/http/HttpTransactionParent.h @@ -362,10 +362,6 @@ const TRRSkippedReason & aSkipReason -const -uint32_t -& -aCaps ) ; mozilla @@ -465,6 +461,10 @@ TimeStamp & aLastActiveTabOptHit const +uint32_t +& +aCaps +const HttpConnectionInfoCloneArgs & aArgs @@ -669,10 +669,6 @@ const TRRSkippedReason & aSkipReason -const -uint32_t -& -aCaps ) ; void @@ -725,6 +721,10 @@ TransactionObserverResult & & aTransactionObserverResult +const +uint32_t +& +aCaps nsHttpConnectionInfo * aConnInfo diff --git a/netwerk/protocol/http/PHttpTransaction.ipdl b/netwerk/protocol/http/PHttpTransaction.ipdl index 0e3626b045293..b72d452a88710 100644 --- a/netwerk/protocol/http/PHttpTransaction.ipdl +++ b/netwerk/protocol/http/PHttpTransaction.ipdl @@ -355,8 +355,6 @@ TRRMode trrMode TRRSkippedReason trrSkipReason -uint32_t -caps ) ; async @@ -403,6 +401,8 @@ TransactionObserverResult transactionObserverResult TimeStamp lastActiveTabOptimization +uint32_t +caps HttpConnectionInfoCloneArgs connInfoArgs ) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index da01246881f0a..938da18f5a8e3 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -3518,8 +3518,6 @@ OnBeforeConnect { nsresult rv -= -NS_OK ; / / @@ -3583,6 +3581,88 @@ HandleAsyncAPIRedirect } / / +Check +to +see +if +we +should +redirect +this +channel +to +the +unstripped +URI +. +To +/ +/ +revert +the +query +stripping +if +the +loading +channel +is +in +the +content +/ +/ +blocking +allow +list +. +if +( +ContentBlockingAllowList +: +: +Check +( +this +) +) +{ +nsCOMPtr +< +nsIURI +> +unstrippedURI +; +mLoadInfo +- +> +GetUnstrippedURI +( +getter_AddRefs +( +unstrippedURI +) +) +; +if +( +unstrippedURI +) +{ +return +AsyncCall +( +& +nsHttpChannel +: +: +HandleAsyncRedirectToUnstrippedURI +) +; +} +} +/ +/ Note that we @@ -3698,57 +3778,6 @@ rv ) ; } -if -( -LoadAuthRedirectedChannel -( -) -) -{ -/ -/ -This -channel -is -a -result -of -a -redirect -due -to -auth -retry -/ -/ -We -have -already -checked -for -HSTS -upgarde -in -the -redirecting -channel -. -/ -/ -We -can -safely -skip -those -checks -return -ContinueOnBeforeConnect -( -false -rv -) -; -} SecFetch : : @@ -3757,88 +3786,6 @@ AddSecFetchHeader this ) ; -/ -/ -Check -to -see -if -we -should -redirect -this -channel -to -the -unstripped -URI -. -To -/ -/ -revert -the -query -stripping -if -the -loading -channel -is -in -the -content -/ -/ -blocking -allow -list -. -if -( -ContentBlockingAllowList -: -: -Check -( -this -) -) -{ -nsCOMPtr -< -nsIURI -> -unstrippedURI -; -mLoadInfo -- -> -GetUnstrippedURI -( -getter_AddRefs -( -unstrippedURI -) -) -; -if -( -unstrippedURI -) -{ -return -AsyncCall -( -& -nsHttpChannel -: -: -HandleAsyncRedirectToUnstrippedURI -) -; -} -} nsCOMPtr < nsIPrincipal @@ -5260,69 +5207,6 @@ mCaps NS_HTTP_DISALLOW_HTTPS_RR ; } -if -( -mTransactionSticky -) -{ -MOZ_ASSERT -( -LoadAuthRedirectedChannel -( -) -) -; -/ -/ -this -means -this -is -a -redirected -channel -channel -due -to -auth -retry -and -a -/ -/ -connection -based -auth -scheme -was -used -/ -/ -we -have -a -reference -to -the -old -- -transaction -with -sticky -connection -which -/ -/ -we -need -to -use -mCaps -| -= -NS_HTTP_STICKY_CONNECTION -; -} mCaps | = @@ -6529,7 +6413,6 @@ net return DoConnect ( -mTransactionSticky ) ; } @@ -16342,7 +16225,7 @@ considering the previously used -credentials +creadentials as invalid . @@ -16356,12 +16239,6 @@ ClearProxyIdent } if ( -! -LoadAuthRedirectedChannel -( -) -& -& MOZ_UNLIKELY ( LoadCustomAuthHeader @@ -16848,41 +16725,10 @@ mAuthRetryPending = true ; -if -( -StaticPrefs -: -: -network_auth_use_redirect_for_retries -( -) -) -{ -if -( -NS_SUCCEEDED -( -RedirectToNewChannelForAuthRetry -( -) -) -) -{ -return -NS_OK -; -} -mAuthRetryPending -= -false -; -rv -= -ProcessNormal -( -) -; -} +/ +/ +see +DoAuthRetry } break ; @@ -19273,693 +19119,6 @@ nsresult nsHttpChannel : : -RedirectToNewChannelForAuthRetry -( -) -{ -LOG -( -( -" -nsHttpChannel -: -: -RedirectToNewChannelForAuthRetry -% -p -" -this -) -) -; -nsresult -rv -= -NS_OK -; -nsCOMPtr -< -nsILoadInfo -> -redirectLoadInfo -= -CloneLoadInfoForRedirect -( -mURI -nsIChannelEventSink -: -: -REDIRECT_INTERNAL -| -nsIChannelEventSink -: -: -REDIRECT_AUTH_RETRY -) -; -nsCOMPtr -< -nsIIOService -> -ioService -; -rv -= -gHttpHandler -- -> -GetIOService -( -getter_AddRefs -( -ioService -) -) -; -NS_ENSURE_SUCCESS -( -rv -rv -) -; -nsCOMPtr -< -nsIChannel -> -newChannel -; -rv -= -gHttpHandler -- -> -NewProxiedChannel -( -mURI -mProxyInfo -mProxyResolveFlags -mProxyURI -mLoadInfo -getter_AddRefs -( -newChannel -) -) -; -NS_ENSURE_SUCCESS -( -rv -rv -) -; -rv -= -SetupReplacementChannel -( -mURI -newChannel -true -nsIChannelEventSink -: -: -REDIRECT_INTERNAL -| -nsIChannelEventSink -: -: -REDIRECT_AUTH_RETRY -) -; -NS_ENSURE_SUCCESS -( -rv -rv -) -; -/ -/ -rewind -the -upload -stream -if -( -mUploadStream -) -{ -nsCOMPtr -< -nsISeekableStream -> -seekable -= -do_QueryInterface -( -mUploadStream -) -; -nsresult -rv -= -NS_ERROR_NO_INTERFACE -; -if -( -seekable -) -{ -rv -= -seekable -- -> -Seek -( -nsISeekableStream -: -: -NS_SEEK_SET -0 -) -; -} -/ -/ -This -should -not -normally -happen -but -it -' -s -possible -that -big -memory -/ -/ -blobs -originating -in -the -other -process -can -' -t -be -rewinded -. -/ -/ -In -that -case -we -just -fail -the -request -otherwise -the -content -length -/ -/ -will -not -match -and -this -load -will -never -complete -. -NS_ENSURE_SUCCESS -( -rv -rv -) -; -} -RefPtr -< -nsHttpChannel -> -httpChannelImpl -= -do_QueryObject -( -newChannel -) -; -MOZ_ASSERT -( -mAuthProvider -) -; -httpChannelImpl -- -> -mAuthProvider -= -std -: -: -move -( -mAuthProvider -) -; -httpChannelImpl -- -> -mProxyInfo -= -mProxyInfo -; -if -( -( -mCaps -& -NS_HTTP_STICKY_CONNECTION -) -| -| -mTransaction -- -> -HasStickyConnection -( -) -) -{ -mConnectionInfo -= -mTransaction -- -> -GetConnInfo -( -) -; -httpChannelImpl -- -> -mTransactionSticky -= -mTransaction -; -if -( -mTransaction -- -> -Http2Disabled -( -) -) -{ -httpChannelImpl -- -> -mCaps -| -= -NS_HTTP_DISALLOW_SPDY -; -} -if -( -mTransaction -- -> -Http3Disabled -( -) -) -{ -httpChannelImpl -- -> -mCaps -| -= -NS_HTTP_DISALLOW_HTTP3 -; -} -} -httpChannelImpl -- -> -mCaps -| -= -NS_HTTP_STICKY_CONNECTION -; -if -( -LoadAuthConnectionRestartable -( -) -) -{ -httpChannelImpl -- -> -mCaps -| -= -NS_HTTP_CONNECTION_RESTARTABLE -; -} -else -{ -httpChannelImpl -- -> -mCaps -& -= -~ -NS_HTTP_CONNECTION_RESTARTABLE -; -} -MOZ_ASSERT -( -mConnectionInfo -) -; -httpChannelImpl -- -> -mConnectionInfo -= -mConnectionInfo -- -> -Clone -( -) -; -/ -/ -we -need -to -store -the -state -to -skip -unnecessary -checks -in -the -new -channel -httpChannelImpl -- -> -StoreAuthRedirectedChannel -( -true -) -; -/ -/ -We -must -copy -proxy -and -auth -header -to -the -new -channel -. -/ -/ -Although -the -new -channel -can -populate -auth -headers -from -auth -cache -we -/ -/ -would -still -like -to -use -the -auth -headers -generated -in -this -channel -. -The -/ -/ -main -reason -for -doing -this -is -that -certain -connection -- -based -/ -stateful -auth -/ -/ -schemes -like -NTLM -will -fail -when -we -try -generate -the -credentials -more -than -/ -/ -the -number -of -times -the -server -has -presented -us -the -challenge -due -to -the -/ -/ -usage -of -nonce -in -generating -the -credentials -Copying -the -auth -header -will -/ -/ -bypass -generation -of -the -credentials -nsAutoCString -authVal -; -if -( -NS_SUCCEEDED -( -GetRequestHeader -( -" -Proxy -- -Authorization -" -_ns -authVal -) -) -) -{ -httpChannelImpl -- -> -SetRequestHeader -( -" -Proxy -- -Authorization -" -_ns -authVal -false -) -; -} -if -( -NS_SUCCEEDED -( -GetRequestHeader -( -" -Authorization -" -_ns -authVal -) -) -) -{ -httpChannelImpl -- -> -SetRequestHeader -( -" -Authorization -" -_ns -authVal -false -) -; -} -httpChannelImpl -- -> -SetBlockAuthPrompt -( -LoadBlockAuthPrompt -( -) -) -; -mRedirectChannel -= -newChannel -; -PushRedirectAsyncFunc -( -& -nsHttpChannel -: -: -OpenRedirectChannel -) -; -rv -= -gHttpHandler -- -> -AsyncOnChannelRedirect -( -this -newChannel -nsIChannelEventSink -: -: -REDIRECT_INTERNAL -| -nsIChannelEventSink -: -: -REDIRECT_AUTH_RETRY -) -; -if -( -NS_SUCCEEDED -( -rv -) -) -rv -= -WaitForRedirectCallback -( -) -; -if -( -NS_FAILED -( -rv -) -) -{ -AutoRedirectVetoNotifier -notifier -( -this -rv -) -; -mRedirectChannel -= -nullptr -; -PopRedirectAsyncFunc -( -& -nsHttpChannel -: -: -OpenRedirectChannel -) -; -} -return -rv -; -} -nsresult -nsHttpChannel -: -: StartRedirectChannelToURI ( nsIURI @@ -20458,16 +19617,6 @@ this rv ) ; -if -( -NS_FAILED -( -rv -) -) -return -rv -; / / Make @@ -20658,7 +19807,7 @@ PushRedirectAsyncFunc nsHttpChannel : : -OpenRedirectChannel +ContinueDoReplaceWithProxy ) ; rv @@ -20707,7 +19856,7 @@ PopRedirectAsyncFunc nsHttpChannel : : -OpenRedirectChannel +ContinueDoReplaceWithProxy ) ; } @@ -20719,6 +19868,116 @@ nsresult nsHttpChannel : : +ContinueDoReplaceWithProxy +( +nsresult +rv +) +{ +AutoRedirectVetoNotifier +notifier +( +this +rv +) +; +if +( +NS_FAILED +( +rv +) +) +return +rv +; +MOZ_ASSERT +( +mRedirectChannel +" +No +redirect +channel +? +" +) +; +/ +/ +Make +sure +to +do +this +after +we +received +redirect +veto +answer +/ +/ +i +. +e +. +after +all +sinks +had +been +notified +mRedirectChannel +- +> +SetOriginalURI +( +mOriginalURI +) +; +/ +/ +open +new +channel +rv += +mRedirectChannel +- +> +AsyncOpen +( +mListener +) +; +NS_ENSURE_SUCCESS +( +rv +rv +) +; +mStatus += +NS_BINDING_REDIRECTED +; +notifier +. +RedirectSucceeded +( +) +; +ReleaseListeners +( +) +; +return +rv +; +} +nsresult +nsHttpChannel +: +: ResolveProxy ( ) @@ -36745,39 +36004,6 @@ Resume ) ; } -if -( -StaticPrefs -: -: -network_auth_use_redirect_for_retries -( -) -) -{ -return -CallOrWaitForResume -( -[ -] -( -auto -* -self -) -{ -return -self -- -> -RedirectToNewChannelForAuthRetry -( -) -; -} -) -; -} return NS_OK ; @@ -41401,28 +40627,8 @@ MaybeResolveProxyAndBeginConnect right away . -/ -/ -We -skip -the -check -in -case -this -is -an -internal -redirected -channel if ( -! -LoadAuthRedirectedChannel -( -) -& -& NS_ShouldClassifyChannel ( this @@ -43377,36 +42583,6 @@ true ) ; } -/ -/ -We -can -be -passed -with -the -auth -provider -if -this -channel -was -/ -/ -a -result -of -redirect -due -to -auth -retry -if -( -! -mAuthProvider -) -{ mAuthProvider = new @@ -43414,7 +42590,6 @@ nsHttpChannelAuthProvider ( ) ; -} rv = mAuthProvider @@ -43835,32 +43010,9 @@ return mStatus ; } -/ -/ -skip -classifier -checks -if -this -channel -was -the -result -of -internal -auth -/ -/ -redirect bool shouldBeClassified = -! -LoadAuthRedirectedChannel -( -) -& -& NS_ShouldClassifyChannel ( this @@ -44249,7 +43401,6 @@ used . if ( -( mLoadFlags & ( @@ -44258,12 +43409,6 @@ LOAD_NO_NETWORK_IO LOAD_ONLY_FROM_CACHE ) ) -| -| -LoadAuthRedirectedChannel -( -) -) { return NS_OK @@ -51677,16 +50822,6 @@ DoAuthRetry bool authRetry = -( -! -StaticPrefs -: -: -network_auth_use_redirect_for_retries -( -) -& -& mAuthRetryPending & & @@ -51694,7 +50829,6 @@ NS_SUCCEEDED ( status ) -) ; StoreStronglyFramed ( @@ -52028,6 +51162,9 @@ schema if ( ( +mAuthRetryPending +| +| NS_FAILED ( status @@ -52038,6 +51175,14 @@ status transactionWithStickyConn ) { +if +( +NS_FAILED +( +status +) +) +{ / / Close @@ -52051,14 +51196,27 @@ the sticky connection if +it +' +s +in +the +middle +/ +/ +of +an +NTLM +negotiation +and this channel has been -/ -/ cancelled . +/ +/ There are proxy @@ -52116,6 +51274,7 @@ DontReuseConnection ; } } +} if ( mCaps @@ -54751,10 +53910,6 @@ mDNSPrefetch = nullptr ; -mTransactionSticky -= -nullptr -; / / notify diff --git a/netwerk/protocol/http/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h index c07812456a2c2..9d671c6827abd 100644 --- a/netwerk/protocol/http/nsHttpChannel.h +++ b/netwerk/protocol/http/nsHttpChannel.h @@ -2527,6 +2527,17 @@ nodiscard ] ] nsresult +ContinueDoReplaceWithProxy +( +nsresult +) +; +[ +[ +nodiscard +] +] +nsresult ResolveProxy ( ) @@ -3526,29 +3537,6 @@ RedirectToInterceptedChannel ; / / -Start -an -internal -redirect -to -a -new -channel -for -auth -retry -[ -[ -nodiscard -] -] -nsresult -RedirectToNewChannelForAuthRetry -( -) -; -/ -/ Determines and sets @@ -3863,12 +3851,6 @@ HttpTransactionShell > mTransaction ; -RefPtr -< -HttpTransactionShell -> -mTransactionSticky -; uint64_t mLogicalOffset { @@ -4801,11 +4783,6 @@ uint32_t EchConfigUsed 1 ) -( -uint32_t -AuthRedirectedChannel -1 -) ) ) / diff --git a/netwerk/test/unit/test_authentication.js b/netwerk/test/unit/test_authentication.js index d8f8169e8dae8..01e959ebe1a85 100644 --- a/netwerk/test/unit/test_authentication.js +++ b/netwerk/test/unit/test_authentication.js @@ -225,12 +225,6 @@ flags flags ; } -var -initialChannelId -= -- -1 -; AuthPrompt1 . prototype @@ -1568,103 +1562,6 @@ channel ) ; } -if -( -Services -. -prefs -. -getBoolPref -( -" -network -. -auth -. -use_redirect_for_retries -" -) -& -& -/ -/ -we -should -skip -redirect -check -if -we -do -not -expect -to -succeed -this -. -expectedCode -= -= -200 -) -{ -/ -/ -ensure -channel -ids -are -initialized -Assert -. -notEqual -( -initialChannelId -- -1 -) -; -/ -/ -for -each -request -we -must -use -a -unique -channel -ID -. -/ -/ -See -Bug -1820807 -var -chan -= -request -. -QueryInterface -( -Ci -. -nsIIdentChannel -) -; -Assert -. -notEqual -( -initialChannelId -chan -. -channelId -) -; -} Assert . equal @@ -1773,11 +1670,6 @@ Cr NS_ERROR_ABORT ) ; -initialChannelId -= -- -1 -; this . nextTest @@ -1848,62 +1740,6 @@ contentPolicyType ; } var -ChannelCreationObserver -= -{ -QueryInterface -: -ChromeUtils -. -generateQI -( -[ -" -nsIObserver -" -] -) -observe -( -aSubject -aTopic -aData -) -{ -if -( -aTopic -= -= -" -http -- -on -- -opening -- -request -" -) -{ -initialChannelId -= -aSubject -. -QueryInterface -( -Ci -. -nsIIdentChannel -) -. -channelId -; -} -} -} -; -var httpserv = null @@ -1939,24 +1775,6 @@ registerPathHandler / auth / -stored -/ -wrong -/ -credentials -/ -" -authHandlerWrongStoredCredentials -) -; -httpserv -. -registerPathHandler -( -" -/ -auth -/ ntlm / simple @@ -2155,24 +1973,6 @@ stop } ) ; -Services -. -obs -. -addObserver -( -ChannelCreationObserver -" -http -- -on -- -opening -- -request -" -) -; } setup ( @@ -2240,6 +2040,8 @@ clearAll ) ; } +add_task +( async function test_noauth @@ -2276,6 +2078,10 @@ chan ) ; } +) +; +add_task +( async function test_returnfalse1 @@ -2323,6 +2129,10 @@ chan ) ; } +) +; +add_task +( async function test_wrongpw1 @@ -2370,6 +2180,10 @@ chan ) ; } +) +; +add_task +( async function test_prompt1 @@ -2417,6 +2231,10 @@ chan ) ; } +) +; +add_task +( async function test_prompt1CrossOrigin @@ -2472,6 +2290,10 @@ chan ) ; } +) +; +add_task +( async function test_prompt2CrossOrigin @@ -2527,6 +2349,10 @@ chan ) ; } +) +; +add_task +( async function test_returnfalse2 @@ -2574,6 +2400,10 @@ chan ) ; } +) +; +add_task +( async function test_wrongpw2 @@ -2621,112 +2451,10 @@ chan ) ; } -var -requestNum -= -0 -; -var -expectedRequestNum -= -0 -; -async -function -test_wrong_stored_passwd -( ) -{ -/ -/ -tests -that -we -don -' -t -retry -auth -requests -for -incorrect -custom -credentials -passed -during -channel -creation -requestNum -= -0 ; -expectedRequestNum -= -1 -; -var -chan -= -makeChan -( -URL -+ -" -/ -auth -/ -stored -/ -wrong -/ -credentials -/ -" -URL -) -; -chan -. -nsIHttpChannel -. -setRequestHeader -( -" -Authorization -" -" -wrong_cred -" -false -) -; -chan -. -notificationCallbacks -= -new -Requestor -( -0 -1 -) -; -listener -. -expectedCode -= -401 -; -/ -/ -Unauthorized -await -openAndListen +add_task ( -chan -) -; -} async function test_prompt2 @@ -2774,6 +2502,10 @@ chan ) ; } +) +; +add_task +( async function test_ntlm @@ -2825,6 +2557,10 @@ chan ) ; } +) +; +add_task +( async function test_basicrealm @@ -2890,6 +2626,10 @@ foo_bar ) ; } +) +; +add_task +( async function test_nonascii @@ -2939,6 +2679,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_noauth @@ -2990,6 +2734,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_md5 @@ -3039,6 +2787,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_md5sess @@ -3088,6 +2840,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_sha256 @@ -3137,6 +2893,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_sha256sess @@ -3186,6 +2946,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_sha256_md5 @@ -3235,6 +2999,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_md5_sha256 @@ -3284,6 +3052,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_md5_sha256_oneline @@ -3333,6 +3105,10 @@ chan ) ; } +) +; +add_task +( async function test_digest_bogus_user @@ -3382,6 +3158,8 @@ chan ) ; } +) +; / / Test @@ -3397,6 +3175,8 @@ Digest bug 1338876 . +add_task +( async function test_short_digest @@ -3446,6 +3226,8 @@ chan ) ; } +) +; / / Test @@ -3461,6 +3243,8 @@ asyncPromptAuth is cancelled . +add_task +( async function test_corp_coep @@ -3570,6 +3354,8 @@ origin ) ; } +) +; / / XXX @@ -3591,6 +3377,8 @@ last . Why ? +add_task +( async function test_nonascii_xhr @@ -3688,97 +3476,8 @@ null ) ; } -let -auth_tests -= -[ -test_noauth -test_returnfalse1 -test_wrongpw1 -test_wrong_stored_passwd -test_prompt1 -test_prompt1CrossOrigin -test_prompt2CrossOrigin -test_returnfalse2 -test_wrongpw2 -test_prompt2 -test_ntlm -test_basicrealm -test_nonascii -test_digest_noauth -test_digest_md5 -test_digest_md5sess -test_digest_sha256 -test_digest_sha256sess -test_digest_sha256_md5 -test_digest_md5_sha256 -test_digest_md5_sha256_oneline -test_digest_bogus_user -test_short_digest -test_corp_coep -test_nonascii_xhr -] -; -for -( -let -auth_test -of -auth_tests -) -{ -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -false -] -] -} -auth_test -) -; -} -for -( -let -auth_test -of -auth_tests -) -{ -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -true -] -] -} -auth_test ) ; -} / / PATH @@ -3954,95 +3653,6 @@ length ) ; } -function -authHandlerWrongStoredCredentials -( -metadata -response -) -{ -var -body -; -if -( -+ -+ -requestNum -> -expectedRequestNum -) -{ -response -. -setStatusLine -( -metadata -. -httpVersion -500 -" -" -) -; -} -else -{ -response -. -setStatusLine -( -metadata -. -httpVersion -401 -" -Unauthorized -" -+ -requestNum -) -; -response -. -setHeader -( -" -WWW -- -Authenticate -" -' -Basic -realm -= -" -secret -" -' -false -) -; -} -body -= -" -failed -" -; -response -. -bodyOutputStream -. -write -( -body -body -. -length -) -; -} / / / diff --git a/netwerk/test/unit/test_ntlm_proxy_auth.js b/netwerk/test/unit/test_ntlm_proxy_auth.js index b061d23de0dd0..37a3579511da9 100644 --- a/netwerk/test/unit/test_ntlm_proxy_auth.js +++ b/netwerk/test/unit/test_ntlm_proxy_auth.js @@ -1090,6 +1090,8 @@ to indicate invalid credentials +/ +/ authorization = metadata @@ -1442,8 +1444,6 @@ ntlmTypeTwoCount + + ; -try -{ response . seizePower @@ -1452,30 +1452,18 @@ seizePower ; response . -finish +bodyOutPutStream +. +close ( ) ; -} -catch -( -e -) -{ -Assert +response . -ok +finish ( -false -" -unexpected -exception -" -+ -e ) ; -} break ; default @@ -1529,7 +1517,7 @@ the connection after a -negotiate +nogotiate message has been @@ -1543,13 +1531,6 @@ metadata response ) { -var -connectionNumber -= -httpserver -. -connectionNumber -; switch ( requestsMade @@ -1567,7 +1548,7 @@ request to the Proxy -respond +resppond with a 407 @@ -1602,16 +1583,6 @@ NTLM false ) ; -Assert -. -equal -( -connectionNumber -httpserver -. -connectionNumber -) -; break ; case @@ -1619,20 +1590,6 @@ case : / / -eslint -- -disable -- -next -- -line -no -- -fallthrough -default -: -/ -/ Proxy - Expecting @@ -1644,16 +1601,6 @@ message from the client -Assert -. -equal -( -connectionNumber -httpserver -. -connectionNumber -) -; var authorization = @@ -1698,12 +1645,30 @@ ntlmTypeOneCount + + ; -try -{ response . -seizePower +setStatusLine ( +metadata +. +httpVersion +407 +" +Unauthorized +" +) +; +response +. +setHeader +( +" +Proxy +- +Authenticate +" +PROXY_CHALLENGE +false ) ; response @@ -1712,27 +1677,59 @@ finish ( ) ; -} -catch +response +. +seizePower ( -e ) -{ +; +response +. +bodyOutPutStream +. +close +( +) +; +break +; +default +: +/ +/ +Should +not +get +any +further +requests +on +this +channel +dump +( +" +ERROR +: +NTLM +Proxy +Authentication +connection +should +not +be +reused +" +) +; Assert . ok ( false -" -unexpected -exception -" -+ -e ) ; } -} requestsMade + + @@ -2189,71 +2186,6 @@ resolve ) ; } -let -ntlmTypeOneCount -= -0 -; -/ -/ -The -number -of -NTLM -type -one -messages -received -let -exptTypeOneCount -= -0 -; -/ -/ -The -number -of -NTLM -type -one -messages -that -should -be -received -let -ntlmTypeTwoCount -= -0 -; -/ -/ -The -number -of -NTLM -type -two -messages -received -let -exptTypeTwoCount -= -0 -; -/ -/ -The -number -of -NTLM -type -two -messages -that -should -received / / Happy @@ -2261,10 +2193,12 @@ code path / / -Successful +Succesful proxy auth . +add_task +( async function test_happy_path @@ -2295,11 +2229,15 @@ successfulAuth ) ; } +) +; / / Failed proxy authentication +add_task +( async function test_failed_auth @@ -2331,6 +2269,73 @@ failedAuth ) ; } +) +; +var +ntlmTypeOneCount += +0 +; +/ +/ +The +number +of +NTLM +type +one +messages +received +var +exptTypeOneCount += +0 +; +/ +/ +The +number +of +NTLM +type +one +messages +that +should +be +received +var +ntlmTypeTwoCount += +0 +; +/ +/ +The +number +of +NTLM +type +two +messages +received +var +exptTypeTwoCount += +0 +; +/ +/ +The +number +of +NTLM +type +two +messages +that +should +received / / Test @@ -2339,6 +2344,8 @@ reset after successful auth +add_task +( async function test_connection_reset @@ -2380,12 +2387,14 @@ setupTest auth " connectionReset -3 +2 500 1 ) ; } +) +; / / Test @@ -2396,16 +2405,8 @@ sending a negotiate . -/ -/ -Client -should -retry -request -using -the -same -connection +add_task +( async function test_connection_reset02 @@ -2431,39 +2432,14 @@ ntlmTypeTwoCount = 0 ; -let -maxRetryAttempt -= -5 -; exptTypeOneCount = -maxRetryAttempt +1 ; exptTypeTwoCount = 0 ; -Services -. -prefs -. -setIntPref -( -" -network -. -http -. -request -. -max -- -attempts -" -maxRetryAttempt -) -; await setupTest ( @@ -2472,179 +2448,11 @@ setupTest auth " connectionReset02 -maxRetryAttempt -+ 1 500 1 ) ; } -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -false -] -] -} -test_happy_path -) -; -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -false -] -] -} -test_failed_auth -) -; -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -false -] -] -} -test_connection_reset -) -; -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -false -] -] -} -test_connection_reset02 -) -; -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -true -] -] -} -test_happy_path -) -; -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -true -] -] -} -test_failed_auth -) -; -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -true -] -] -} -test_connection_reset -) -; -add_task -( -{ -pref_set -: -[ -[ -" -network -. -auth -. -use_redirect_for_retries -" -true -] -] -} -test_connection_reset02 ) ;