Connecting Tech Pros Worldwide Forums | Help | Site Map

cgi script headers - help

Ajay
Guest
 
Posts: n/a
#1: Jul 18 '05
hi!

i am generating a file on the fly and making a user download it.
print "Content-Type: application/model\n\n"
print "Content-Disposition: attachment; filename=modeldef3\n"
print str

i set the Content-Disposition to force a download dialog box and also give
the file a name.
however when i view the headers sent by my script, i have only
HTTP/1.1 200 OK
Date: Thu, 05 Aug 2004 02:26:48 GMT
Server: Apache/1.3.19 (Unix)
Connection: close
Content-Type: application/model

why isn't the Content-Disposition header coming up?

thanks

cheers

--
Ajay Brar,
CS Honours 2004
Smart Internet Technology Research Group





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Peter Hansen
Guest
 
Posts: n/a
#2: Jul 18 '05

re: cgi script headers - help


Ajay wrote:
[color=blue]
> hi!
>
> i am generating a file on the fly and making a user download it.
> print "Content-Type: application/model\n\n"
> print "Content-Disposition: attachment; filename=modeldef3\n"
> print str
>
> i set the Content-Disposition to force a download dialog box and also give
> the file a name.
> however when i view the headers sent by my script, i have only
> HTTP/1.1 200 OK
> Date: Thu, 05 Aug 2004 02:26:48 GMT
> Server: Apache/1.3.19 (Unix)
> Connection: close
> Content-Type: application/model
>
> why isn't the Content-Disposition header coming up?[/color]

Probably because the previous line was terminated with three (3)
newlines, thus marking the end of the header section...

Note that print includes a newline normally, so including any
other newlines will result in at least a double newline, which
is the delimiter between header and body.

-Peter
Ajay
Guest
 
Posts: n/a
#3: Jul 18 '05

re: cgi script headers - help


thanks...that was it

--
Ajay Brar,
CS Honours 2004
Smart Internet Technology Research Group


Quoting Peter Hansen <peter@engcorp.com>:
[color=blue]
> Ajay wrote:
>[color=green]
> > hi!
> >
> > i am generating a file on the fly and making a user download it.
> > print "Content-Type: application/model\n\n"
> > print "Content-Disposition: attachment; filename=modeldef3\n"
> > print str
> >
> > i set the Content-Disposition to force a download dialog box and also[/color]
> give[color=green]
> > the file a name.
> > however when i view the headers sent by my script, i have only
> > HTTP/1.1 200 OK
> > Date: Thu, 05 Aug 2004 02:26:48 GMT
> > Server: Apache/1.3.19 (Unix)
> > Connection: close
> > Content-Type: application/model
> >
> > why isn't the Content-Disposition header coming up?[/color]
>
> Probably because the previous line was terminated with three (3)
> newlines, thus marking the end of the header section...
>
> Note that print includes a newline normally, so including any
> other newlines will result in at least a double newline, which
> is the delimiter between header and body.
>
> -Peter
> --
> http://mail.python.org/mailman/listinfo/python-list
>[/color]


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Closed Thread