wez Thu Nov 14 06:41:24 2002 EDT
Modified files:
/php4/ext/curl interface.c streams.c
Log:
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.
Index: php4/ext/curl/interface.c
diff -u php4/ext/curl/interface.c:1.1 php4/ext/curl/interface.c:1.2
--- php4/ext/curl/interface.c:1.1 Wed Nov 13 17:25:33 2002
+++ php4/ext/curl/interface.c Thu Nov 14 06:41:24 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.1 2002/11/13 22:25:33 sterling Exp $ */
+/* $Id: interface.c,v 1.2 2002/11/14 11:41:24 wez Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -320,10 +320,21 @@
}
#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;
Index: php4/ext/curl/streams.c
diff -u php4/ext/curl/streams.c:1.1 php4/ext/curl/streams.c:1.2
--- php4/ext/curl/streams.c:1.1 Wed Nov 13 17:25:33 2002
+++ php4/ext/curl/streams.c Thu Nov 14 06:41:24 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.1 2002/11/13 22:25:33 sterling Exp $ */
+/* $Id: streams.c,v 1.2 2002/11/14 11:41:24 wez Exp $ */
/* This file implements cURL based wrappers.
* NOTE: If you are implementing your own streams that are intended to
@@ -140,18 +140,6 @@
{
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 @@
curlstream->readbuffer.readpos =
php_stream_tell(curlstream->readbuffer.buf);
}
+
+ if (didread == 0) {
+ stream->eof = 1;
+ }
+
return didread;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php