asu-ke-web-services / search-api

Search API for documents, data, research, people, etc
MIT License
2 stars 1 forks source link

http-get: __destruct() not in execute()? #57

Closed ESmith92 closed 8 years ago

ESmith92 commented 8 years ago

just wondering why the __destruct() function was left out of the execute. Is there a case where we would need that curl object still after we get the response?

ESmith92 commented 8 years ago

also should we add a timeout for the curl (var seconds = 120; curl_setopt($ch, CURLOPT_TIMEOUT, seconds );)

kenprice commented 8 years ago

No need. PHP's garbage collection will call the destructor for you. Unless, of course, our implementation causes PHP to hold on to the reference to an instance of HttpGet.

As for the timeout, that's something that could be a new issue. I haven't considered it, but I should have! By default, CURLOPT_TIMEOUT is set to 0 (indefinite). It'll be worth setting a default timeout.

ESmith92 commented 8 years ago

one more thing: we should add a get function for curl info (return curl_getinfo( $curl );) so we can throw exceptions

kenprice commented 8 years ago

Created new issue for timeout and error handling.