web/http_headers.py
branchstable
changeset 7855 54283a5b7afc
parent 5155 1dea6e0fdfc1
child 8081 e8091b415ad8
--- a/web/http_headers.py	Fri Sep 23 12:17:12 2011 +0200
+++ b/web/http_headers.py	Fri Sep 23 12:16:29 2011 +0200
@@ -1354,9 +1354,25 @@
         raw_header.append(value)
         self._headers[name] = _RecalcNeeded
 
+    def addHeader(self, name, value):
+        """
+        Add a parsed representatoin to a header that may or may not already exist.
+        If it exists, add it as a separate header to output; do not
+        replace anything.
+        """
+        name=name.lower()
+        header = self._headers.get(name)
+        if header is None:
+            # No header yet
+            header = []
+            self._headers[name] = header
+        elif header is _RecalcNeeded:
+            header = self._toParsed(name)
+        header.append(value)
+        self._raw_headers[name] = _RecalcNeeded
+
     def removeHeader(self, name):
         """Removes the header named."""
-
         name=name.lower()
         if self._raw_headers.has_key(name):
             del self._raw_headers[name]