Loading docs/manual/misc/FAQ.html +61 −5 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ <!--#include virtual="header.html" --> <H1>Apache Server Frequently Asked Questions</H1> <P> $Revision: 1.32 $ ($Date: 1997/04/21 22:27:57 $) $Revision: 1.33 $ ($Date: 1997/04/21 22:43:23 $) </P> <P> If you are reading a text-only version of this FAQ, you may find numbers Loading @@ -21,10 +21,6 @@ do not appear, and are not needed, for the hypertext version. <!-- - can't bind to port 80 --> <!-- - permission denied --> <!-- - address already in use --> <!-- - "httpd: could not set socket option TCP_NODELAY" --> <!-- not a problem if occasional; client disc before server --> <!-- setsockopt --> <!-- - disable Apache buffering of script output by using nph- --> <!-- - access control based on DNS name really needs MAXIMUM_DNS --> <!-- and double-check that rDNS resolves to name expected --> <!-- - mod_auth & passwd lines "user:pw:.*" - ++1st colon onward is --> Loading Loading @@ -124,6 +120,9 @@ do not appear, and are not needed, for the hypertext version. <LI><A HREF="#nodelay">Why am I getting "<SAMP>httpd: could not set socket option TCP_NODELAY</SAMP>" in my error log?</A> </LI> <LI><A HREF="#nph-scripts">How can I get my script's output without Apache buffering it?</A> </LI> </OL> </LI> </UL> Loading Loading @@ -926,6 +925,63 @@ do not appear, and are not needed, for the hypertext version. </P> <HR> </LI> <LI><A NAME="nph-scripts"> <STRONG>How can I get my script's output without Apache buffering it?</STRONG> </A> <P> In order to improve network performance, Apache buffers script output into relatively large chunks. If you have a script that sends information in bursts (such as partial-done messages in a multi-commit database transaction, perhaps), the client will not necessarily get the output as the script is generating it. </P> <P> To avoid this, Apache recognises scripts whose names begin with "<SAMP>nph-</SAMP>" as <EM>non-parsed-header</EM> scripts. That is, Apache won't buffer their output, but connect it directly to the socket going back to the client. </P> <P> While this will probably do what you want, there <EM>are</EM> some disadvantages to it: </P> <UL> <LI><STRONG>YOU</STRONG> (the script) are responsible for generating <STRONG>ALL</STRONG> of the HTTP header, and no longer <EM>just</EM> the "<SAMP>Content-type</SAMP>" or "<SAMP>Location</SAMP>" headers </LI> <LI>Unless your script generates its output carefully, you will see a performance penalty as excessive numbers of packets go back and forth </LI> </UL> <P> As an example how you might handle the former (in a Perl script): </P> <CODE> <DL> <DD>if ($0 =~ m:/*nph-:) { <BR> $HTTP_headers = "HTTP/1.1 200 OK\015\012"; <BR> $HTTP_headers .= "Connection: close\015\012"; <BR> printf ($HTTP_headers); <BR> }; </DD> </DL> </CODE> <P> and then follow with your normal non-<SAMP>nph</SAMP> headers. </P> </LI> </OL> <HR> <!--#include virtual="footer.html" --> Loading Loading
docs/manual/misc/FAQ.html +61 −5 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ <!--#include virtual="header.html" --> <H1>Apache Server Frequently Asked Questions</H1> <P> $Revision: 1.32 $ ($Date: 1997/04/21 22:27:57 $) $Revision: 1.33 $ ($Date: 1997/04/21 22:43:23 $) </P> <P> If you are reading a text-only version of this FAQ, you may find numbers Loading @@ -21,10 +21,6 @@ do not appear, and are not needed, for the hypertext version. <!-- - can't bind to port 80 --> <!-- - permission denied --> <!-- - address already in use --> <!-- - "httpd: could not set socket option TCP_NODELAY" --> <!-- not a problem if occasional; client disc before server --> <!-- setsockopt --> <!-- - disable Apache buffering of script output by using nph- --> <!-- - access control based on DNS name really needs MAXIMUM_DNS --> <!-- and double-check that rDNS resolves to name expected --> <!-- - mod_auth & passwd lines "user:pw:.*" - ++1st colon onward is --> Loading Loading @@ -124,6 +120,9 @@ do not appear, and are not needed, for the hypertext version. <LI><A HREF="#nodelay">Why am I getting "<SAMP>httpd: could not set socket option TCP_NODELAY</SAMP>" in my error log?</A> </LI> <LI><A HREF="#nph-scripts">How can I get my script's output without Apache buffering it?</A> </LI> </OL> </LI> </UL> Loading Loading @@ -926,6 +925,63 @@ do not appear, and are not needed, for the hypertext version. </P> <HR> </LI> <LI><A NAME="nph-scripts"> <STRONG>How can I get my script's output without Apache buffering it?</STRONG> </A> <P> In order to improve network performance, Apache buffers script output into relatively large chunks. If you have a script that sends information in bursts (such as partial-done messages in a multi-commit database transaction, perhaps), the client will not necessarily get the output as the script is generating it. </P> <P> To avoid this, Apache recognises scripts whose names begin with "<SAMP>nph-</SAMP>" as <EM>non-parsed-header</EM> scripts. That is, Apache won't buffer their output, but connect it directly to the socket going back to the client. </P> <P> While this will probably do what you want, there <EM>are</EM> some disadvantages to it: </P> <UL> <LI><STRONG>YOU</STRONG> (the script) are responsible for generating <STRONG>ALL</STRONG> of the HTTP header, and no longer <EM>just</EM> the "<SAMP>Content-type</SAMP>" or "<SAMP>Location</SAMP>" headers </LI> <LI>Unless your script generates its output carefully, you will see a performance penalty as excessive numbers of packets go back and forth </LI> </UL> <P> As an example how you might handle the former (in a Perl script): </P> <CODE> <DL> <DD>if ($0 =~ m:/*nph-:) { <BR> $HTTP_headers = "HTTP/1.1 200 OK\015\012"; <BR> $HTTP_headers .= "Connection: close\015\012"; <BR> printf ($HTTP_headers); <BR> }; </DD> </DL> </CODE> <P> and then follow with your normal non-<SAMP>nph</SAMP> headers. </P> </LI> </OL> <HR> <!--#include virtual="footer.html" --> Loading