X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=http_api.c;h=f9091ee4791694d68aefcea20b564770907b75de;hb=d9a5eb7f270247c44f4ff78c1f5d03d520e8fec0;hp=d8a0828df32ca2bd4f57645bffdbb0e9e2b99648;hpb=583b464b344a2d8944be2bdf56c85057098eef77;p=m6w6%2Fext-http diff --git a/http_api.c b/http_api.c index d8a0828..f9091ee 100644 --- a/http_api.c +++ b/http_api.c @@ -18,7 +18,7 @@ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS #ifdef HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #include @@ -37,9 +37,9 @@ #include "SAPI.h" #ifdef ZEND_ENGINE_2 -#include "ext/standard/php_http.h" +# include "ext/standard/php_http.h" #else -#include "http_build_query.c" + #include "http_build_query.c" #endif #include "php_http.h" @@ -47,13 +47,14 @@ #ifdef HTTP_HAVE_CURL -#ifdef PHP_WIN32 -#include -#include -#endif +# ifdef PHP_WIN32 +# include +# include +# endif + +# include +# include -#include -#include #endif @@ -1428,7 +1429,7 @@ PHP_HTTP_API STATUS _http_send_ranges(zval *zranges, const void *data, const siz /* single range */ if ((c = zend_hash_num_elements(Z_ARRVAL_P(zranges))) == 1) { char range_header[256] = {0}; - + zend_hash_index_find(Z_ARRVAL_P(zranges), 0, (void **) &zrange); zend_hash_index_find(Z_ARRVAL_PP(zrange), 0, (void **) &begin); zend_hash_index_find(Z_ARRVAL_PP(zrange), 1, (void **) &end); @@ -1444,9 +1445,9 @@ PHP_HTTP_API STATUS _http_send_ranges(zval *zranges, const void *data, const siz /* multi range */ else { int i; - char bound[23] = {0}, preface[1024] = {0}, + char bound[23] = {0}, preface[1024] = {0}, multi_header[68] = "Content-Type: multipart/byteranges; boundary="; - + snprintf(bound, 22, "--%d%0.9f", time(NULL), php_combined_lcg(TSRMLS_C)); strncat(multi_header, bound + 2, 21); http_send_header(multi_header); @@ -1462,22 +1463,22 @@ PHP_HTTP_API STATUS _http_send_ranges(zval *zranges, const void *data, const siz SUCCESS != zend_hash_index_find( Z_ARRVAL_PP(zrange), 1, (void **) &end)) { break; - } + } snprintf(preface, 1023, - HTTP_CRLF "%s" + HTTP_CRLF "%s" HTTP_CRLF "Content-Type: %s" HTTP_CRLF "Content-Range: bytes %ld-%ld/%ld" - HTTP_CRLF + HTTP_CRLF HTTP_CRLF, - - bound, - HTTP_G(ctype) ? HTTP_G(ctype) : "application/x-octetstream", - **begin, - **end, + + bound, + HTTP_G(ctype) ? HTTP_G(ctype) : "application/x-octetstream", + **begin, + **end, size ); - + php_body_write(preface, strlen(preface) TSRMLS_CC); http_send_chunk(data, **begin, **end + 1, mode); }