You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by to...@apache.org on 2007/02/26 20:38:08 UTC

svn commit: r511966 - /webservices/axis/trunk/java/src/org/apache/axis/transport/http/HTTPSender.java

Author: tomj
Date: Mon Feb 26 11:38:07 2007
New Revision: 511966

URL: http://svn.apache.org/viewvc?view=rev&rev=511966
Log:
Fix https://issues.apache.org/jira/browse/AXIS-2064, a long standing cookie bug.

The format of multi-cookie in HTTP request headers
sends multiple cookies on multiple lines.  While many
servers accept this, some do NOT.  The HTTP spec says
their should only be a single header.

Changed cookie code in HTTPSender.java to append multiple
cookies separated by ';'.

Modified:
    webservices/axis/trunk/java/src/org/apache/axis/transport/http/HTTPSender.java

Modified: webservices/axis/trunk/java/src/org/apache/axis/transport/http/HTTPSender.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/java/src/org/apache/axis/transport/http/HTTPSender.java?view=diff&rev=511966&r1=511965&r2=511966
==============================================================================
--- webservices/axis/trunk/java/src/org/apache/axis/transport/http/HTTPSender.java (original)
+++ webservices/axis/trunk/java/src/org/apache/axis/transport/http/HTTPSender.java Mon Feb 26 11:38:07 2007
@@ -531,13 +531,23 @@
     private void fillHeaders(MessageContext msgContext, String header, StringBuffer otherHeaders) {
         Object ck1 = msgContext.getProperty(header);
         if (ck1 != null) {
+            // Do we have multiple values to set?
             if (ck1 instanceof String[]) {
                 String [] cookies = (String[]) ck1;
+                otherHeaders.append(header).append(": ");
                 for (int i = 0; i < cookies.length; i++) {
-                    addCookie(otherHeaders, header, cookies[i]);
+                    // See bug AXIS-2064: https://issues.apache.org/jira/browse/AXIS-2064
+                    // Append the cookie
+                    otherHeaders.append(cookies[i]);
+                    // Append a ';' if not the last cookie
+                    if (i < cookies.length -1)
+                        otherHeaders.append(";");
                 }
+                otherHeaders.append("\r\n");
             } else {
-                addCookie(otherHeaders, header, (String) ck1);
+                // Simple string value
+                otherHeaders.append(header).append(": ")
+                        .append((String) ck1).append("\r\n");
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org