Re: Simple Proposal for setting HTTP headers

On 07/08/2013 02:45 , Wang, Jing J wrote:
> On 06/08/2013 18:26 , Robin Berjon wrote:
>>> You need more than CGI, you actually need NPH.
> I am not familiar with NPH, looks it provide more flexibility to
> operate low level headers, but not as popular as CGI. Could you tell
> what kind of web test that CGI is not capable to support? AFAWIK,
> websocket is the only thing I can image.

NPH isn't an alternative to CGI, it's an addition (well, more like a 
subtraction) to it.

The problem with CGI is that the server has the ultimate control over 
your headers. If you want to test that returning "200 UNICORNS ABOUND" 
is processed just like any other 200, you can't. In fact, it's been a 
very long time since I touched CGI but I don't think you can respond 
with anything other than 200, 301 (by sending Location), or 500 (by 
blowing up).

It can get more subtle. For instance, you might:

     print "Content-Type: text/html\n\n";

but the server might slap a charset onto that because it thinks it knows 
better. Likewise, you may set a relative Location for redirects, and 
it'll absolutise it (or not, it depends).

NPH, aka Non-Parsed Headers, is just CGI in which the server makes the 
promise that it won't touch your headers. You just print the whole 
response yourself. It is, however, a technique from back when you could 
hold an audience of hackers in thrall with a talk on "Enabling Dynamic 
E-Commerce with Server-Side Includes". As far as I know it would be the 
only way of using CGI that would address our needs, but it probably 
isn't even supported in most servers today (it likely never was on IIS).

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Wednesday, 7 August 2013 09:55:37 UTC