Bug 51512 - Cookies aren't inserted into HTTP request with IPv6 Host header
Cookies aren't inserted into HTTP request with IPv6 Host header
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: HTTP
2.5.1
All All
: P1 major with 2 votes (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on: 53755
Blocks:
  Show dependency tree
 
Reported: 2011-07-14 21:58 UTC by Alex Gavrilov
Modified: 2012-08-22 23:56 UTC (History)
1 user (show)



Attachments
The fix to FunctionProperty#hashCode (637 bytes, patch)
2011-09-07 17:14 UTC, Philippe Mouawad
Details | Diff
Test Plan (20.28 KB, application/xml)
2011-12-18 14:51 UTC, Philippe Mouawad
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Gavrilov 2011-07-14 21:58:52 UTC
Using Jmeter on a system with IPv6 addressing and brings to 
the issue: 
HTTP Cookies aren't inserted in the HTTP request. 
Using the same jmx-test, but with IPv4 addressing, everything works fine. 
The HTTP Requests are pretty much the same except for the Host header: 
IPv4: 
Host: 172.31.61.41:8123 
IPv6: 
Host: [2002::12]:8123 
 
It seems like there is a bug in the way cookies are stored/retrieved for 
IPv6 hosts. 

Note: I tried changing the Cookie Policy to all the possible values 
(rfc2965, etc.). It didn't help. 

Note2: tried CookieManager.check.cookies=false in jmeter.properties didn't help.

Looks like there is no workaround for this bug.

== Details: ===

IPv4: 
-------- 
GET /xxx.xxx HTTP/1.1 
Connection: keep-alive 
User-Agent: Java/1.6.0_14 
Host: 172.31.61.44:8123 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 


-------- 
HTTP/1.1 200 OK 
Date: Fri, 08 Jul 2011 23:17:18 GMT 
Content-Length: 659 
Content-Type: text/html; charset=utf-8 
Set-Cookie: TS48550d=7c55fc5f609f3263a19d5bf56ba87e4adc1f801ce2a34e724e1744d9; Path=/ 
Set-Cookie: TS48550d_1=bf7c6f914d6181372dfe392362bf8dc4dc1f801ce2a34e7200c6c833d9e562f258; Path=/ 

<html><head><style> 
    TABLE, TD { border: 3px solid black; border-collapse: collapse } 
</style></head> 
<body><table> 
    <TR><TD>path        </TD><TD>     /xxx.xxx</TD></TR> 
    <TR><TD>query       </TD><TD>     </TD></TR> 
    <TR><TD>method      </TD><TD>     GET</TD></TR> 
    <TR><TD>cookie      </TD><TD>     </TD></TR> 
    <TR><TD>content_type</TD><TD>     </TD></TR> 
    <TR><TD>content     </TD><TD>     </TD></TR> 
    <TR><TD>as_string   </TD><TD><PRE>GET /xxx.xxx HTTP/1.1 
Connection: keep-alive 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 
Host: 172.31.61.44:8123 
User-Agent: Java/1.6.0_14 

</PRE></TD></TR> 
</table></body></html> 

-------- 
GET /fff.zip HTTP/1.1 
Connection: keep-alive 
Cookie: TS48550d=7c55fc5f609f3263a19d5bf56ba87e4adc1f801ce2a34e724e1744d9; TS48550d_1=bf7c6f914d6181372dfe392362bf8dc4dc1f801ce2a34e7200c6c833d9e562f258 
User-Agent: Java/1.6.0_14 
Host: 172.31.61.44:8123 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 



IPv6: 
-------- 
GET /xxx.xxx HTTP/1.1 
Connection: keep-alive 
User-Agent: Java/1.6.0_14 
Host: [2002::12]:8123 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 


-------- 
HTTP/1.1 200 OK 
Date: Fri, 08 Jul 2011 20:37:53 GMT 
Content-Length: 657 
Content-Type: text/html; charset=utf-8 
Set-Cookie: TS48550d=d1f940e9b0d067b9e4d9b7870a3b76fed46c8da98c8b21124e171f7e; Path=/ 
Set-Cookie: TS48550d_1=f2ca831a9781d3a13d30c433d2d18d43d46c8da98c8b211200c6c833d9e562f258; Path=/ 

<html><head><style> 
    TABLE, TD { border: 3px solid black; border-collapse: collapse } 
</style></head> 
<body><table> 
    <TR><TD>path        </TD><TD>     /xxx.xxx</TD></TR> 
    <TR><TD>query       </TD><TD>     </TD></TR> 
    <TR><TD>method      </TD><TD>     GET</TD></TR> 
    <TR><TD>cookie      </TD><TD>     </TD></TR> 
    <TR><TD>content_type</TD><TD>     </TD></TR> 
    <TR><TD>content     </TD><TD>     </TD></TR> 
    <TR><TD>as_string   </TD><TD><PRE>GET /xxx.xxx HTTP/1.1 
Connection: keep-alive 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 
Host: [2002::12]:8123 
User-Agent: Java/1.6.0_14 

</PRE></TD></TR> 
</table></body></html> 

-------- 
GET /fff.zip HTTP/1.1 
Connection: keep-alive 
User-Agent: Java/1.6.0_14 
Host: [2002::12]:8123 
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 

--------
Comment 1 Philippe Mouawad 2011-09-07 17:14:10 UTC
Created attachment 27467 [details]
The fix to FunctionProperty#hashCode

The patch as described in previous comment
Philippe Mouawad
Comment 2 Philippe Mouawad 2011-09-07 17:19:41 UTC
Sorry, attached patch is not for this issue,
Comment 3 William A. Rowe Jr. 2011-09-09 04:05:02 UTC
Cookies are stored by the client, not by the server.  Report this to your client software project/vendor.  The server is sending proper set-cookie headers and the client is ignoring them.
Comment 4 Milamber 2011-09-09 08:11:47 UTC
The JMeter Cookie Manager uses HTTPClient API to validate/parse Cookie header. 

This bug is provide by Httpclient 3.1 which not support host with IPv6 address.
https://issues.apache.org/jira/browse/HTTPCLIENT-654

A workaround is use a host header with a name (not ip).

The fix is to use HTTPClient 4.x for cookie manager (I works on this).
Comment 5 Alex Gavrilov 2011-09-22 23:39:05 UTC
Thanks Milamber!
I currently use hostnames, 
but it would be great to be able to run the traffic with IPv6 in the Host header.
Looking forward for your fix.
Comment 6 Philippe Mouawad 2011-12-18 14:51:51 UTC
Created attachment 28084 [details]
Test Plan
Comment 7 Philippe Mouawad 2011-12-18 15:54:34 UTC
Date: Sun Dec 18 15:52:56 2011
New Revision: 1220440

URL: http://svn.apache.org/viewvc?rev=1220440&view=rev
Log:
Make method exposing HTTPClient object not public (prepare enhancement of CookieManager supporting IPv6 (using HTTPClient4))
Comment 8 Philippe Mouawad 2011-12-18 21:56:53 UTC
Date: Sun Dec 18 21:55:32 2011
New Revision: 1220552

URL: http://svn.apache.org/viewvc?rev=1220552&view=rev
Log:
Bug 51512 - Cookies aren't inserted into HTTP request with IPv6 Host header
First part, introduce interface CookieHandler and make CookieManager use it.

Second step will introduce HC4CookieHandler that will enable parsing of IPv6 IPs.

Added:
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieHandler.java   (with props)
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC3CookieHandler.java   (with props)
Modified:
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
   jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
   jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
Comment 9 Philippe Mouawad 2012-06-06 19:53:25 UTC
I think we should fix this one soon according to this:
- http://www.google.com/intl/en/ipv6/

World IPv6 Launch on June 6, 2012
Comment 10 Milamber 2012-08-21 15:55:41 UTC
See Bug 53755
Comment 11 Milamber 2012-08-22 23:56:52 UTC
URL: http://svn.apache.org/viewvc?rev=1376320&view=rev
Log:
Adding a HttpClient 4 cookie implementation in JMeter. Cookie Manager has now the default HC3.1 implementation and a new choice HC4 implementation (compliant with IPv6 address)
and
Bug 51512 - Cookies aren't inserted into HTTP request with IPv6 Host header
Bugzilla Id: 53755

Added:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/HC4CookieHandler.java   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
    jmeter/trunk/src/jorphan/org/apache/jorphan/reflect/ClassTools.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/CookiePanel.java
    jmeter/trunk/xdocs/changes.xml