FileUtil::downloadFileFromHttp supports now https-URLs
authorTimWolla <timwolla@arcor.de>
Thu, 14 Jul 2011 17:43:09 +0000 (19:43 +0200)
committerTimWolla <timwolla@arcor.de>
Thu, 14 Jul 2011 17:43:09 +0000 (19:43 +0200)
Tested with both the fopen and fsockopen way

wcfsetup/install/files/lib/util/FileUtil.class.php

index 1aa3507c00dba0a7c771ec03fae3454ea4e12602..56914e922a6a489d93e312b6cab09251b370a438 100644 (file)
@@ -365,12 +365,12 @@ class FileUtil {
                }\r
                // if allow_url_fopen isn't active, we attempt to use our own http download functionality.\r
                else {\r
-                       $port = 80;\r
                        $parsedUrl = parse_url($httpUrl);\r
+                       $port = ($parsedUrl['scheme'] == 'https' ? 443 : 80);\r
                        $host = $parsedUrl['host'];\r
                        $path = $parsedUrl['path'];\r
-                       \r
-                       $remoteFile = new RemoteFile($host, $port, 30, $options); // the file to read.\r
+\r
+                       $remoteFile = new RemoteFile(($parsedUrl['scheme'] == 'https' ? 'ssl://' : '').$host, $port, 30, $options); // the file to read.\r
                        if (!isset($remoteFile)) {\r
                                $localFile->close();\r
                                unlink($newFileName);\r