tony2001                Tue Aug  1 13:28:03 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/curl   streams.c 
  Log:
  MFH: fix #38269 (fopen wrapper doesn't fail on invalid hostname with 
curlwrappers enabled)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.172&r2=1.2027.2.547.2.173&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.172 php-src/NEWS:1.2027.2.547.2.173
--- php-src/NEWS:1.2027.2.547.2.172     Tue Aug  1 12:04:20 2006
+++ php-src/NEWS        Tue Aug  1 13:28:03 2006
@@ -28,6 +28,8 @@
   being applied when RAW filter is used. (Ilia)
 - Fixed bug #38278 (session_cache_expire()'s value does not match phpinfo's 
   session.cache_expire). (Tony)
+- Fixed bug #38269 (fopen wrapper doesn't fail on invalid hostname with 
+  curlwrappers enabled). (Tony)
 - Fixed bug #38261 (openssl_x509_parse() leaks with invalid cert) (Pierre)
 - Fixed bug #38255 (openssl possible leaks while passing keys) (Pierre)
 - Fixed bug #38253 (PDO produces segfault with default fetch mode). (Tony)
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/streams.c?r1=1.14.2.2.2.2&r2=1.14.2.2.2.3&diff_format=u
Index: php-src/ext/curl/streams.c
diff -u php-src/ext/curl/streams.c:1.14.2.2.2.2 
php-src/ext/curl/streams.c:1.14.2.2.2.3
--- php-src/ext/curl/streams.c:1.14.2.2.2.2     Tue Jun  6 21:38:03 2006
+++ php-src/ext/curl/streams.c  Tue Aug  1 13:28:03 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: streams.c,v 1.14.2.2.2.2 2006/06/06 21:38:03 mike Exp $ */
+/* $Id: streams.c,v 1.14.2.2.2.3 2006/08/01 13:28:03 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;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to