[Ro] 2004-11-05 (Nov 5th, 2004) Lovingly crafted simplicity. [CGI] can get complex when you include library after library, so let's do it by hand: #!/usr/bin/tclsh puts "Content-type: text/plain\n" puts eogieogeig The most basic cgi, all it does is display some text, not even html! But hey, if you're this far, your server is set up, your permissions on your cgi file are correct, and that's half the battle. #!/usr/bin/tclsh puts "Content-type: text/html\n" puts { wonderz aloha! } Great! You're sending them html now. Notice the Content-type header. #!/usr/bin/tclsh puts "Content-type: text/plain\n" parray env Wow! Text again, but this time we're dumping out our environment variables, and thats the guts of interfacing to the server, hence the term Common Gateway ''Interface''. ---- [GPS]: Nice simple example. I'm not positive, but I seem to recall reading that \r\n is the standard EOL pattern for CGI apps. Thus I usually use puts "Content-type: text/plain\r" I've used \r\n for my CGI work with Roxen, without problems. Also, there are CGI-related packages in [tcllib] that are useful for translating the arguments from a web browser into a more usable format. ---- pepolez: Nope, I've used ''puts "Content type: text/html\n"'' without any problems. I am however curious as to how to allow a CGI script to output jpeg image data copied from a local file, so that the script outputs a jpeg image to the client browser. ---- [Category Internet]