cvs: php-src /ext/curl streams.c
| From: | Antony Dovgal | Date: | Tue, 01 Aug 2006 13:26:56 +0000 |
| Subject: | cvs: php-src /ext/curl streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-39695@lists.php.net to get a copy of this message | ||
tony2001 Tue Aug 1 13:26:56 2006 UTC
Modified files:
/php-src/ext/curl streams.c
Log:
fix #38269 (fopen wrapper doesn't fail on invalid hostname with curlwrappers enabled)
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/streams.c?r1=1.18&r2=1.19&diff_format=u
Index: php-src/ext/curl/streams.c
diff -u php-src/ext/curl/streams.c:1.18 php-src/ext/curl/streams.c:1.19
--- php-src/ext/curl/streams.c:1.18 Tue Jun 6 21:38:28 2006
+++ php-src/ext/curl/streams.c Tue Aug 1 13:26:56 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.18 2006/06/06 21:38:28 mike Exp $ */
+/* $Id: streams.c,v 1.19 2006/08/01 13:26:56 tony2001 Exp $ */
/* This file implements cURL based wrappers.
* NOTE: If you are implementing your own streams that are intended to
@@ -396,15 +396,33 @@
/* fire up the connection; we need to detect a connection error here,
* otherwise the curlstream we return ends up doing nothing useful. */
CURLMcode m;
+ CURLMsg *msg;
+ int msgs_left, msg_found = 0;
while (CURLM_CALL_MULTI_PERFORM == (m = curl_multi_perform(curlstream->multi,
&curlstream->pending))) {
; /* spin */
}
if (m != CURLM_OK) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "There was an error mcode=%d", m);
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", curl_multi_strerror(m));
+ php_stream_close(stream);
+ return NULL;
+ }
+
+ /* we have only one curl handle here, even though we use multi syntax,
+ * so it's ok to fail on any error */
+ while ((msg = curl_multi_info_read(curlstream->multi, &msgs_left))) {
+ if (msg->data.result == CURLE_OK) {
+ continue;
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
curl_easy_strerror(msg->data.result));
+ msg_found++;
+ }
+ }
+ if (msg_found) {
+ php_stream_close(stream);
+ return NULL;
}
-
}
return stream;