CGI script to count downloads

Steve Purcell stephen_purcell at yahoo.com
Fri Apr 6 03:23:04 EDT 2001


Greg Ewing wrote:
> Walter Hofmann wrote:
> > Use the following commands to redirect the browser to the "real" URL
> > where the file is located:
> > 
> > print "Location: http://server/real/url.tar.gz"
> > print "Status: 302 Found"
> > print
> 
> That's the solution I finally adopted. Thanks to
> all who replied.

The disadvantage of this approach is that you can't accurately count
*completed* downloads, but that may not be an issue for you.

> By the way, it seems to work with just the
> "Location:" line. What does the "Status:"
> line do? Will anything bad happen if I
> leave it out?

Probably the web server is guessing the 'Status:' based on the 'Location:'
header. You should put the 'Status' header in yourself for the sake of
completeness and portability.

-Steve

-- 
Steve Purcell, Pythangelist
Get testing at http://pyunit.sourceforge.net/
Any opinions expressed herein are my own and not necessarily those of Yahoo




More information about the Python-list mailing list