Do only follow HTTP and HTTPS redirects

We do not want to follow redirects to other protocols since they might allow an adversary to bypass network restrictions. (i.e. a redirect to ftp:// might be used to access files of a FTP server which might be in a secure zone and not be reachable from the net but from the ownCloud server)
In general, calling a function has a certain overhead and as such recursion should be avoided when possible. Not that it matters here, but there also is a recursion limit of 100 in some environments. This can probably simply be replaced with a do while loop:
```
$h = array('Location' => $location);
do
{
	$h = get_headers($headers['Location'], 1);
}
while (isset($h['Location']) && (strpos($h['Location'], 'http://') === 0 || strpos($h['Location'], 'https://') === 0);
```