X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_curl_api.c;h=e2d59110b8cc9123af0613c1cbd6e9f10f60f1a0;hp=7938573eb6bfa962f50cf1bd10f59498a5bcbe30;hb=c2b4f0332ead5425b183d2487ab5f25663f1009f;hpb=456dd6f5e057a0fc4ff3dbaf006d71cf5c247f19 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; \ }