Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: NPH and Connection: Keep-Alive

by gfairweather (Novice)
on Mar 24, 2009 at 23:28 UTC ( #752978=note: print w/replies, xml ) Need Help??

in reply to Re: NPH and Connection: Keep-Alive
in thread NPH and Connection: Keep-Alive

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://752978]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2020-10-22 01:45 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (225 votes). Check out past polls.