From 49eb6e38061d744f4a35b78082dce49fa35f79c8 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 15 Jan 2010 19:50:13 +0100 Subject: some more coding standard compliance updates --- inc/HTTPClient.php | 1 - 1 file changed, 1 deletion(-) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index 578d7e7cd..c88d1c45d 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -279,7 +279,6 @@ class HTTPClient { $written += $ret; } - // read headers from socket $r_headers = ''; do{ -- cgit v1.2.3 From 7aeda574860428d96fa1660613646b5684c1a6ea Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 26 Jun 2010 20:42:48 +0200 Subject: added proxy exception regexp FS#1247 --- inc/HTTPClient.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index c88d1c45d..ebe349573 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -29,11 +29,12 @@ class DokuHTTPClient extends HTTPClient { $this->HTTPClient(); // set some values from the config - $this->proxy_host = $conf['proxy']['host']; - $this->proxy_port = $conf['proxy']['port']; - $this->proxy_user = $conf['proxy']['user']; - $this->proxy_pass = conf_decodeString($conf['proxy']['pass']); - $this->proxy_ssl = $conf['proxy']['ssl']; + $this->proxy_host = $conf['proxy']['host']; + $this->proxy_port = $conf['proxy']['port']; + $this->proxy_user = $conf['proxy']['user']; + $this->proxy_pass = conf_decodeString($conf['proxy']['pass']); + $this->proxy_ssl = $conf['proxy']['ssl']; + $this->proxy_except = $conf['proxy']['except']; } @@ -105,6 +106,7 @@ class HTTPClient { var $proxy_user; var $proxy_pass; var $proxy_ssl; //boolean set to true if your proxy needs SSL + var $proxy_except; // regexp of URLs to exclude from proxy // what we use as boundary on multipart/form-data posts var $boundary = '---DokuWikiHTTPClient--4523452351'; @@ -202,7 +204,7 @@ class HTTPClient { if(isset($uri['pass'])) $this->pass = $uri['pass']; // proxy setup - if($this->proxy_host){ + if($this->proxy_host && (!$this->proxy_except || !preg_match('/'.$this->proxy_except.'/i',$url)) ){ $request_url = $url; $server = $this->proxy_host; $port = $this->proxy_port; -- cgit v1.2.3 From 7e7f15ca0aadcdadcb930ab025be1c7311365078 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 2 Aug 2010 15:54:41 +0200 Subject: Convenience function in HTTPClient The new dget() method works accepts URL parameters as associative array (like the post() method). --- inc/HTTPClient.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'inc/HTTPClient.php') diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php index ebe349573..b6feba35a 100644 --- a/inc/HTTPClient.php +++ b/inc/HTTPClient.php @@ -152,6 +152,29 @@ class HTTPClient { return $this->resp_body; } + /** + * Simple function to do a GET request with given parameters + * + * Returns the wanted page or false on an error. + * + * This is a convenience wrapper around get(). The given parameters + * will be correctly encoded and added to the given base URL. + * + * @param string $url The URL to fetch + * @param string $data Associative array of parameters + * @param bool $sloppy304 Return body on 304 not modified + * @author Andreas Gohr + */ + function dget($url,$data,$sloppy304=false){ + if(strpos($url,'?')){ + $url .= '&'; + }else{ + $url .= '?'; + } + $url .= $this->_postEncode($data); + return $this->get($url,$sloppy304); + } + /** * Simple function to do a POST request * -- cgit v1.2.3