hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r418729 - in /jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl: BrowserCompatSpec.java NetscapeDraftSpec.java RFC2109Spec.java
Date Mon, 03 Jul 2006 09:56:20 GMT
Author: olegk
Date: Mon Jul  3 02:56:19 2006
New Revision: 418729

URL: http://svn.apache.org/viewvc?rev=418729&view=rev
Log:
[HTTPCORE-6] When transmitting HTTP messages, re-use Header buffers whenever possible. 

Modified:
    jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
    jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
    jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java

Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java?rev=418729&r1=418728&r2=418729&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/BrowserCompatSpec.java
Mon Jul  3 02:56:19 2006
@@ -35,8 +35,8 @@
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.io.CharArrayBuffer;
-import org.apache.http.message.BasicHeader;
 import org.apache.http.message.BasicHeaderElement;
+import org.apache.http.message.BufferedHeader;
 import org.apache.http.util.DateParseException;
 import org.apache.http.util.DateUtils;
 
@@ -133,6 +133,7 @@
             throw new IllegalArgumentException("Cookie array may not be empty");
         }
         CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.length);
+        buffer.append("Cookie: ");
         for (int i = 0; i < cookies.length; i++) {
             Cookie cookie = cookies[i];
             if (i > 0) {
@@ -145,7 +146,7 @@
                 buffer.append(s);
             }
         }
-        return new Header[] { new BasicHeader("Cookie", buffer.toString()) };
+        return new Header[] { new BufferedHeader(buffer) };
     }
     
 }

Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java?rev=418729&r1=418728&r2=418729&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/NetscapeDraftSpec.java
Mon Jul  3 02:56:19 2006
@@ -35,8 +35,8 @@
 import org.apache.http.cookie.CookieOrigin;
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.io.CharArrayBuffer;
-import org.apache.http.message.BasicHeader;
 import org.apache.http.message.BasicHeaderElement;
+import org.apache.http.message.BufferedHeader;
 
 /**
  * Netscape cookie draft compliant cookie policy
@@ -115,6 +115,7 @@
             throw new IllegalArgumentException("Cookie array may not be empty");
         }
         CharArrayBuffer buffer = new CharArrayBuffer(20 * cookies.length);
+        buffer.append("Cookie: ");
         for (int i = 0; i < cookies.length; i++) {
             Cookie cookie = cookies[i];
             if (i > 0) {
@@ -127,7 +128,7 @@
                 buffer.append(s);
             }
         }
-        return new Header[] { new BasicHeader("Cookie", buffer.toString()) };
+        return new Header[] { new BufferedHeader(buffer) };
     }
 
 }

Modified: jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java?rev=418729&r1=418728&r2=418729&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/impl/RFC2109Spec.java
Mon Jul  3 02:56:19 2006
@@ -38,7 +38,7 @@
 import org.apache.http.cookie.CookiePathComparator;
 import org.apache.http.cookie.MalformedCookieException;
 import org.apache.http.io.CharArrayBuffer;
-import org.apache.http.message.BasicHeader;
+import org.apache.http.message.BufferedHeader;
 import org.apache.http.util.DateUtils;
 
 /**
@@ -146,13 +146,14 @@
             }
         }
         CharArrayBuffer buffer = new CharArrayBuffer(40 * cookies.length);
+        buffer.append("Cookie: ");
         formatParamAsVer(buffer, "$Version", Integer.toString(version), version);
         for (int i = 0; i < cookies.length; i++) {
             buffer.append("; ");
             Cookie cookie = cookies[i];
             formatCookieAsVer(buffer, cookie, version);
         }
-        return new Header[] {new BasicHeader("Cookie", buffer.toString())};
+        return new Header[] { new BufferedHeader(buffer) };
     }
 
     private Header[] doFormatManyHeaders(final Cookie[] cookies) {
@@ -161,10 +162,11 @@
             Cookie cookie = cookies[i];
             int version = cookie.getVersion();
             CharArrayBuffer buffer = new CharArrayBuffer(40);
+            buffer.append("Cookie: ");
             formatParamAsVer(buffer, "$Version", Integer.toString(version), version);
             buffer.append("; ");
             formatCookieAsVer(buffer, cookies[i], version);
-            headers[i] = new BasicHeader("Cookie", buffer.toString());
+            headers[i] = new BufferedHeader(buffer);
         }
         return headers;
     }



Mime
View raw message