Sending a HTTP request from within a plugin
robbyd at netaport.com
Wed Jul 25 18:08:05 UTC 2007
I'm writing a perlbal plugin where when I receive a certain event
(specifically, end_proxy_request), I need to make a HTTP request out to an
external resource. Basically this is because the I have a reproxy setup
going with perlbal and need to keep state in my environment around when a
particular resource request starts and stops for each given client. The HTTP
request will be very simple with only 1 or 2 GET parameters (no POST data),
and I will just need to receive a single equally basic HTTP response, which
should be a 200 OK.
I was looking at the source and it looks like I could use Danga::Socket
directly for this, however given the fact that these HTTP requests could be
going out quite frequently (and all to the same host), I'd probably want to
make the requests on a persistent connection (using KeepAlives).
It's been a long time since I've worked in perl though, so I was wondering
if there was a built in mechanism in perlbal or somewhere else I could use
to make these requests, or some code I could start with to implement this.
More information about the perlbal