- multiple send seems to work now without bigger problems
[m6w6/ext-http] / http_request_api.c
index 2a4884ad9d2660f9419544464bae63a127d1dc16..3dabcd759d5302d2094f534ebec04ef39836268c 100644 (file)
@@ -153,7 +153,7 @@ void *_http_request_data_copy(int type, void *data TSRMLS_DC)
        {
                case COPY_STRING:
                {
-                       char *new_str = estrdup((const char*) data);
+                       char *new_str = estrdup(data);
                        zend_llist_add_element(&HTTP_G(request).copies.strings, &new_str);
                        return new_str;
                }
@@ -181,6 +181,7 @@ void *_http_request_data_copy(int type, void *data TSRMLS_DC)
 /* {{{ void http_request_data_free_string(char **) */
 void _http_request_data_free_string(void *string)
 {
+       //fprintf(stderr, "FREE STRING %p (%s)\n", *((char **)string), *((char **)string));
        efree(*((char **)string));
 }
 /* }}} */
@@ -318,7 +319,7 @@ PHP_HTTP_API void _http_request_body_free(http_request_body *body TSRMLS_DC)
 /* }}} */
 
 /* {{{ STATUS http_request_init(CURL *, http_request_method, char *, http_request_body *, HashTable *, phpstr *) */
-PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, const char *url, http_request_body *body, HashTable *options, phpstr *response TSRMLS_DC)
+PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, char *url, http_request_body *body, HashTable *options, phpstr *response TSRMLS_DC)
 {
        zval *zoption;
        zend_bool range_req = 0;
@@ -330,7 +331,7 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, const
 
        /* set options */
        if (url) {
-               HTTP_CURL_OPT(URL, http_request_data_copy(COPY_STRING, (void *) url));
+               HTTP_CURL_OPT(URL, http_request_data_copy(COPY_STRING, url));
        }
 
        if (response) {
@@ -412,7 +413,7 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, const
        /* compress, empty string enables deflate and gzip */
        if (zoption = http_curl_getopt(options, "compress", IS_BOOL)) {
                if (Z_LVAL_P(zoption)) {
-                       HTTP_CURL_OPT(ENCODING, http_request_data_copy(COPY_STRING, ""));
+                       HTTP_CURL_OPT(ENCODING, "");
                }
        }
 
@@ -436,7 +437,7 @@ PHP_HTTP_API STATUS _http_request_init(CURL *ch, http_request_method meth, const
        if (zoption = http_curl_getopt(options, "useragent", IS_STRING)) {
                HTTP_CURL_OPT(USERAGENT, http_request_data_copy(COPY_STRING, Z_STRVAL_P(zoption)));
        } else {
-               HTTP_CURL_OPT(USERAGENT, http_request_data_copy(COPY_STRING, "PECL::HTTP/" HTTP_PEXT_VERSION " (PHP/" PHP_VERSION ")"));
+               HTTP_CURL_OPT(USERAGENT, "PECL::HTTP/" HTTP_PEXT_VERSION " (PHP/" PHP_VERSION ")");
        }
 
        /* additional headers, array('name' => 'value') */
@@ -701,7 +702,7 @@ PHP_HTTP_API void _http_request_info(CURL *ch, HashTable *info TSRMLS_DC)
 /* }}} */
 
 /* {{{ STATUS http_request_ex(CURL *, http_request_method, char *, http_request_body, HashTable, HashTable, phpstr *) */
-PHP_HTTP_API STATUS _http_request_ex(CURL *ch, http_request_method meth, const char *url, http_request_body *body, HashTable *options, HashTable *info, phpstr *response TSRMLS_DC)
+PHP_HTTP_API STATUS _http_request_ex(CURL *ch, http_request_method meth, char *url, http_request_body *body, HashTable *options, HashTable *info, phpstr *response TSRMLS_DC)
 {
        STATUS status;
        zend_bool clean_curl;