gerrit.holl at pobox.com
Fri Nov 19 13:34:04 CET 1999
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.
"We all know Linux is great...it does infinite loops in 5 seconds."
(Linus Torvalds about the superiority of Linux on the Amterdam
More information about the Python-list