summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inc/HTTPClient.php36
1 files changed, 23 insertions, 13 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 0c3b4f435..e769b0c93 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'];