]> granicus.if.org Git - php/commitdiff
- Fixed bug #49052 (context option headers freed too early when using --with-curlwrap...
authorJani Taskinen <jani@php.net>
Sat, 25 Jul 2009 13:00:25 +0000 (13:00 +0000)
committerJani Taskinen <jani@php.net>
Sat, 25 Jul 2009 13:00:25 +0000 (13:00 +0000)
NEWS
ext/curl/streams.c

diff --git a/NEWS b/NEWS
index 84e96651c4c7011dd94dacb5cd7095eb52e890c9..f6d2d8227f2a6269a0c909028d8b0c155b4f5b42 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PHP                                                                        NEWS
   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
index 8509e4a14761b61ba2dbfa18f1dd737cc0eb7582..63d43c762326857aeca1a04644a694aea540b503 100644 (file)
@@ -474,8 +474,7 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
 #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 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename,
                        }
                }
                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 = {