* attempt to fix pecl Bug #16826 http_date strange behavior and crash
[m6w6/ext-http] / http_request_api.c
index 2a5f68e7ab1c5e564ba4d0200b38972aa4167ccd..292c1eeb1bacaf4ac83a86a34decfe5c0e2d7030 100644 (file)
@@ -531,8 +531,9 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(CURLOPT_HTTPHEADER, NULL);
                HTTP_CURL_OPT(CURLOPT_COOKIE, NULL);
                HTTP_CURL_OPT(CURLOPT_COOKIESESSION, 0L);
+               /* these options would enable curl's cookie engine by default which we don't want
                HTTP_CURL_OPT(CURLOPT_COOKIEFILE, NULL);
-               HTTP_CURL_OPT(CURLOPT_COOKIEJAR, NULL);
+               HTTP_CURL_OPT(CURLOPT_COOKIEJAR, NULL); */
 #if HTTP_CURL_VERSION(7,14,1)
                HTTP_CURL_OPT(CURLOPT_COOKIELIST, NULL);
 #endif
@@ -1084,6 +1085,11 @@ PHP_HTTP_API void _http_request_exec(http_request *request)
 retry:
        if (CURLE_OK != (result = curl_easy_perform(request->ch))) {
                http_error_ex(HE_WARNING, HTTP_E_REQUEST, "%s; %s (%s)", curl_easy_strerror(result), http_request_storage_get(request->ch)->errorbuffer, request->url);
+#ifdef ZEND_ENGINE_2
+               if ((HTTP_G->only_exceptions || GLOBAL_ERROR_HANDLING == EH_THROW) && EG(exception)) {
+                       add_property_long(EG(exception), "curlCode", result);
+               }
+#endif
                
                if (request->_retry.count > tries++) {
                        switch (result) {