CGI script to count downloads

Ben Hutchings ben.hutchings at roundpoint.com
Thu Apr 5 16:51:36 EDT 2001


kragen at dnaco.net (Kragen Sitaker) writes:

V> In article <3AC95ECE.B8F5E93E at cosc.canterbury.ac.nz>,
> Greg Ewing  <greg at cosc.canterbury.ac.nz> wrote:
> >So, my question is, can I put anything in the
> >headers of the response to give the browser a
> >hint as to what name the file should be saved
> >under?
> >
> >Or is there a better way of going about this
> >whole counting business?
> 
> Perhaps you could make the URL end with download.py/foo/bar/baz.tar.gz
> instead of using a query; then just use PATH_INFO instead of a form
> value.  Is that possible?
> 
> >  #!/usr/local/cosc/bin/python
> >  print "Content-Type: compressed/gzip"
> 
> I don't think that's correct ;)
<snip>

There isn't a registered type for tar files, but I believe the type
name usually used is 'application/x-tar' (or 'application/x-gtar' if
using GNU's tar format).  Since it's gzipped, there should also be a
'Content-Encoding: gzip' field.

-- 
Any opinions expressed are my own and not necessarily those of Roundpoint.



More information about the Python-list mailing list