mIRC Homepage
When requesting an $urlget() with the 'bh' (binvar; HEAD) options, there is no target binvar created within the callback alias, as there is with 'bg' (binvar; GET).
This seems invalid, because $urlget(%id).target will declare a &binvar name, but that binvar does not exist. It causes $bvar(&binvar,1-).text to throw an erroneous error.

I'm of the opinion that the &target binvar should be populated by the header reply when requesting the HEAD method.
Thanks for your bug report. This is intentional. The HEAD result is only ever returned in $urlget().reply.
Cool beans. So how is the script supposed to know that the &target binvar exists or does not exist, to prevent it from tripping errors?

Authors can either anticipate the existence of the &target binvar, per ($urlget(%id).target == &target), or lose faith in the universe, not both.
Quote
Cool beans. So how is the script supposed to know that the &target binvar exists or does not exist, to prevent it from tripping errors?

The only method is to use $bvar() to check if it exists. The .target property only tells you what was requested by $urlget(), it does not guarantee that the target file or binvar exists. In my scripts, I use $isfile() and $bvar() to check these.
Ok, so Inline Example:
Code
echo -a $iif($bvar($urlget($1).target),$bvar($v1,1-).text)

Structured Example:
Code
var %id = $1, %binvar = $urlget(%id).target, %target
if ($bvar(%binvar)) {
  var %target = $bvar(%binvar,1-).text
}
echo -a %target
© mIRC Discussion Forums