Update webpagetool.php

This commit is contained in:
Namhyeon Go 2019-04-10 20:01:50 +09:00 committed by GitHub
parent 613761a505
commit 7d9c3c0841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,7 +58,18 @@ if(!check_function_exists("get_web_cmd")) {
$args[] = "-k"; // allow self-signed certificate (the same as --insecure)
foreach($headers as $k=>$v) {
// the same as --header
$args[] = sprintf("-H '%s: %s'", make_safe_argument($k), make_safe_argument($v));
if(is_array($v)) {
if($k == "Authentication") {
if($v[0] == "Basic") {
$args[] = sprintf("-u '%s:%s'", $v[1], $v[2]);
} else {
$args[] = sprintf("-H '%s: %s'", $k, implode(" ", $v));
}
}
} else {
$args[] = sprintf("-H '%s: %s'", make_safe_argument($k), make_safe_argument($v));
}
}
$args[] = get_web_build_qs($url, $data);
}