зеркало из https://github.com/mozilla/gecko-dev.git
Bug 142812, setRequestHeader() should set, not add to, the header. r=timeless, sr=darin.
This commit is contained in:
Родитель
fd3cb0875c
Коммит
493dbb7e5b
|
@ -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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче