From 9ae3c2f7bd7dd13adabbdab8c62cbfda06f8af07 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 14 Nov 2002 11:41:24 +0000 Subject: [PATCH] Commit these before Sterling renames the files again :-) When curlstreams are enabled, registers a each supported protocol with PHP. "More Correctly" implement eof for curlstreams. Still not ready for anything like primetime. --- ext/curl/interface.c | 11 +++++++++++ ext/curl/streams.c | 17 +++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 38992c7e3b..eeb5fb2f1d 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -320,10 +320,21 @@ PHP_MINIT_FUNCTION(curl) } #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; diff --git a/ext/curl/streams.c b/ext/curl/streams.c index eaee95409d..d7f613f7cf 100644 --- a/ext/curl/streams.c +++ b/ext/curl/streams.c @@ -140,18 +140,6 @@ static size_t php_curl_stream_read(php_stream *stream, char *buf, size_t count T { 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 */ @@ -198,6 +186,11 @@ static size_t php_curl_stream_read(php_stream *stream, char *buf, size_t count T curlstream->readbuffer.readpos = php_stream_tell(curlstream->readbuffer.buf); } + + if (didread == 0) { + stream->eof = 1; + } + return didread; } -- 2.50.1