Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

After the script ends the client will have the HTML page and the browser will then request the css, the javascript and the images that are linked in the document.

Trying to put it simply, the script runs from top to bottom with 2 exit points. If cache control is met by comparing last modifed date and etag then the script exits with a 304. Otherwise the HTML is built from a template and held in a scalar, so the length can be calculated, the headers are output followed by the body and then the script exits.

My expectation, based on how Apache serves files, is that if the browser sends Keep-Alive then the server responds with Keep-Alive, a timeout value and max objects value. If the next request is within the timeout value and the max objects has not been met then the request is served on the open connection, the timer is reset and the max object decremented by 1. If there is no further request within the timeout or the max objects is met then the connection is closed by the server. You can partially see this in the two header traces that I posted above.

What I see from using telnet/browser and wireshark is that as soon as the script exits, instead of the connection being kept alive, the server sends (FIN,ACK), the broswer acknowledges (ACK) and then sends (FIN,ACK) and the server acknowledges (ACK) and the connection is closed immediately. Any further requests for the css, javascript and images open a new connection and keep-alives function as expected.

What I'm trying to figure out is how do I replicate the normal Apache behavior for keep-alive. I mimic the headers exactly but Apache does not honour what has been sent. My assumption is that it's to do with the fact that it's NPH. Normally Apache would append these headers. What I need to be able to do is access the Apache timeout value and the max objects value so I can set those appropriately and inform Apache to decrement the max objects value and have Apache not tear down the connection.

That's my understanding and I hope that makes sense.


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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-20 02:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found