bug #16418 (r=warren,gagan). When redirecting a URL only copy the Ref to the new URL (not the Param and Query).

This commit is contained in:
rpotts%netscape.com 1999-11-01 06:00:55 +00:00
Родитель d44e416546
Коммит 3c960a9b5d
1 изменённых файлов: 18 добавлений и 37 удалений

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

@ -691,50 +691,31 @@ nsresult nsHTTPChannel::Redirect(const char *aNewLocation,
if (NS_FAILED(rv)) return rv;
//
// Move Param, Query and Reference of the old location to the new one
// Move the Reference of the old location to the new one
// if the new one has none
//
char* newref = nsnull;
char* newparam = nsnull;
char* newquery = nsnull;
char* baseref = nsnull;
char* baseparam = nsnull;
char* basequery = nsnull;
nsIURL* newurl;
nsIURL* baseurl;
rv = newURI->QueryInterface(nsIURL::GetIID(), (void**)&newurl);
nsXPIDLCString newref;
nsCOMPtr<nsIURL> newurl;
newurl = do_QueryInterface(newURI, &rv);
if (NS_SUCCEEDED(rv)) {
rv = newurl->GetRef(&newref);
rv = newurl->GetQuery(&newquery);
rv = newurl->GetParam(&newparam);
rv = mURI->QueryInterface(nsIURL::GetIID(), (void**)&baseurl);
if (NS_SUCCEEDED(rv)) {
rv = baseurl->GetRef(&baseref);
rv = baseurl->GetQuery(&basequery);
rv = baseurl->GetParam(&baseparam);
if ((newref == nsnull) && (baseref != nsnull)) {
// if there was a Reference then move it to the new URL
newurl->SetRef(baseref);
rv = newurl->GetRef(getter_Copies(newref));
if (NS_SUCCEEDED(rv) && !newref) {
nsXPIDLCString baseref;
nsCOMPtr<nsIURL> baseurl;
baseurl = do_QueryInterface(mURI, &rv);
if (NS_SUCCEEDED(rv)) {
rv = baseurl->GetRef(getter_Copies(baseref));
if (NS_SUCCEEDED(rv) && baseref) {
// If the old URL had a reference and the new URL does not,
// then move it to the new URL...
newurl->SetRef(baseref);
}
}
if ((newquery == nsnull) && (basequery != nsnull)) {
// if there was a Query then move it to the new URL
newurl->SetQuery(basequery);
}
if ((newparam == nsnull) && (baseparam != nsnull)) {
// if there was a Param then move it to the new URL
newurl->SetParam(baseparam);
}
NS_RELEASE(baseurl);
}
NS_RELEASE(newurl);
}
CRTFREEIF(newref);
CRTFREEIF(newquery);
CRTFREEIF(newparam);
CRTFREEIF(baseref);
CRTFREEIF(basequery);
CRTFREEIF(baseparam);
#if defined(PR_LOGGING)
char *newURLSpec;