chorg has asked for the wisdom of the Perl Monks concerning the following question:

I was wondering about issues with nph scripts(Wondering in the sense that I want to use it Real Soon Now) .Questions:

I heard somewhere that this does not work with IE style browsers. Is that true?

Which browsers does it work with, and why does it not work with some?

What server issues are there using this?

I want to do a chat/instant messaging type app, and if this works on all browsers, I get a weekend! If not - well, you know how it is...
_______________________________________________
"Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."

Replies are listed 'Best First'.
Re: What's up with nph scripts?
by merlyn (Sage) on Jan 11, 2001 at 20:21 UTC
Re: What's up with nph scripts?
by Fastolfe (Vicar) on Jan 11, 2001 at 20:55 UTC
    "NPH Scripts", by defintion, are scripts whose headers go unparsed by the server. In other words, the contents of these scripts go out directly to the browser without the usual CGI involvement by the server to parse the headers the script generates and formulate the CGI script's response into a valid HTTP response.

    So if you build your script right, there should be no compatibility problems at all between it and any browser. If a normal CGI script has no problems with IE, and your NPH version of the same script does, you've done something wrong. Generally NPH scripts are only useful if you need greater control over MIME types (such as with multipart replies, and even then this might work with standard CGI), or you want to override certain server behavior.

    There is a compatibility issue with IE in that it does not handle multipart HTTP responses by the server. Things like multipart/x-mixed-replace are unsupported. That is frequently the most common use for NPH scripts, so I'm guessing that's what you were talking about.

      I think the original poster was wanting the (partial) page to render (be visible) before end-of-file is received by the browser. It is that specific aspect of NPH CGI that they were wondering about (and whether it works in IE, for example), IMHO.

              - tye (but my friends call me "Tye")
Re: What's up with nph scripts?
by Trimbach (Curate) on Jan 11, 2001 at 22:48 UTC
    I want to do a chat/instant messaging type app, and if this works on all browsers, I get a weekend! If not - well, you know how it is...

    Been there, done that, got the big nasty sweaty teeshirt. I'm no expert on nph's, but I, too, wanted a chat server that didn't rely on http-refresh to update the screen. I haven't examined Merlyn's Web Techniques article in depth, but I've run into problems with web browsers that (for reasons unknown) tend to "stop" refreshing at random intervals.

    So I wrote a NPH chat server that worked great... cross-platform compatible (worked fine on IE and Netscape, at least) where each message appeared below the previous one. Even tacked on a little Javascript so that everytime a new message came in the window automatically scrolled to the bottom so it looked like a "traditional" chat room. Problem: it didn't work for anyone accessing from AOL. My (unconfirmed) theory was that the AOL proxy servers were beating the hell out of the headers that were being passed. So, back to the drawing board since it HAD to work with AOL-ers.

    Version 2.0 Still used NPH, only this time instead of tacking on messages one after the other, the chatroom server "push" refreshes the browser so everyone always sees the latest 10 messages or so and that's it. This is functionally identical to the http-refresh method only now I don't have to worry about flaky browsers.

    ... but in the process I lost my IE/Netscape compatibility. Version 2 only runs on Netscape, but it DOES work with AOL (on Netscape.) sigh.

    YMMV. I wish you good luck, and hey, if you come up with something I (for one) would like to see it.

    Gary Blackburn
    Trained Killer