- FOREACH_HASH_KEYVAL(pos1, &msg->message->hdrs, key, header) {
- if (key.type == HASH_KEY_IS_STRING && !strcasecmp(key.str, "Set-Cookie")) {
- php_http_cookie_list_t *list;
-
- if (Z_TYPE_PP(header) == IS_ARRAY) {
- zval **single_header;
-
- FOREACH_VAL(pos2, *header, single_header) {
- zval *data = php_http_ztyp(IS_STRING, *single_header);
-
- if ((list = php_http_cookie_list_parse(NULL, Z_STRVAL_P(data), Z_STRLEN_P(data), flags, allowed_extras TSRMLS_CC))) {
- zval *cookie;
-
- MAKE_STD_ZVAL(cookie);
- ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0);
- add_next_index_zval(return_value, cookie);
- }
- zval_ptr_dtor(&data);
- }
- } else {
- zval *data = php_http_ztyp(IS_STRING, *header);
- if ((list = php_http_cookie_list_parse(NULL, Z_STRVAL_P(data), Z_STRLEN_P(data), flags, allowed_extras TSRMLS_CC))) {
- zval *cookie;
-
- MAKE_STD_ZVAL(cookie);
- ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0);
- add_next_index_zval(return_value, cookie);
- }
- zval_ptr_dtor(&data);
+ if ((header = php_http_message_header(msg->message, ZEND_STRL("Set-Cookie"), 0))) {
+ php_http_cookie_list_t *list;
+
+ if (Z_TYPE_P(header) == IS_ARRAY) {
+ zval **single_header;
+
+ FOREACH_VAL(pos, header, single_header) {
+ zval *data = php_http_ztyp(IS_STRING, *single_header);
+
+ if ((list = php_http_cookie_list_parse(NULL, Z_STRVAL_P(data), Z_STRLEN_P(data), flags, allowed_extras TSRMLS_CC))) {
+ zval *cookie;
+
+ MAKE_STD_ZVAL(cookie);
+ ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0);
+ add_next_index_zval(return_value, cookie);