Thank you, this resolves the problem with the Content-Type being sent when the script is NPH and using the CGI method. However, it does not appear to resolve the Connection: Keep-Alive issue, the connection is still being closed when the script finishes.

My script is calculating the body length and sending the Content-Length header, aswell as any other headers that are specified in the rfc.

304 Example using:
print header(-status => '304 Not Modified', -nph => 1, -type => '', -connection => 'Keep-Alive', 'Keep-Alive' => 'timeout=15, max=100');

Here is the connection closing after issueing the 304:

GET /nph-test.pl HTTP/1.1 Host: www.xyz.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.7 +) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0. +8,text/vnd.wap.wml;q=0.6 Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache HTTP/1.1 304 Not Modified Server: Apache/1.3.26 (Unix) (Red-Hat/Linux) FrontPage/5.0.2.2510 Status: 304 Not Modified Date: Tue, 24 Mar 2009 14:40:18 GMT keep-alive: timeout=15, max=100 connection: Keep-Alive Connection closed by foreign host.

And here after serving a page:

GET /nph-servefiles.pl HTTP/1.1 Host: www.xyz.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.7 +) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0. +8,text/vnd.wap.wml;q=0.6 Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache HTTP/1.1 200 OK Accept-Ranges: none Expires: Sun, 20 Mar 2011 18:56:47 GMT Server: Apache/1.3.26 (Unix) (Red-Hat/Linux) FrontPage/5.0.2.2510 Vary: Accept,Accept-Encoding,User-Agent Content-Length: 20 Etag: "06f0001f16dfd8b9632cc9640d62e5e0-gzip" Cache-Control: s-maxage=1209600,proxy-revalidate,must-revalidate, max- +age=62741536 Content-Encoding: gzip Last-Modified: Tue, 24 Mar 2009 02:04:17 GMT Date: Tue, 24 Mar 2009 14:56:01 GMT Connection: Keep-Alive Content-Type: application/xhtml+xml, charset=utf-8 Keep-Alive: timeout=15,max=100 Connection closed by foreign host.

And here 2 requests not using a script:

GET /images/validate.gif HTTP/1.1 Host: www.xyz.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.7 +) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0. +8,text/vnd.wap.wml;q=0.6 Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache HTTP/1.1 200 OK Date: Tue, 24 Mar 2009 14:44:31 GMT Server: Apache/1.3.26 (Unix) (Red-Hat/Linux) FrontPage/5.0.2.2510 Cache-Control: s-maxage=1209600,proxy-revalidate,must-revalidate, max- +age=62741536 Expires: Sun, 20 Mar 2011 18:56:47 GMT Last-Modified: Fri, 20 Mar 2009 18:56:47 GMT ETag: "92042c-1bd8-49c3e6ef" Accept-Ranges: bytes Content-Length: 7128 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: image/gif GET /images/validate.gif HTTP/1.1 Host: www.xyz.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.7 +) Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729) Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0. +8,text/vnd.wap.wml;q=0.6 Accept-Language: en-gb,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache HTTP/1.1 200 OK Date: Tue, 24 Mar 2009 14:44:48 GMT Server: Apache/1.3.26 (Unix) (Red-Hat/Linux) FrontPage/5.0.2.2510 Cache-Control: s-maxage=1209600,proxy-revalidate,must-revalidate, max- +age=62741519 Expires: Sun, 20 Mar 2011 18:56:47 GMT Last-Modified: Fri, 20 Mar 2009 18:56:47 GMT ETag: "92042c-1bd8-49c3e6ef" Accept-Ranges: bytes Content-Length: 7128 Keep-Alive: timeout=15, max=99 Connection: Keep-Alive Content-Type: image/gif

Any further information appreciated


In reply to Re^2: NPH and Connection: Keep-Alive by gfairweather
in thread NPH and Connection: Keep-Alive by gfairweather

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.