- export http_parse_cookie()
[m6w6/ext-http] / http_request_api.c
index 15740732bd33d3cfe48069dbbb91b3e68b4a6ee8..3408812f179373b9fcb929e28bb9080cbdf2851d 100644 (file)
@@ -304,7 +304,7 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(READFUNCTION, http_curl_read_callback);
                HTTP_CURL_OPT(IOCTLFUNCTION, http_curl_ioctl_callback);
                HTTP_CURL_OPT(WRITEFUNCTION, http_curl_dummy_callback);
-               HTTP_CURL_OPT(PROGRESSFUNCTION, http_curl_progress_callback);
+               HTTP_CURL_OPT(PROGRESSFUNCTION, NULL);
                HTTP_CURL_OPT(URL, NULL);
                HTTP_CURL_OPT(NOPROGRESS, 1);
                HTTP_CURL_OPT(PROXY, NULL);
@@ -351,6 +351,9 @@ PHP_HTTP_API void _http_request_defaults(http_request *request)
                HTTP_CURL_OPT(IOCTLDATA, NULL);
                HTTP_CURL_OPT(READDATA, NULL);
                HTTP_CURL_OPT(INFILESIZE, 0);
+#if 0
+               HTTP_CURL_OPT(IGNORE_CONTENT_ENCODING, 1);
+#endif
        }
 }
 /* }}} */
@@ -388,6 +391,7 @@ PHP_HTTP_API STATUS _http_request_prepare(http_request *request, HashTable *opti
        if ((zoption = http_request_option(request, options, "onprogress", 0))) {
                HTTP_CURL_OPT(NOPROGRESS, 0);
                HTTP_CURL_OPT(PROGRESSDATA, request);
+               HTTP_CURL_OPT(PROGRESSFUNCTION, http_curl_progress_callback);
                http_request_set_progress_callback(request, zoption);
        }
 
@@ -831,9 +835,17 @@ static int http_curl_raw_callback(CURL *ch, curl_infotype type, char *data, size
 static inline zval *_http_request_option_ex(http_request *r, HashTable *options, char *key, size_t keylen, int type TSRMLS_DC)
 {
        zval **zoption;
+#ifdef ZEND_ENGINE_2
        ulong h = zend_get_hash_value(key, keylen);
-
-       if (!options || (SUCCESS != zend_hash_quick_find(options, key, keylen, h, (void **) &zoption))) {
+#endif
+       
+       if (!options || 
+#ifdef ZEND_ENGINE_2
+                       (SUCCESS != zend_hash_quick_find(options, key, keylen, h, (void **) &zoption))
+#else
+                       (SUCCESS != zend_hash_find(options, key, keylen, (void **) &zoption))
+#endif
+       ) {
                return NULL;
        }
 
@@ -852,9 +864,14 @@ static inline zval *_http_request_option_ex(http_request *r, HashTable *options,
        }
        
        ZVAL_ADDREF(*zoption);
+#ifdef ZEND_ENGINE_2
        _zend_hash_quick_add_or_update(&r->_cache.options, key, keylen, h, zoption, sizeof(zval *), NULL, 
                zend_hash_quick_exists(&r->_cache.options, key, keylen, h)?HASH_UPDATE:HASH_ADD ZEND_FILE_LINE_CC);
-
+#else
+       zend_hash_add_or_update(&r->_cache.options, key, keylen, zoption, sizeof(zval *), NULL,
+               zend_hash_exists(&r->_cache.options, key, keylen)?HASH_UPDATE:HASH_ADD);
+#endif
+       
        return *zoption;
 }
 /* }}} */