When curlstreams are enabled, registers a each supported protocol
with PHP.
"More Correctly" implement eof for curlstreams.
Still not ready for anything like primetime.
}
#ifdef PHP_CURL_URL_WRAPPERS
+# if HAVE_CURL_VERSION_INFO
+ {
+ curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
+ char **p = (char **)info->protocols;
+
+ while (*p != NULL) {
+ php_register_url_stream_wrapper(*p++, &php_curl_wrapper TSRMLS_CC);
+ }
+ }
+# else
php_register_url_stream_wrapper("http", &php_curl_wrapper TSRMLS_CC);
php_register_url_stream_wrapper("https", &php_curl_wrapper TSRMLS_CC);
php_register_url_stream_wrapper("ftp", &php_curl_wrapper TSRMLS_CC);
php_register_url_stream_wrapper("ldap", &php_curl_wrapper TSRMLS_CC);
+# endif
#endif
return SUCCESS;
{
php_curl_stream *curlstream = (php_curl_stream*)stream->abstract;
size_t didread = 0;
-
- if (buf == NULL && count == 0) {
- /* check for EOF */
-
- /* if we have buffered data, then we are not at EOF */
- if (curlstream->readbuffer.writepos > 0
- && curlstream->readbuffer.readpos < curlstream->readbuffer.writepos)
- return 0;
-
-
- return curlstream->pending ? 0 : EOF;
- }
if (curlstream->readbuffer.readpos >= curlstream->readbuffer.writepos && curlstream->pending) {
/* we need to read some more data */
curlstream->readbuffer.readpos = php_stream_tell(curlstream->readbuffer.buf);
}
+
+ if (didread == 0) {
+ stream->eof = 1;
+ }
+
return didread;
}