• Adding Remote files will use a lot of memory beacuase the get_headers Function uses a GET request instead a http HEAD Request to retrieve the content-length Header of the Remote File.

    So we should change the code of the remote_filesize function like this (if not we get a Internal Server Error):

    ### Function: Get Remote File Size
    if(!function_exists('remote_filesize')) {
            function remote_filesize($uri) {
                    $contentLength = __('unknown', 'wp-downloadmanager');
                    $ch = curl_init($uri);
                    curl_setopt($ch, CURLOPT_NOBODY, true);
                    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                    curl_setopt($ch, CURLOPT_HEADER, true);
                    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
                    $data = curl_exec($ch);
                    curl_close($ch);
                    if ($data === false) {
                            return $contentLength;
                    }
                    if (preg_match('/Content-Length: (\d+)/', $data, $matches)) {
                            $contentLength = (int)$matches[1];
                    }
                    return $contentLength;
            }
    }

    Can you fix this in the next releases?

    https://www.ads-software.com/plugins/wp-downloadmanager/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘get_headers issue with large files’ is closed to new replies.