Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions lib/OpenDbSnoopy.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,27 @@ class OpenDbSnoopy extends Snoopy {
function OpenDbSnoopy($debug = FALSE) {
// if file cache table is not installed, we cannot use file cache.
$this->_file_cache_enabled = get_opendb_config_var ( 'http.cache', 'enable' );

// override user agent.
$this->agent = 'Mozilla/5.0 (X11; CentOS) Gecko/20100101 Firefox/50.0';

if (isset($_SERVER['HTTP_USER_AGENT'])) {
$this->agent = $_SERVER['HTTP_USER_AGENT'];
} else {
$this->agent = 'Mozilla/5.0 (X11; CentOS) Gecko/20100101 Firefox/75.0';
}

// in how many cases is this going to work?
$this->passcookies = FALSE;

$this->_debug = $debug;

$proxy_server_config_r = get_opendb_config_var ( 'http.proxy_server' );
if ($proxy_server_config_r ['enable'] == TRUE) {
$this->proxy_host = $proxy_server_config_r ['host'];
$this->proxy_port = $proxy_server_config_r ['port'];
$this->proxy_user = $proxy_server_config_r ['userid'];
$this->proxy_pass = $proxy_server_config_r ['password'];
}

// the default curl path for snoopy is /usr/local/bin/curl - often however, it will reside in another path
if(!empty($this->curl_path) || !@is_executable($this->curl_path)) {
$curlpaths = array(); // variable for test-paths
Expand Down
5 changes: 4 additions & 1 deletion lib/Snoopy.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ function _httprequest($url, $URI, $http_method, $content_type = "", $body = "")
if (empty ( $url ))
$url = "/";
// GET ... header not needed for curl
//$headers[] = $http_method." ".$url." ".$this->_httpversion;
//$headers[] = $http_method." ".$url." ".$this->_httpversion;
if (! empty ( $this->agent ))
curl_setopt($curl, CURLOPT_USERAGENT, $this->agent);

Expand Down Expand Up @@ -621,6 +621,8 @@ function _httprequest($url, $URI, $http_method, $content_type = "", $body = "")
if (! empty ( $this->user ) || ! empty ( $this->pass ))
$headers [] = "Authorization: BASIC " . base64_encode ( $this->user . ":" . $this->pass );

$header[] = "Pragma: ";

curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);

if (! empty ( $body )) {
Expand All @@ -636,6 +638,7 @@ function _httprequest($url, $URI, $http_method, $content_type = "", $body = "")
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_HEADER, 0); // don't include headers in output
curl_setopt($curl, CURLOPT_ENCODING, "gzip,deflate");

$results = curl_exec($curl);
$status = curl_getinfo($curl);
Expand Down
Loading