On 2012-03-04 19:19, Swaminathan Bhaskar wrote:
Hello,
How can I call another url from an output filter - here is the scenario:
when a client accesses abc.mydomain.com/signon, this url autheticates the
user and we dont want the response going back to the client rather call
another url xyz.mydomain.com/fetchdata which will return some data ... we
want to send the data from the second url and response headers from first
url merged back to the client. So my thought is to intercept the response
from the first url in an output ffilter and make a call from the output
filter to the second url. What function call would allow me to make th call
to the second url Any help appreciated
Hello,
We did something similar but we didn't issue the 2nd request from the
output filter of the first.
The first request was made by the apache subrequest API (the
ap_sub_req_lookup_uri and ap_run_sub_req functions). The output filter
ran until it encountered an end-of-stream. It did not make any other
request. The output filter of the subrequest did not pass any brigade to
downstream filters. It simply parsed the response, stored relevant data
in some structure and returned APR_SUCCESS to its upstream filters.
Next, after ap_run_sub_req returned, we invoked the 2nd URL via the
proxy module. The useful data returned by the 1st URL was taken from the
structure in which the subrequest stored it.
Calling a 2nd URL from output filters is a bit tricky, as you have
filter-chains invoked from within a filter-chain, so we preferred to
call the 2nd URL only after the request to the first completed.
Regards,
Sorin