X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=php_http_message.c;h=da0ac7d2331e8bc91aa919f1ce001edd8c04d555;hb=925f7408106f612482cb1f4f58fafd78f3a4266d;hp=5f9220edd2ab90da51d4687e0a6c0e9050fe5497;hpb=d3485e3b28336153dca690e872ffe1ddc60fedd2;p=m6w6%2Fext-http diff --git a/php_http_message.c b/php_http_message.c index 5f9220e..da0ac7d 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -14,7 +14,9 @@ #include "php_http.h" -/* API */ +#include
+#include +#include PHP_HTTP_API zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info TSRMLS_DC) { @@ -127,7 +129,7 @@ PHP_HTTP_API php_http_message_t *php_http_message_init_env(php_http_message_t *m PHP_HTTP_API php_http_message_t *php_http_message_parse(php_http_message_t *msg, const char *str, size_t len TSRMLS_DC) { php_http_message_parser_t p; - php_http_buffer buf; + php_http_buffer_t buf; if (!msg) { msg = php_http_message_init(NULL, 0 TSRMLS_CC); @@ -151,12 +153,14 @@ PHP_HTTP_API zval *php_http_message_header(php_http_message_t *msg, char *key_st if (join && Z_TYPE_PP(header) == IS_ARRAY) { zval *header_str, **val; HashPosition pos; - php_http_buffer str; + php_http_buffer_t str; php_http_buffer_init(&str); MAKE_STD_ZVAL(header_str); FOREACH_VAL(pos, *header, val) { - php_http_buffer_appendf(&str, PHP_HTTP_BUFFER_LEN(&str) ? ", %s":"%s", Z_STRVAL_PP(val)); + zval *strval = php_http_zsep(IS_STRING, *val); + php_http_buffer_appendf(&str, PHP_HTTP_BUFFER_LEN(&str) ? ", %s":"%s", Z_STRVAL_P(strval)); + zval_ptr_dtor(&strval); } php_http_buffer_fix(&str); ZVAL_STRINGL(header_str, PHP_HTTP_BUFFER_VAL(&str), PHP_HTTP_BUFFER_LEN(&str), 0); @@ -217,7 +221,7 @@ PHP_HTTP_API void php_http_message_set_info(php_http_message_t *message, php_htt } } -static inline void message_headers(php_http_message_t *msg, php_http_buffer *str) +static inline void message_headers(php_http_message_t *msg, php_http_buffer_t *str) { php_http_array_hashkey_t key = php_http_array_hashkey_init(0); HashPosition pos1; @@ -287,7 +291,7 @@ static inline void message_headers(php_http_message_t *msg, php_http_buffer *str PHP_HTTP_API void php_http_message_to_callback(php_http_message_t *msg, php_http_pass_callback_t cb, void *cb_arg) { - php_http_buffer str; + php_http_buffer_t str; TSRMLS_FETCH_FROM_CTX(msg->ts); php_http_buffer_init_ex(&str, 0x1000, 0); @@ -304,7 +308,7 @@ PHP_HTTP_API void php_http_message_to_callback(php_http_message_t *msg, php_http PHP_HTTP_API void php_http_message_to_string(php_http_message_t *msg, char **string, size_t *length) { - php_http_buffer str; + php_http_buffer_t str; char *data; php_http_buffer_init_ex(&str, 0x1000, 0); @@ -327,7 +331,7 @@ PHP_HTTP_API void php_http_message_serialize(php_http_message_t *message, char * { char *buf; size_t len; - php_http_buffer str; + php_http_buffer_t str; php_http_buffer_init(&str); @@ -601,9 +605,6 @@ PHP_HTTP_API void php_http_message_free(php_http_message_t **message) } } - -/* PHP */ - #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpMessage, method, 0, req_args) #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpMessage, method, 0) #define PHP_HTTP_MESSAGE_ME(method, visibility) PHP_ME(HttpMessage, method, PHP_HTTP_ARGS(HttpMessage, method), visibility)