fixes bug 157133 "HTTP Interfaces need to be frozen" r=dougt sr=bzbarsky

This commit is contained in:
darin%netscape.com 2006-04-20 03:38:16 +00:00
Родитель c45f7a3bba
Коммит 028fbb9c37
1 изменённых файлов: 8 добавлений и 10 удалений

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

@ -791,10 +791,13 @@ nsXMLHttpRequest::GetStreamForWString(const PRUnichar* aStr,
nsCAutoString header;
if( NS_FAILED(httpChannel->GetRequestHeader(NS_LITERAL_CSTRING("Content-Type"), header)) )
httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Content-Type"),
NS_LITERAL_CSTRING("text/xml") );
NS_LITERAL_CSTRING("text/xml"),
PR_FALSE);
// set the content length header
httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Content-Length"), nsPrintfCString("%d", charLength) );
httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Content-Length"),
nsPrintfCString("%d", charLength),
PR_FALSE);
// Shove in the trailing and leading CRLF
postData[0] = nsCRT::CR;
@ -1320,15 +1323,10 @@ nsXMLHttpRequest::SetRequestHeader(const char *header, const char *value)
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
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
// We need to set, not add to, the header.
return httpChannel->SetRequestHeader(nsDependentCString(header),
nsDependentCString(value));
nsDependentCString(value),
PR_FALSE);
}
return NS_OK;