Erland Nylend wrote:
The CPE is the client, sending HTTP POST
_queries_ with some data. The remote management server (apache server)
is sending HTTP POST _replies_ back, but those also contains data.
Okay, that makes sense. Persistent connections shouldn't require any
additional work on your part. Apache handles that.
.. but when I have read the headers and the data in the first POST
request, I'm not sure what to do in order to access the _second_
POST query.
These will all appear to be totally separate requests, even though they
come in on the same connection. You finish with one before moving on to
the next.
Can I throw the first $r away, and initialize a new one, or can I
reset the first one, making it ready to receive a new HTTP request?
No, you have to complete the request first.
As I'm writing this, I think that one one solution is to send a
session cookie to the CPE in the response to the the first HTTP
POST, store the session ID in some way locally, and then exit the
script. The next HTTP POST from the same CPE will then include a
session ID, which I can use to keep track of all the HTTP POSTS from
the same host.
You do need some way to identify who you're talking to. Cookies are
good if you think you might lose the connection. In a closed
environment like yours, you might be able to use something like the
client's IP.
Also, mod_perl allows you to run some code when a connection is
established and keep some data pertaining to that connection around.
See http://perl.apache.org/docs/2.0/api/Apache2/Connection.html.
- Perrin