$client = new $clientClass($path, $host);
$server = "$host$path";
}
- if ($protocol == 2) {
+ if ($protocol == 2 || $protocol == 3) {
$server = 'https://' . $server;
} else {
$server = 'http://' . $server;
$client->setProxy($pproxy[0], $pport, $proxyuser, $proxypwd);
}
- if ($protocol == 2) {
+ if ($protocol == 2 || $protocol == 3) {
$client->setSSLVerifyPeer($verifypeer);
$client->setSSLVerifyHost($verifyhost);
if ($cainfo) {
$client->setCaCertificate($cainfo);
}
- $httpprotocol = 'https';
+ if ($protocol == 3) {
+ $httpprotocol = 'h2';
+ } else {
+ $httpprotocol = 'https';
+ }
+ } elseif ($protocol == 4) {
+ $httpprotocol = 'h2c';
} elseif ($protocol == 1) {
$httpprotocol = 'http11';
} else {
$encoder = new PhpXmlRpc\Encoder();
$msig = $encoder->decode($r2);
$msig = $msig[$methodsig];
- $proto = $protocol == 2 ? 'https' : ( $protocol == 1 ? 'http11' : '' );
+ $proto = ($protocol == 1) ? 'http11' : ( $protocol == 2 ? 'https' : ( $protocol == 3 ? 'h2' : ( $protocol == 4 ? 'h2c' : '' ) ) );
if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression &&
$clientcookies == ''
) {
}
}
$host = isset($_GET['host']) ? $_GET['host'] : 'localhost'; // using '' will trigger an xmlrpc error...
- if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2')) {
+ if (isset($_GET['protocol']) && ($_GET['protocol'] == '1' || $_GET['protocol'] == '2' || $_GET['protocol'] == '3')
+ || $_GET['protocol'] == '4') {
$protocol = $_GET['protocol'];
}
if (strpos($host, 'http://') === 0) {
+ // NB: if protocol is https or h2, it will override http://
$host = substr($host, 7);
} elseif (strpos($host, 'https://') === 0) {
$host = substr($host, 8);
- $protocol = 2;
+ // NB: otoh if protocol is http1.0 or http1.1, it will be overridden by https://
+ if ($protocol == 0 || $protocol = 1) {
+ $protocol = 2;
+ }
}
$port = isset($_GET['port']) ? $_GET['port'] : '';
$path = isset($_GET['path']) ? $_GET['path'] : '';
}
function switchssl() {
- if (document.frmaction.protocol.value != '2') {
+ if (document.frmaction.protocol.value != '2' && document.frmaction.protocol.value != '3') {
document.frmaction.verifypeer.disabled = true;
document.frmaction.verifyhost.disabled = true;
document.frmaction.cainfo.disabled = true;
<option value="0"<?php if ($protocol == 0) { echo ' selected="selected"'; } ?>>HTTP 1.0</option>
<option value="1"<?php if ($protocol == 1) { echo ' selected="selected"'; } ?>>HTTP 1.1</option>
<option value="2"<?php if ($protocol == 2) { echo ' selected="selected"'; } ?>>HTTPS</option>
+ <option value="3"<?php if ($protocol == 3) { echo ' selected="selected"'; } ?>>HTTP2</option>
+ <option value="4"<?php if ($protocol == 3) { echo ' selected="selected"'; } ?>>HTTP2 no TLS</option>
</select></td>
</tr>
<tr>