From a6b0ac536291ff7aeff60de8e015a89f2b52b736 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 7 Aug 2012 11:35:51 +0800 Subject: [PATCH] MDL-34290 Allow to have several requests to the same instance of oauth_helper --- lib/filelib.php | 7 +++++++ lib/oauthlib.php | 3 +++ 2 files changed, 10 insertions(+) diff --git a/lib/filelib.php b/lib/filelib.php index da237969442..f7487c3da86 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -2898,6 +2898,13 @@ class curl { unset($this->options['CURLOPT_FILE']); } + /** + * Resets the HTTP Request headers (to prepare for the new request) + */ + public function resetHeader() { + $this->header = array(); + } + /** * Set HTTP Request Header * diff --git a/lib/oauthlib.php b/lib/oauthlib.php index ed29777b33d..bc198b936bf 100644 --- a/lib/oauthlib.php +++ b/lib/oauthlib.php @@ -289,6 +289,9 @@ class oauth_helper { $oauth_params = $this->prepare_oauth_parameters($url, array('oauth_token'=>$token), $method); $this->setup_oauth_http_header($oauth_params); $content = call_user_func_array(array($this->http, strtolower($method)), array($url, $params, $this->http_options)); + // reset http header and options to prepare for the next request + $this->http->resetHeader(); + // return request return value return $content; }