ulobby / NeoEloquent

An extension of Laravel Elqouent that supports Neo4j, a native graph database
MIT License
41 stars 17 forks source link

support connecting to neo4j server with http proxy #39

Open xumng opened 3 years ago

xumng commented 3 years ago

Description:

When i connect my neo4j community 3.5.28 in laravel service, it throw an exception as follow: Vinelab\NeoEloquent\QueryException Can't open connection to http://localhost:7474/db/data/

I found that Curl.php's function makeRequest haven't set the proxy options.

Steps To Reproduce:

  1. modify Curl.php's function makeRequest and set proxy options.

$options = array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_HTTPHEADER => array( 'Accept: application/json;stream=true', 'Content-type: application/json', 'User-Agent: '.Version::userAgent(), 'X-Stream: true' ), CURLOPT_CUSTOMREQUEST => self::GET, CURLOPT_POST => false, CURLOPT_POSTFIELDS => null, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4, CURLOPT_PROXYTYPE => CURLPROXY_HTTP, //when neo4j server config http proxy, please set this. reference https://www.php.net/curl_setopt CURLOPT_PROXY => "", //"http://proxy.example.com:80" );

Expected result

connected to neo4j server ok.

Actual result

Vinelab\NeoEloquent\QueryException Can't open connection to http://localhost:7474/db/data/