Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Embedding "user" CGI output into a mod_perl response

by ioannis (Priest)
on May 10, 2006 at 01:26 UTC ( #548359=note: print w/ replies, xml ) Need Help??


in reply to Embedding "user" CGI output into a mod_perl response

To customize the response to the browser, you will need to capture the output from the cgi script. For cgi scripts at another machine, your Apache handler will in affect act as a forward proxy to the request: it will send the request with LWP::UserAgent and capture the output with LWP::Response.

There is no difficulty if you know the Apache API. Just ensure sure that all incoming and outgoing headers are copied, especially the HTTP headers that may appear twice, like Cookie -- you cannot use functions like $r->headers_in that return hash structures, thus suppressing the second Cookie header.


Comment on Re: Embedding "user" CGI output into a mod_perl response
Re^2: Embedding "user" CGI output into a mod_perl response
by bmcatt (Friar) on May 10, 2006 at 01:38 UTC
    This is actually going to be for cgi scripts that are deployed (in the current "old" system) on the same system, so there's no need to act as a full proxy. Theoretically, I *should* be able to just use some aspect of the Apache interface(s) to fire off the CGI script "inline" and then extract the body of the response.

    Thanks for the suggestion, though. I'd already thought of proxying it, but that then leaves me needing to have an exposed (in the sense of publicly-visible) cgi interface and I'm explicitly trying to avoid that.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-12-25 18:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (161 votes), past polls