-
- /* delete header if value == null */
- if (!value || Z_TYPE_P(value) == IS_NULL) {
- RETURN_SUCCESS(http_send_header_ex(name, name_len, "", 0, replace, NULL));
- }
- /* send multiple header if replace is false and value is an array */
- if (!replace && Z_TYPE_P(value) == IS_ARRAY) {
- zval **data;
- HashPosition pos;
-
- FOREACH_VAL(pos, value, data) {
- zval *orig = *data;
-
- convert_to_string_ex(data);
- if (SUCCESS != http_send_header_ex(name, name_len, Z_STRVAL_PP(data), Z_STRLEN_PP(data), 0, NULL)) {
- if (orig != *data) {
- zval_ptr_dtor(data);
- }
- RETURN_FALSE;
- }
- if (orig != *data) {
- zval_ptr_dtor(data);
- }
- }
- RETURN_TRUE;
- }
- /* send standard header */
- orig = value;
- convert_to_string_ex(&value);
- RETVAL_SUCCESS(http_send_header_ex(name, name_len, Z_STRVAL_P(value), Z_STRLEN_P(value), replace, NULL));
- if (orig != value) {
- zval_ptr_dtor(&value);
- }
+ http_send_header_zval_ex(name, name_len, &value, replace);
+ RETURN_TRUE;