]> git.immae.eu Git - github/shaarli/Shaarli.git/commitdiff
Merge pull request #1096 from ArthurHoaro/feature/download-params
authorArthurHoaro <arthur@hoa.ro>
Tue, 13 Mar 2018 17:02:49 +0000 (18:02 +0100)
committerGitHub <noreply@github.com>
Tue, 13 Mar 2018 17:02:49 +0000 (18:02 +0100)
Make max download size and timeout configurable

1  2 
index.php

diff --combined index.php
index 3b8b52a706f62aff784aef0f24033b6c94300522,f7722433aaea8665e05e5c228c080b81aa7f1a81..f7f87d95bcea5e296515413065d043719b5e5b9f
+++ b/index.php
@@@ -887,7 -887,7 +887,7 @@@ function renderPage($conf, $pluginManag
          if (empty($params['searchtags'])) {
              $params['searchtags'] = trim($_GET['addtag']);
          }
 -        else if ($addtag) {
 +        elseif ($addtag) {
              $params['searchtags'] = trim($params['searchtags']).' '.trim($_GET['addtag']);
          }
  
              } else {
                  unset($_SESSION['visibility']);
              }
 -        } else if ($_GET['visibility'] === 'public') {
 +        } elseif ($_GET['visibility'] === 'public') {
              if (empty($_SESSION['visibility']) || $_SESSION['visibility'] !== 'public') {
                  // See only public links
                  $_SESSION['visibility'] = 'public';
              if (empty($title) && strpos(get_url_scheme($url), 'http') !== false) {
                  // Short timeout to keep the application responsive
                  // The callback will fill $charset and $title with data from the downloaded page.
-                 get_http_response($url, 25, 4194304, get_curl_download_callback($charset, $title));
+                 get_http_response(
+                     $url,
+                     $conf->get('general.download_max_size', 4194304),
+                     $conf->get('general.download_timeout', 30),
+                     get_curl_download_callback($charset, $title)
+                 );
                  if (! empty($title) && strtolower($charset) != 'utf-8') {
                      $title = mb_convert_encoding($title, 'utf-8', $charset);
                  }