On Thu, 2007-01-18 at 10:45 +0100, Roland Weber wrote: > Hello Mirya, > > > Then HttpClient with 1.5 sends this to the server: > > Cookie: Cookie1=Value1;Cookie2=Value2 > > > > , while with 1.6 it's sent in twisted order: > > Cookie: Cookie2=Value2;Cookie1=Value1 > > > > I've run it with both JDK version many times to be sure - the order > stays the > > same for every JDK version. So the questions are: > > 1) Does the order matter from HTTP/1.1 point of view? > > If the cookie names are different, the order shouldn't matter. >
Hi Roland, Not quite. See RFC 2109, 4.3.4 (Sending Cookies to the Origin Server) ... If multiple cookies satisfy the criteria above, they are ordered in the Cookie header such that those with more specific Path attributes precede those with less specific. Ordering with respect to other attributes (e.g., Domain) is unspecified. ... Hi Kyryll, HttpClient does attempt to order cookies properly [1] but for some strange reason it relies on RuleBasedCollator to compare path attributes [2], and I can only _assume_ something changed in the RuleBasedCollator implementation in Java 6 that causes HttpClient to produce different results. > > 2) If no (so the server handler is bugy), where does this differencecome > from > > and how to make 6 work as 5? > > HttpClient does not maintain cookie order. Maybe some algorithm > in the underlying Map implementation has changed. You could > implement a new cookie policy that sorts cookies according to > your requirements. > I have completely rewritten the cookie management for HttpClient 4.0 and got rid of lots of bad code including that RuleBasedCollator bit [3]. For HttpClient 3.x, unfortunately, there is no way around implementing a custom cookie policy to fix the problem Hope this helps somewhat Oleg [1] http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/httpclient/cookie/CookieSpecBase.html#574 [2] http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/httpclient/Cookie.html#485 [3] http://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk/src/java/org/apache/http/cookie/CookiePathComparator.java > hope that helps, > Roland > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
