Don't send HEAD to FTP servers behind HTTP proxies. Bug 148813,

r=bbaetz, sr=darin
This commit is contained in:
bzbarsky%mit.edu 2002-06-17 20:49:42 +00:00
parent 348e7da0d7
commit c4fd9838f8

View File

@ -118,8 +118,21 @@ nsURIChecker::AsyncCheckURI(const nsACString &aURI,
// See if it's an http channel, which needs special treatment: // See if it's an http channel, which needs special treatment:
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel); nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
if (httpChannel) if (httpChannel) {
httpChannel->SetRequestMethod(NS_LITERAL_CSTRING("HEAD")); // We can have an HTTP channel that has a non-HTTP URL if
// we're doing FTP via an HTTP proxy, for example. See for
// example bug 148813
nsCOMPtr<nsIURI> channelURI;
mChannel->GetURI(getter_AddRefs(channelURI));
if (channelURI) {
PRBool isReallyHTTP = PR_FALSE;
channelURI->SchemeIs("http", &isReallyHTTP);
if (!isReallyHTTP)
channelURI->SchemeIs("https", &isReallyHTTP);
if (isReallyHTTP)
httpChannel->SetRequestMethod(NS_LITERAL_CSTRING("HEAD"));
}
}
// Hook us up to listen to redirects and the like // Hook us up to listen to redirects and the like
mChannel->SetNotificationCallbacks(this); mChannel->SetNotificationCallbacks(this);