summaryrefslogtreecommitdiff
path: root/inc/HTTPClient.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2014-07-04 17:16:09 +0200
committerAndreas Gohr <andi@splitbrain.org>2014-07-04 17:21:19 +0200
commit2314059e5b8fc84fcdc52e4506ec907d0c792f50 (patch)
tree242814179e30ee560c175dd5b98a97fb8be6a0be /inc/HTTPClient.php
parentdc6ff004a94faa44d41f2747cc6a0141d072d6e8 (diff)
downloadrpg-2314059e5b8fc84fcdc52e4506ec907d0c792f50.tar.gz
rpg-2314059e5b8fc84fcdc52e4506ec907d0c792f50.tar.bz2
allow for easier HTTPClient debugging
Sometimes users report bugs or problems releated to HTTP connections made by our HTTPCient (eg. in the extension manager or XMLRPC). Debugging those problems previously required modifying some sources to enable the debugging output of the HTTPClient. This patch adds a way to enable the debugging via a request parameter. Since HTTP requests are often done only *after* some button was clicked, the parameter is also looked for in the referrer of a request. Debugging output is enabled through the existence of the parameter 'httpdebug' and is directly printed to the screen. Debugging HTTP only works when allowdebug is enabled.
Diffstat (limited to 'inc/HTTPClient.php')
-rw-r--r--inc/HTTPClient.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index 4352bcb97..6ac67f159 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -35,6 +35,19 @@ class DokuHTTPClient extends HTTPClient {
$this->proxy_pass = conf_decodeString($conf['proxy']['pass']);
$this->proxy_ssl = $conf['proxy']['ssl'];
$this->proxy_except = $conf['proxy']['except'];
+
+ // allow enabling debugging via URL parameter (if debugging allowed)
+ if($conf['allowdebug']) {
+ if(
+ isset($_REQUEST['httpdebug']) ||
+ (
+ isset($_SERVER['HTTP_REFERER']) &&
+ strpos($_SERVER['HTTP_REFERER'], 'httpdebug') !== false
+ )
+ ) {
+ $this->debug = true;
+ }
+ }
}