Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Form redirect code -- here's the modification

tgknight
2006-01-31
2013-05-30
  • tgknight
    tgknight
    2006-01-31

    Hello, I have noticed that when a website uses a header redirect back to the same URL after you submit a form, that Snoopy goes into a loop trying to submit the form vars over and over, until you reach the maxredirs variable.

    Here is my modification to fix this problem, starts around line 326 in the submit method.

    Any comments or improvements?

    I hope that this can be added to the standard library.

    Thanks,
    Owen

    ------------------------------------------------

    /* follow the redirect */                $this->_redirectdepth++;
    if( strpos( $this->_redirectaddr, "?" ) > 0 || $this->_redirectaddr == $this->lastredirectaddr) {

    $this->lastredirectaddr=$this->_redirectaddr;
    $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get
                                } else {

    $this->lastredirectaddr=$this->_redirectaddr;
    $this->submit($this->_redirectaddr,$formvars, $formfiles);

    }