diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 0c3b4f435a8f0d12570f15be6db31e4223a9441c..e769b0c93e60e56b205360f5609299f534ba4d62 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -35,6 +35,29 @@ class DokuHTTPClient extends HTTPClient { $this->proxy_pass = conf_decodeString($conf['proxy']['pass']); $this->proxy_ssl = $conf['proxy']['ssl']; } + + + /** + * Wraps an event around the parent function + * + * @triggers HTTPCLIENT_REQUEST_SEND + * @author Andreas Gohr <andi@splitbrain.org> + */ + function sendRequest($url,$data='',$method='GET'){ + $httpdata = array('url' => $url, + 'data' => $data, + 'method' => $method); + $evt = new Doku_Event('HTTPCLIENT_REQUEST_SEND',$httpdata); + if($evt->advise_before()){ + $url = $httpdata['url']; + $data = $httpdata['data']; + $method = $httpdata['method']; + } + $evt->advise_after(); + unset($evt); + return parent::sendRequest($url,$data,$method); + } + } /** @@ -165,19 +188,6 @@ class HTTPClient { unset($this->headers['Accept-encoding']); } - - $httpdata = array('url' => $url, - 'data' => $data, - 'method' => $method); - $evt = new Doku_Event('HTTPCLIENT_REQUEST_SEND',$httpdata); - if($evt->advise_before()){ - $url = $httpdata['url']; - $data = $httpdata['data']; - $method = $httpdata['method']; - } - $evt->advise_after(); - unset($evt); - // parse URL into bits $uri = parse_url($url); $server = $uri['host'];