From ddfd75d6492bfa9c1fea91562d8145c3e61260b3 Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Wed, 29 Dec 1999 21:55:18 +0000 Subject: [PATCH] 22534. r=gagan. We were leaking a single byte on non uname/pwd inclusive url's that required authentication, and we weren't over-writing the auth string when a auth realm wanted new credentials. git-svn-id: svn://10.0.0.236/trunk@56610 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp | 12 ++++++++---- .../netwerk/protocol/http/src/nsHTTPHeaderArray.cpp | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp index e97d3fdf67d..984a4c8917a 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPChannel.cpp @@ -1425,8 +1425,10 @@ nsHTTPChannel::Authenticate(const char *iChallenge, if (NS_SUCCEEDED(rv = mURI->GetPreHost(getter_Copies(prehost)))) { - if (!(newUserPass = nsCRT::strdup(prehost))) - return NS_ERROR_OUT_OF_MEMORY; + if ((const char*)prehost) { + if (!(newUserPass = nsCRT::strdup(prehost))) + return NS_ERROR_OUT_OF_MEMORY; + } } } @@ -1489,8 +1491,10 @@ nsHTTPChannel::Authenticate(const char *iChallenge, if (retval) { nsAutoString temp(user); - temp += ':'; - temp += passwd; + if (passwd) { + temp += ':'; + temp += passwd; + } CRTFREEIF(newUserPass); newUserPass = temp.ToNewCString(); } diff --git a/mozilla/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp b/mozilla/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp index e0b7193661a..db11c89bb88 100644 --- a/mozilla/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHTTPHeaderArray.cpp @@ -241,7 +241,8 @@ PRBool nsHTTPHeaderArray::IsHeaderMultiple(nsIAtom* aHeader) (nsHTTPAtoms::If_Unmodified_Since == aHeader) || (nsHTTPAtoms::Max_Forwards == aHeader) || (nsHTTPAtoms::Referer == aHeader) || - (nsHTTPAtoms::User_Agent == aHeader)) { + (nsHTTPAtoms::User_Agent == aHeader) || + (nsHTTPAtoms::Authorization == aHeader)) { bIsMultiple = PR_FALSE; } else { bIsMultiple = PR_TRUE;