Secure pages module is not working with uppercase characters in URL

When we specify url that have uppercase letters the module doesn't work for those pages

The solution

Remove the drupal_strtolower() when we get the list of urls in saved.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Yago Elias created an issue. See original summary.

Yago Elias’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
872 bytes
rodrigoeg’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Assigned: Yago Elias » Unassigned
Priority: Critical » Normal
FileSize
1.64 KB
1.52 KB

- Version of the bug changed to 1.x-dev since it also affects the dev version.
- Changing the priority because it only affects a few scenarios.

Maybe this patch will break the compatibility with sites currently using this module, because the sites can have URLs working with secure pages but with upper cases in configuration.
Also, Block module from Drupal core compares the URLs using lower case (check block.module code snippet bellow):

block.module

    // Match path if necessary.
    if ($block->pages) {
      // Convert path to lowercase. This allows comparison of the same path
      // with different case. Ex: /Page, /page, /PAGE.
      $pages = drupal_strtolower($block->pages);
      if ($block->visibility < BLOCK_VISIBILITY_PHP) {
        // Convert the Drupal path to lowercase.
        $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
        // Compare the lowercase internal and lowercase path alias (if any).
        $page_match = drupal_match_path($path, $pages);
        if ($path != $_GET['q']) {
          $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
        }
        // When $block->visibility has a value of 0
        // (BLOCK_VISIBILITY_NOTLISTED), the block is displayed on all pages
        // except those listed in $block->pages. When set to 1
        // (BLOCK_VISIBILITY_LISTED), it is displayed only on those pages
        // listed in $block->pages.
        $page_match = !($block->visibility xor $page_match);
      }

The function drupal_strtolower() could be used to convert the drupal_get_path_alias() calls. With this change, the module will behave the same as the Block module from Drupal core.