Skip Montanaro wrote:
> > Gerrit> I've written a function to get the size of a HTTP/FTP url, is it> Gerrit> good enough to be put in urllib.py?> > My only worry is that HEAD doesn't always work (for whatever reason having> to do more with servers than clients). Would it be better to wrap things in> a try/except block?
Oh. Yes, I think getsize() should return -1 or None or an error if HEAD
doesn't work. Just doing a GET then isn't good, of course ;-)
Another problem: does every HTTP server give the Content-Length header?
> Anyone have a URL that fails with HEAD?
I don't have one.
regards,
Gerrit.
--
"We all know Linux is great...it does infinite loops in 5 seconds."
(Linus Torvalds about the superiority of Linux on the Amterdam
Linux Symposium)