[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Web* and CGI output



joshg@ola.bc.ca (Josh Gemmell) writes:

> I posed this question to the technical support at *9 (who make Web*) and
> they responded by writing me a nice little email saying that they don't help
> people .

Heh. I guess this is one of the little perks our commercial brethren get :-)

>	Anyways, the question is this: what is it about WebSTAR that makes it
>different from all other servers when it comes to CGI output?

Mac Web servers have in fact a very different CGI interface from the rest of
the world. The MacPerl CGI glue does some behind the scenes work to make
everything appear right.

>The normal method
>for a response printed by a CGI is to start with the header: "Content-type:
>text/html\r\n\r\n" so that the server and browser know what's coming.

Bad idea. Use \015\012 instead.

> When I started coding for our
>WebSTAR server, I followed every instruction book that said to start off with
>"Content-type: text/html\r\n\r\n" and continue on with HTML.

Get a refund for your instruction books and use \015\012 instead. What you're
generating is \012\015, the one EOL (mis-) convention not recognized by the
glue.

>	HTTP/1.0 302 Redirect\r
>	Location: http://www.helix.net/~joshua\r
>	\r
>which, instead of redirecting the browser, just displays a blank web page! A
>big, gray nothing.
>	Anybody know anything about this?

That's another design decision in the glue: It assumes that someone who's going
to write such an explicit design header is going to have it terminated
correctly, so you'll either have to use \015\012 or the lazy form:

Location: xxxxxx\n\n

In the latter case, the glue figures out that you probably want a 301 status.

To summarize: the glue figures out to handle a wide variety of response formats
but obviously not quite everything imaginable.

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "I'm set free to find a new illusion" -- Velvet Underground

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch