Skip to content

Commit

Permalink
Merge pull request #4 from nijel/patch-1
Browse files Browse the repository at this point in the history
Add Accept: */* header
  • Loading branch information
j0k3r authored Jun 28, 2018
2 parents c5f2af9 + c37beef commit 569ec1b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/SafeCurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ public function execute($url)
//Validate the URL
$url = Url::validateUrl($url, $this->getOptions());

$headers = array('Accept: */*');
if ($this->getOptions()->getPinDns()) {
//Send a Host header
curl_setopt($this->curlHandle, CURLOPT_HTTPHEADER, array('Host: '.$url['host']));
$headers[] = 'Host: '.$url['host'];
//The "fake" URL
curl_setopt($this->curlHandle, CURLOPT_URL, $url['url']);
//We also have to disable SSL cert verfication, which is not great
Expand All @@ -129,6 +130,7 @@ public function execute($url)
} else {
curl_setopt($this->curlHandle, CURLOPT_URL, $url['url']);
}
curl_setopt($this->curlHandle, CURLOPT_HTTPHEADER, $headers);

// in case of `CURLINFO_REDIRECT_URL` isn't defined
curl_setopt($this->curlHandle, CURLOPT_HEADER, true);
Expand Down

0 comments on commit 569ec1b

Please sign in to comment.