- if (header->length==-1) header->length=0;
- capacity=header->length;
- header->character=string_cat(header->character,&capacity,&header->length,hname.character,hname.length);
- header->character=string_cat(header->character,&capacity,&header->length,CUS ": ",2);
- header->character=string_cat(header->character,&capacity,&header->length,hvalue.character,hvalue.length);
- header->character=string_cat(header->character,&capacity,&header->length,CUS "\n",1);
- header->character[header->length]='\0';
+ gstring * g;
+
+ if (header->length==-1) header->length = 0;
+
+ g = string_catn(NULL, header->character, header->length);
+ g = string_catn(g, hname.character, hname.length);
+ g = string_catn(g, CUS ": ", 2);
+ g = string_catn(g, hvalue.character, hvalue.length);
+ g = string_catn(g, CUS "\n", 1);
+
+ header->character = string_from_gstring(g);
+ header->length = g->ptr;