summaryrefslogtreecommitdiff
path: root/sapi/caudium
diff options
context:
space:
mode:
authorDavid Hedbor <neotron@php.net>2000-11-06 22:11:10 +0000
committerDavid Hedbor <neotron@php.net>2000-11-06 22:11:10 +0000
commit61f208884686795f9a1fe217d79f19cc038fc469 (patch)
treeca32be6c532c2d0446a1141336a202164fdb7150 /sapi/caudium
parent44ecf585196e976f7e72e1319657801698b1ba32 (diff)
downloadphp-git-61f208884686795f9a1fe217d79f19cc038fc469.tar.gz
(php_caudium_set_header): Allow for multiple headers with the same name.
Diffstat (limited to 'sapi/caudium')
-rw-r--r--sapi/caudium/caudium.c15
1 files changed, 10 insertions, 5 deletions
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;