1. Add option to disable redirects. Following a redirect loses the original response (with set-cookie headers required for authentication). You dismissed the idea of following infinite redirects here but maybe we can use -d0 for no redirects instead.

2. Add support for Protocol-relative redirects (//uri).

Quote
url      https://forums.mirc.com/ubbthreads.php
redirect https://forums.mirc.com:443//forums.mirc.com/ubbthreads.php/forum_summary
method   post
type     binvar
target   &response
alias    urlget.callback
id       1025
state    fail
size     0
resume   0
rcvd     0
time     2610
reply    HTTP/1.1 404 Not Found
Date: Mon, 19 Oct 2020 12:37:47 GMT
Server: Apache
Vary: User-Agent
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8


Code
alias Forum.Login {
  var %forumuser = xxx
  var %forumpass = xxx
  
  bset -t &body 1 ubb=start_page&Loginname= $+ %forumuser $+ &Loginpass= $+ %forumpass $+ &rememberme=1&firstlogin=1&ocu=%2F%2Fforums.mirc.com%2Fubbthreads.php%2Fforum_summary&buttlogin=Log+In
  bset -t &headers 1 Content-Type: application/x-www-form-urlencoded
  
  var %url = https://forums.mirc.com/ubbthreads.php
  
  noop $urlget(%url, pb, &response, urlget.callback, &headers, &body)
}

alias urlget.callback {
  var %id = $1

  echo -ag -
  echo -agi9 url      $urlget(%id).url
  echo -agi9 redirect $urlget(%id).redirect
  echo -agi9 method   $urlget(%id).method
  echo -agi9 type     $urlget(%id).type
  echo -agi9 target   $urlget(%id).target
  echo -agi9 alias    $urlget(%id).alias
  echo -agi9 id       $urlget(%id).id
  echo -agi9 state    $urlget(%id).state
  echo -agi9 size     $urlget(%id).size
  echo -agi9 resume   $urlget(%id).resume
  echo -agi9 rcvd     $urlget(%id).rcvd
  echo -agi9 time     $urlget(%id).time
  echo -agi9 reply    $urlget(%id).reply

  if ($urlget(%id).type == binvar) && ($bvar($urlget(%id).target,0)) {
    echo -agi9 response $bvar($urlget(%id).target,1-3000).text
  }
}

Last edited by Khaled; 20/10/20 08:24 AM.