Bug 142812, setRequestHeader() should set, not add to, the header. r=timeless, sr=darin.

This commit is contained in:
heikki%netscape.com 2002-08-13 19:25:54 +00:00
Родитель fd3cb0875c
Коммит 493dbb7e5b
1 изменённых файлов: 9 добавлений и 1 удалений

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

@ -1268,9 +1268,17 @@ nsXMLHttpRequest::SetRequestHeader(const char *header, const char *value)
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
if (httpChannel)
if (httpChannel) {
// We need to set, not add to, the header. Using empty value will
// clear existing header.
nsresult rv = httpChannel->SetRequestHeader(nsDependentCString(header),
nsCString());
if (NS_FAILED(rv))
return rv;
// Now set it for real
return httpChannel->SetRequestHeader(nsDependentCString(header),
nsDependentCString(value));
}
return NS_OK;
}