Update of /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/http
In directory vz-cvs-3.sog:/tmp/cvs-serv30139/src/org/sblim/cimclient/internal/http
Modified Files:
Tag: Experimental
HttpHeader.java
Log Message:
3553858 - Append duplicate HTTP header fields instead of replace
Index: HttpHeader.java
===================================================================
RCS file: /cvsroot/sblim/jsr48-client/src/org/sblim/cimclient/internal/http/HttpHeader.java,v
retrieving revision 1.3.2.10
retrieving revision 1.3.2.11
diff -u -d -r1.3.2.10 -r1.3.2.11
--- HttpHeader.java 20 May 2011 14:39:45 -0000 1.3.2.10
+++ HttpHeader.java 3 Aug 2012 02:03:10 -0000 1.3.2.11
@@ -1,5 +1,5 @@
/**
- * (C) Copyright IBM Corp. 2005, 2011
+ * (C) Copyright IBM Corp. 2005, 2012
*
* THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
@@ -28,6 +28,7 @@
* 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2)
* 2641758 2009-02-27 blaschke-oss CIM Client does not recognize HTTP extension headers
* 3304058 2011-05-20 blaschke-oss Use same date format in change history
+ * 3553858 2012-08-02 blaschke-oss Append duplicate HTTP header fields instead of replace
*/
package org.sblim.cimclient.internal.http;
@@ -154,7 +155,17 @@
if (pName == null || pName.length() == 0) return;
if (pValue != null) {
- this.iFields.put(new HeaderEntry(pName), pValue);
+ String oldValue = this.iFields.put(new HeaderEntry(pName), pValue);
+ if (oldValue != null) {
+ // Field already exists, so append value to existing value; it
+ // is done checking put() return code, instead of checking get()
+ // return code prior to put(), because typical user case does
+ // not include duplicate fields
+ StringBuilder combinedValue = new StringBuilder(oldValue);
+ combinedValue.append(',');
+ combinedValue.append(pValue);
+ this.iFields.put(new HeaderEntry(pName), combinedValue.toString());
+ }
} else {
this.iFields.remove(new HeaderEntry(pName));
}
|