Hi,

In short my question is: how to best ping a link to see if it is alive or not?

Explanation:

I have a link as an attribute to my element.  For example:

<foo src="helpmessage.txt"/>

During document load, I just want to ping the link to make sure it is alive. If it isn't, I need to notify the user via an event if it is no good. Later on, if the element is ever triggered (it is actually an xml event handler), I'll pass the link URL as part of a long construction string to nsIDOMWindowInternal's OpenDialog.

Currently I build a channel and if it is just a http channel I request the head otherwise I'll request the whole thing. I thought that I could be more efficient by not reading in the buffer during OnDataAvailable, but rather just check the status code, etc. that comes back in OnStopRequest. However, I've run into a problem where the inputstreampump will return NS_ERROR_UNEXPECTED in the status code if I don't read anything during OnDataAvailable (http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsInputStreamPump.cpp#519)

So am I using the wrong approach to link pinging?  Is there an easier way?

Any help appreciated.

Thanks,
--Aaron
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network

Reply via email to