September 2002
Intermediate to advanced
544 pages
13h 6m
English
One of the first things you learned in this book is that the Web server depends on the CGI program to generate the Content-type header. This is because the Web server has no way of knowing what sort of content the CGI program is going to generate. It just so happens that so far, I’ve always printed out a Content-type header that looks like this:
Content-type: text/html
Back in lesson 6, I explained how content types work, and how servers use them. I also discussed some of the families that content types are grouped into. Sending a different content type from your CGI scripts is simple. If you want to indicate that the content returned is plain text, specify the content type as text/plain:
print "Content-type: text/plain\n\n"; ...
Read now
Unlock full access