Menu

https redirect fails

Help
2006-08-27
2013-05-30
  • Patrick Johnson

    Patrick Johnson - 2006-08-27

    Hello,

    I am trying to connect to a site with a call to submit().  The site is sending me back a redirect, with the scheme changed from http to https.  The call to expandlinks (around line 323) is causing a problem.

    I submit the first url to submit():
    http://www.website.com/path

    I get a redirect:
    http://www.website.com:80/patha/file.xyz

    That works, and I get another redirect:
    https://www.website.com/patha/file.xyz

    Then I execute this line of code in submit():
    $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr,$URI_PARTS["scheme"]."://".$URI_PARTS["host"]);   

    and now my redirect is:
    http://www.website.com/https://www.website.com/patha/file.xyz

    I'm not sure what that line of code is trying to do, so I'm not sure about the fix.

    Can anyone help me ?

    Thanks,
    Patrick

     
    • Patrick Johnson

      Patrick Johnson - 2006-08-27

      I changed the code in question as follows, and it seems to work (VERY minimal testing):
                              if($this->maxredirs > $this->_redirectdepth)
                              {                       
                                  if(!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr)) {
      // ** PJ ** EDNC
      //
      // echo("<br />RedirectAddr = $this->_redirectaddr <br />\n ");
                                      if(!preg_match("|^[^:]+://|", $this->_redirectaddr))
                                          $this->_redirectaddr = $this->_expandlinks(    $this->_redirectaddr,
                                                                                      $URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
                                  }
                                 
                                  // only follow redirect if it's on this site, or offsiteok is true

       

Log in to post a comment.