Delivering dynamic content using cgi module

Steve Holden sholden at bellatlantic.net
Wed Mar 8 13:24:56 EST 2000


This problem seems to need a more precise specification.  Do you
want a single CGI program to be able to return *either* HTML text, a
GIF or a JPEG image?  Or do you want to return all three in a
single HTTP response?

If the latter, this seems doomed to failure (IMHO: there may be
things I am not considering here).  Normally a single document
will have a single Content-Type.  If a document of MIME type
text/html includes graphics it will do so by reference, using
the HREF attribute of <IMG> tags, and the browser will use a
separate HTTP transcation to download each of these graphics.

Or have I completely misunderstood your question?

regards
 Steve

Shichang Zhao wrote:
> 
> Assume a single dynamically generated document as following:
> 
> Content-Type: text/html
> 
>      <pre>Hello</pre>
> 
> Content-Type: image/gif
> 
>       < ---open a .gif file, read data, and print it to stdout -->
> 
> Content-Type: image/pjpeg
> 
>       < ---open a .jpg file, read data, and print it to stdout -->
> 
> How to deliver it using CGI? A simple example script would be very helpful.
> 
> Thanks

--
"If computing ever stops being fun, I'll stop doing it"



More information about the Python-list mailing list