X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_request_api.c;h=3dabcd759d5302d2094f534ebec04ef39836268c;hp=2a4884ad9d2660f9419544464bae63a127d1dc16;hb=48981407809f0404e0427637f8474c9ccc2eafa4;hpb=547af98947588b4a646ab2a10ff287a8ab8fb409 diff --git a/http_request_api.c b/http_request_api.c index 2a4884a..3dabcd7 100644 --- a/http_request_api.c +++ b/http_request_api.c @@ -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;