-
- FOREACH_HASH_KEYVAL(pos1, &msg->hdrs, key, header) {
- if (key.type == HASH_KEY_IS_STRING) {
- if (key.len == sizeof("Set-Cookie") && !strcasecmp(key.str, "Set-Cookie") && Z_TYPE_PP(header) == IS_ARRAY) {
- HashPosition pos2;
- zval **single_header;
-
- FOREACH_VAL(pos2, *header, single_header) {
- if (Z_TYPE_PP(single_header) == IS_ARRAY) {
- php_http_cookie_list_t *cookie = php_http_cookie_list_from_struct(NULL, *single_header TSRMLS_CC);
-
- if (cookie) {
- char *buf;
- size_t len;
-
- php_http_cookie_list_to_string(cookie, &buf, &len);
- php_http_buffer_appendf(str, "Set-Cookie: %s" PHP_HTTP_CRLF, buf);
- php_http_cookie_list_free(&cookie);
- efree(buf);
- }
- } else {
- zval *strval = message_header_strval(single_header TSRMLS_CC);
-
- php_http_buffer_appendf(str, "Set-Cookie: %s" PHP_HTTP_CRLF, Z_STRVAL_P(strval));
- zval_ptr_dtor(&strval);
- }
- }
- } else {
- zval *strval = message_header_strval(header TSRMLS_CC);
-
- php_http_buffer_appendf(str, "%s: %s" PHP_HTTP_CRLF, key.str, Z_STRVAL_P(strval));
- zval_ptr_dtor(&strval);
- }
- }
- }