From: David Hedbor Date: Mon, 6 Nov 2000 22:11:10 +0000 (+0000) Subject: (php_caudium_set_header): Allow for multiple headers with the same name. X-Git-Tag: php-4.0.4RC3~297 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61f208884686795f9a1fe217d79f19cc038fc469;p=php (php_caudium_set_header): Allow for multiple headers with the same name. --- diff --git a/sapi/caudium/caudium.c b/sapi/caudium/caudium.c index e08a4c84e7..3724338d93 100644 --- a/sapi/caudium/caudium.c +++ b/sapi/caudium/caudium.c @@ -290,6 +290,7 @@ php_caudium_set_header(char *header_name, char *value, char *p) struct pike_string *hval, *ind, *hind; struct mapping *headermap; struct svalue *s_headermap, *soldval; + int vallen; GET_THIS(); // hval = make_shared_string(value); ind = make_shared_string(" _headers"); @@ -308,16 +309,20 @@ php_caudium_set_header(char *header_name, char *value, char *p) hval = make_shared_string(value); } else { headermap = s_headermap->u.mapping; -#if 0 - soldval = low_mapping_string_lookup(s_headermap, hind); + soldval = low_mapping_string_lookup(headermap, hind); + vallen = strlen(value); if(soldval != NULL && - soldval->u.type == PIKE_T_STRING && + soldval->type == PIKE_T_STRING && soldval->u.string->size_shift == 0) { /* Existing, valid header. Prepend.*/ + hval = begin_shared_string(soldval->u.string->len + 1 + vallen); + MEMCPY(hval->str, soldval->u.string->str, soldval->u.string->len); + STR0(hval)[soldval->u.string->len] = '\0'; + MEMCPY(hval->str+soldval->u.string->len+1, value, vallen); + hval = end_shared_string(hval); + } else { hval = make_shared_string(value); } -#endif - hval = make_shared_string(value); } hsval.type = PIKE_T_STRING; hsval.u.string = hval;