X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=http_curl_api.c;h=e2d59110b8cc9123af0613c1cbd6e9f10f60f1a0;hb=837e726a8dba0aa64aeeebe538a8b8c415e86a1c;hp=7938573eb6bfa962f50cf1bd10f59498a5bcbe30;hpb=fe866e74d586515ae1a4fc8dd33ccd35c40b4fb0;p=m6w6%2Fext-http diff --git a/http_curl_api.c b/http_curl_api.c index 7938573..e2d5911 100644 --- a/http_curl_api.c +++ b/http_curl_api.c @@ -106,7 +106,7 @@ static inline char *_http_curl_copystr(const char *str TSRMLS_DC) /* {{{ static size_t http_curl_callback(char *, size_t, size_t, void *) */ static size_t http_curl_callback(char *buf, size_t len, size_t n, void *s) { - return phpstr_append(PHPSTR(s), buf, len *= n); + return s ? phpstr_append(PHPSTR(s), buf, len * n) : len * n; } /* }}} */ @@ -211,7 +211,7 @@ static void _http_curl_setopts(CURL *ch, const char *url, HashTable *options, ph /* 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_CURL_OPT(ENCODING, http_curl_copystr("")); } } @@ -332,7 +332,7 @@ static void _http_curl_setopts(CURL *ch, const char *url, HashTable *options, ph #define HTTP_CURL_OPT_STRING_EX(keyname, optname) \ if (!strcasecmp(key, #keyname)) { \ convert_to_string_ex(param); \ - HTTP_CURL_OPT(optname, Z_STRVAL_PP(param)); \ + HTTP_CURL_OPT(optname, http_curl_copystr(Z_STRVAL_PP(param))); \ key = NULL; \ continue; \ }