+ // Save the configured value for follow_redirects
+ $old_follow = $this->config['follow_redirects'];
+ try {
+ // Temporarily (possibly) override the follow_redirects setting
+ $this->config['follow_redirects'] = $follow_redirects;
+ return $this->doRequest($url, self::METHOD_HEAD, $headers);
+ } catch (Exception $e) {
+ // Let the exception go on its merry way.
+ throw $e;
+ } finally {
+ // reset to the old value
+ $this->config['follow_redirects'] = $old_follow;
+ }
+ //we've either returned or thrown exception here