Fixed class.lescript_v2.php to work with ACMEv2

As GET /document never returns any Reply-Nonce Header, getLastNonce() caused an infinite loop.
The Content-Type for v2 must be application/jose+json.
This commit is contained in:
markuspetermann
2018-09-15 12:41:27 +02:00
committed by GitHub
parent b777053133
commit 94c4d52476

View File

@@ -495,8 +495,8 @@ class Client
private function curl($method, $url, $data = null) private function curl($method, $url, $data = null)
{ {
$headers = array( $headers = array(
'Accept: application/json', 'Accept: application/jose+json',
'Content-Type: application/json' 'Content-Type: application/jose+json'
); );
$handle = curl_init(); $handle = curl_init();
curl_setopt($handle, CURLOPT_URL, preg_match('~^http~', $url) ? $url : $this->base . $url); curl_setopt($handle, CURLOPT_URL, preg_match('~^http~', $url) ? $url : $this->base . $url);
@@ -550,7 +550,7 @@ class Client
return trim($matches[1]); return trim($matches[1]);
} }
$this->curl('GET', '/directory'); $this->curl('GET', '/acme/new-nonce');
return $this->getLastNonce(); return $this->getLastNonce();
} }