X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=http_send_api.c;h=3f6f2a6ef524c75e9b5071b9ba8e52cd55338eba;hp=6dfc677f993b5be0eef58657c291506311b986c8;hb=afd561b680a07837192efbdb9ffe248def36f8e9;hpb=a60610ff0f84cdf46d8b39c9e64eefd701c1b565 diff --git a/http_send_api.c b/http_send_api.c index 6dfc677..3f6f2a6 100644 --- a/http_send_api.c +++ b/http_send_api.c @@ -289,6 +289,7 @@ PHP_HTTP_API STATUS _http_send_ranges(HashTable *ranges, const void *data, size_ /* multi range */ else { + size_t preface_len; char bound[23] = {0}, preface[1024] = {0}, multi_header[68] = "Content-Type: multipart/byteranges; boundary="; @@ -307,7 +308,7 @@ PHP_HTTP_API STATUS _http_send_ranges(HashTable *ranges, const void *data, size_ break; } - snprintf(preface, 1023, + preface_len = snprintf(preface, 1023, HTTP_CRLF "%s" HTTP_CRLF "Content-Type: %s" HTTP_CRLF "Content-Range: bytes %ld-%ld/%lu" @@ -321,7 +322,7 @@ PHP_HTTP_API STATUS _http_send_ranges(HashTable *ranges, const void *data, size_ (ulong) size ); - PHPWRITE(preface, strlen(preface)); + PHPWRITE(preface, preface_len); http_send_chunk(data, Z_LVAL_PP(zbegin), Z_LVAL_PP(zend) + 1, mode); }