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

This commit is contained in:
gavin@gavinsharp.com
2006-10-17 16:54:39 +00:00
parent 88f80a29af
commit f9e563c371

View File

@@ -1028,20 +1028,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;
@@ -1049,6 +1038,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;