Projet

Général

Profil

Révision a192dc0b

Ajouté par Assos Assos il y a environ 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/feeds/libraries/http_request.inc
49 49
    return FALSE;
50 50
  }
51 51

  
52
  // Drop the data into a seperate variable so all manipulations of the html
52
  // Drop the data into a separate variable so all manipulations of the html
53 53
  // will not effect the actual object that exists in the static cache.
54 54
  // @see http_request_get.
55 55
  $downloaded_string = $download->data;
......
196 196

  
197 197
      if ($accept_invalid_cert) {
198 198
        curl_setopt($download, CURLOPT_SSL_VERIFYPEER, 0);
199
        curl_setopt($download, CURLOPT_SSL_VERIFYHOST, 0);
199 200
      }
200 201
      $header = '';
201 202
      $data = curl_exec($download);
......
440 441
    // Produces variables $scheme, $host, $user, $pass, $path, $query and
441 442
    // $fragment.
442 443
    $parsed_url = parse_url($base_url);
444
    if ($parsed_url === FALSE) {
445
      // Invalid $base_url.
446
      return FALSE;
447
    }
443 448

  
444
    $path = dirname($parsed_url['path']);
449
    $path = isset($parsed_url['path']) ? $parsed_url['path'] : '';
450
    if (strlen($path) > 0 && substr($path, -1) != '/') {
451
      // Path ends not with '/', so remove all before previous '/'.
452
      $path = dirname($path);
453
    }
445 454

  
446 455
    // Adding to the existing path.
456
    $cparts = array();
447 457
    if ($url{0} == '/') {
448 458
      $cparts = array_filter(explode("/", $url));
449 459
    }
450 460
    else {
451 461
      // Backtracking from the existing path.
452
      $cparts = array_merge(array_filter(explode("/", $path)), array_filter(explode("/", $url)));
453
      foreach ($cparts as $i => $part) {
454
        if ($part == '.') {
455
          $cparts[$i] = NULL;
456
        }
457
        if ($part == '..') {
458
          $cparts[$i - 1] = NULL;
459
          $cparts[$i] = NULL;
460
        }
462
      $path_cparts = array_filter(explode("/", $path));
463
      $url_cparts = array_filter(explode("/", $url));
464
      $cparts = array_merge($path_cparts, $url_cparts);
465
    }
466

  
467
    $remove_parts = 0;
468
    // Start from behind.
469
    $reverse_cparts = array_reverse($cparts);
470
    foreach ($reverse_cparts as $i => &$part) {
471
      if ($part == '.') {
472
        $part = NULL;
473
      }
474
      elseif ($part == '..') {
475
        $part = NULL;
476
        $remove_parts++;
477
      }
478
      elseif ($remove_parts > 0) {
479
        // If the current part isn't "..", and we had ".." before, then delete
480
        // the part.
481
        $part = NULL;
482
        $remove_parts--;
461 483
      }
462
      $cparts = array_filter($cparts);
463 484
    }
485
    $cparts = array_filter(array_reverse($reverse_cparts));
464 486
    $path = implode("/", $cparts);
465 487

  
466 488
    // Build the prefix to the path.

Formats disponibles : Unified diff