From 37e51f33491f223b17b78080e78412eea754405e Mon Sep 17 00:00:00 2001
From: "Mirar (Pontus Hagland)" <pike@sort.mirar.org>
Date: Sun, 15 Feb 1998 02:22:57 +0100
Subject: [PATCH] use_multiple result _fixed_ to arrays

Rev: src/modules/MIME/module.pmod.in:1.11
---
 src/modules/MIME/module.pmod.in | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/modules/MIME/module.pmod.in b/src/modules/MIME/module.pmod.in
index d55fe4790b..806be71d06 100644
--- a/src/modules/MIME/module.pmod.in
+++ b/src/modules/MIME/module.pmod.in
@@ -1,5 +1,5 @@
 /*
- * $Id: module.pmod.in,v 1.10 1998/02/11 15:29:56 mirar Exp $
+ * $Id: module.pmod.in,v 1.11 1998/02/15 01:22:57 mirar Exp $
  *
  * RFC1521 functionality for Pike
  *
@@ -113,7 +113,7 @@ class support {
   }
 
   array(mapping(string:string|array)|string) 
-       parse_headers(string message, void|int allow_multiple)
+       parse_headers(string message, void|int use_multiple)
   {
     mapping(string:string|array) headers = ([ ]);
     string head, body, header, hname, hcontents;
@@ -135,14 +135,9 @@ class support {
     {
       if(4==sscanf(header, "%[!-9;-~]%*[ \t]:%*[ \t]%s", hname, hcontents))
       {
-	if (allow_multiple)
-	  if (headers[hname=lower_case(hname)])
-	    if (arrayp(headers[hname])) 
-	      headers[hname] += ({hcontents});
-	    else
-	      headers[hname] = ({ headers[hname], hcontents });
-	  else
-	    headers[hname]=hcontents;
+	if (use_multiple)
+	  headers[hname=lower_case(hname)]
+	    = (headers[hname]||({}))+({hcontents});
 	else
 	  headers[lower_case(hname)] = hcontents;
       }
@@ -314,7 +309,7 @@ class Message {
   void create(void | string message,
 	      void | mapping(string:string) hdrs,
 	      void | array(object) parts,
-	      void | int allow_multiple_headers)
+	      void | int use_multiple_headers)
   {
     encoded_data = 0;
     decoded_data = 0;
@@ -336,7 +331,7 @@ class Message {
       body_parts = parts;
     } else if (message) {
       array(mapping(string:string)|string) h = 
-	parse_headers(message,allow_multiple_headers);
+	parse_headers(message,use_multiple_headers);
       headers = h[0];
       encoded_data = h[1];
     }
-- 
GitLab