jani                                     Sat, 25 Jul 2009 13:00:25 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=284747

Log:
- Fixed bug #49052 (context option headers freed too early when using 
--with-curlwrappers)

Bug: http://bugs.php.net/49052 (Assigned) context option headers freed too 
early when using --with-curlwrappers
      
Changed paths:
    U   php/php-src/branches/PHP_5_2/NEWS
    U   php/php-src/branches/PHP_5_2/ext/curl/streams.c
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/curl/streams.c
    U   php/php-src/trunk/ext/curl/streams.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===================================================================
--- php/php-src/branches/PHP_5_2/NEWS   2009-07-25 12:53:41 UTC (rev 284746)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-07-25 13:00:25 UTC (rev 284747)
@@ -4,6 +4,8 @@
 - Fixed regression in cURL extension that prevented flush of data to output
   defined as a file handle. (Ilia)

+- Fixed bug #49052 (context option headers freed too early when using
+  --with-curlwrappers). (Jani)
 - Fixed bug #49032 (SplFileObject::fscanf() variables passed by reference).
   (Jani)
 - Fixed bug #48980 (Crash when compiling with pdo_firebird). (Felipe)

Modified: php/php-src/branches/PHP_5_2/ext/curl/streams.c
===================================================================
--- php/php-src/branches/PHP_5_2/ext/curl/streams.c     2009-07-25 12:53:41 UTC 
(rev 284746)
+++ php/php-src/branches/PHP_5_2/ext/curl/streams.c     2009-07-25 13:00:25 UTC 
(rev 284747)
@@ -469,8 +469,7 @@
 #else
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "There was 
an error mcode=%d", m);
 #endif
-                       php_stream_close(stream);
-                       return NULL;
+                       goto exit_fail;
                }

                /* we have only one curl handle here, even though we use multi 
syntax,
@@ -488,14 +487,23 @@
                        }
                }
                if (msg_found) {
-                       php_stream_close(stream);
-                       return NULL;
+                       goto exit_fail;
                }
        }
+
+       /* context headers are not needed anymore */
        if (slist) {
+               curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, NULL);
                curl_slist_free_all(slist);
        }
        return stream;
+
+exit_fail:
+       php_stream_close(stream);
+       if (slist) {
+               curl_slist_free_all(slist);
+       }
+       return NULL;
 }

 static php_stream_wrapper_ops php_curl_wrapper_ops = {

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2009-07-25 12:53:41 UTC (rev 284746)
+++ php/php-src/branches/PHP_5_3/NEWS   2009-07-25 13:00:25 UTC (rev 284747)
@@ -7,6 +7,8 @@
   Stas)
 - Fixed signature generation/validation for zip archives in ext/phar. (Greg)

+- Fixed bug #49052 (context option headers freed too early when using
+  --with-curlwrappers). (Jani)
 - Fixed bug #49032 (SplFileObject::fscanf() variables passed by reference).
   (Jani)
 - Fixed bug #49012 (phar tar signature algorithm reports as Unknown (0) in

Modified: php/php-src/branches/PHP_5_3/ext/curl/streams.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/curl/streams.c     2009-07-25 12:53:41 UTC 
(rev 284746)
+++ php/php-src/branches/PHP_5_3/ext/curl/streams.c     2009-07-25 13:00:25 UTC 
(rev 284747)
@@ -474,8 +474,7 @@
 #else
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "There was 
an error mcode=%d", m);
 #endif
-                       php_stream_close(stream);
-                       return NULL;
+                       goto exit_fail;
                }

                /* we have only one curl handle here, even though we use multi 
syntax,
@@ -493,14 +492,23 @@
                        }
                }
                if (msg_found) {
-                       php_stream_close(stream);
-                       return NULL;
+                       goto exit_fail;
                }
        }
+
+       /* context headers are not needed anymore */
        if (slist) {
+               curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, NULL);
                curl_slist_free_all(slist);
        }
        return stream;
+
+exit_fail:
+       php_stream_close(stream);
+       if (slist) {
+               curl_slist_free_all(slist);
+       }
+       return NULL;
 }

 static php_stream_wrapper_ops php_curl_wrapper_ops = {

Modified: php/php-src/trunk/ext/curl/streams.c
===================================================================
--- php/php-src/trunk/ext/curl/streams.c        2009-07-25 12:53:41 UTC (rev 
284746)
+++ php/php-src/trunk/ext/curl/streams.c        2009-07-25 13:00:25 UTC (rev 
284747)
@@ -474,8 +474,7 @@
 #else
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "There was 
an error mcode=%d", m);
 #endif
-                       php_stream_close(stream);
-                       return NULL;
+                       goto exit_fail;
                }

                /* we have only one curl handle here, even though we use multi 
syntax,
@@ -493,14 +492,23 @@
                        }
                }
                if (msg_found) {
-                       php_stream_close(stream);
-                       return NULL;
+                       goto exit_fail;
                }
        }
+
+       /* context headers are not needed anymore */
        if (slist) {
+               curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, NULL);
                curl_slist_free_all(slist);
        }
        return stream;
+
+exit_fail:
+       php_stream_close(stream);
+       if (slist) {
+               curl_slist_free_all(slist);
+       }
+       return NULL;
 }

 static php_stream_wrapper_ops php_curl_wrapper_ops = {

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

Reply via email to