Bug 356463: add X-Moz: livebookmark to live bookmark request headers, r=vlad, sr=biesi, a=jay

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@215570 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
gavin%gavinsharp.com
2006-11-21 20:54:37 +00:00
parent 709b466705
commit 121410788d

View File

@@ -1029,20 +1029,9 @@ nsBookmarksService::UpdateLivemarkChildren(nsIRDFResource* aSource)
}
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsIChannel> uriChannel;
rv = NS_NewURI(getter_AddRefs(uri), feedUrlString, nsnull, nsnull);
if (NS_FAILED(rv)) UNLOCK_AND_RETURN_RV;
rv = NS_NewChannel(getter_AddRefs(uriChannel), uri, nsnull, nsnull, nsnull,
nsIRequest::LOAD_BACKGROUND);
if (NS_FAILED(rv)) UNLOCK_AND_RETURN_RV;
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(uriChannel);
if (httpChannel) {
// XXXvladimir - handle POST livemarks
rv = httpChannel->SetRequestMethod(NS_LITERAL_CSTRING("GET"));
}
nsCOMPtr<nsFeedLoadListener> listener = new nsFeedLoadListener(this, mInner, uri, aSource);
nsCOMPtr<nsIChannel> channel;
@@ -1050,6 +1039,15 @@ nsBookmarksService::UpdateLivemarkChildren(nsIRDFResource* aSource)
nsIRequest::LOAD_BACKGROUND | nsIRequest::VALIDATE_ALWAYS);
if (NS_FAILED(rv)) UNLOCK_AND_RETURN_RV;
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel);
if (httpChannel) {
// Add a request header so that the request can easily be detected as a
// live bookmark update request.
rv = httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("X-Moz"),
NS_LITERAL_CSTRING("livebookmarks"),
PR_FALSE);
}
rv = channel->AsyncOpen(listener, nsnull);
if (NS_FAILED(rv)) UNLOCK_AND_RETURN_RV;