"Content-Length" header
Grant Edwards
grante at visi.com
Mon Aug 30 17:34:50 EDT 2004
On 2004-08-30, Justin <justin__devine at hotmail.com> wrote:
> URL open appears to not want to work unless its paramater is an actual
> string spelled out in quotes.
Nonsense.
> Check out the output to this code. When I give urlopen
> objects instead of pre strings it doens't work correctly.
Bullshit.
> print linklisttype
>
> for y in linklisttype:
> temp = urlopen(y)
> print temp
> temp2 = temp.info()
> print temp2
> temp3 = temp2.getheader("Content-Length")
> print temp3
> file_sizes.append(temp3)
>
> print file_sizes
Again with the invalid snippets of code, eh? You're trying
awfully hard to avoid getting helped.
> #here are the return values for y =0, didn't work
WTH is "y"?
> [None, None, '297984']
Those look like correct results to me.
I'll tell you _one_more_time_: use Ethereal. Here's the
transaction for your first URL:
GET /~harnad/temp/ariadne-rae.doc HTTP/1.0
Host: www.ecs.soton.ac.uk
User-agent: Python-urllib/1.15
HTTP/1.1 404 Not Found
Date: Mon, 30 Aug 2004 21:27:42 GMT
Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12
OpenSSL/0.9.6b DAV/1.0.3 PHP/4.3.2 mod_perl/1.26
Connection: close
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /~harnad/temp/ariadne-rae.doc was not found
on this server.<P>
<HR>
<ADDRESS>Apache/1.3.27 Server at www.ecs.soton.ac.uk Port
80</ADDRESS>
</BODY></HTML>
THERE IS NO CONTENT-LENGTH HEADER. What do you expect urllib
to do? The second of your URLs is also a 404 error with no
Content-length header. The third URL is valid and does return
a content-length header:
GET /systech/techsupport/procedures/2kcleanup.doc HTTP/1.0
Host: www-admn.csun.edu
User-agent: Python-urllib/1.15
HTTP/1.1 200 OK
Server: NetWare-Enterprise-Web-Server/5.1
Date: Mon, 30 Aug 2004 21:27:43 GMT
Content-type: application/msword
Last-modified: Tue, 30 Apr 2002 22:50:08 GMT
Content-length: 297984
Accept-ranges: bytes
Connection: close
[binary crap elided]
--
Grant Edwards grante Yow! Could I have a drug
at overdose?
visi.com
More information about the Python-list
mailing list