Bugs item #3190055, was opened at 2011-02-23 12:34
Message generated for change (Tracker Item Submitted) made by achimwestermann
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=3190055&group_id=61302

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Achim Westermann (achimwestermann)
Assigned to: Nobody/Anonymous (nobody)
Summary: Handling same named Headers with HtmlUnit

Initial Comment:
Intro: Great work thanks! 

Scenario: 
Server sends two same named cookies (e.g. servlet container adds JSESSIONID and 
Servlet filter has to correct that cookie, but cannot kill the first cookie 
from the response). The 2nd header cookie sets a special attribute, e.g. 
"HttpOnly" which the first one does not have. 

Problem:
assertCookieValueMatch("JSESSIONID", "(.)*HttpOnly"); 
will take the first cookie with that name and fail. This is because 
HtmlUnitTestingEngineImpl in public String getHeader(String name) trusts on 
com.gargoylesoftware.htmlunit.Webresponse#getResponseHeaderValue(String name) 
which will return the first header. 

Also the workaround "getAllHeaders()" is a bit unclean. In 
HtmlUnitTestingEngineImpl#getAllHeaders() all values are put into a map by 
header name. The latter same named header fields will overwrite the earlier 
ones. 

Expected behaviour: 
For HtmlUnitTestingEngineImple#getHeader(String name) the last same named 
header should be returned. Take e.g. this specification (regarding Cookie 
setting) :  
http://tools.ietf.org/html/draft-ietf-httpstate-cookie-21#section-4.1.2 -> The 
last cookie wins. 
For HtmlUnitTestingEngineImpl#getAllHeaders() some data structure (multi - 
map?) should be returned that preserves all headers in that order. 

Thanks a lot for your great work! 

Achim

P.S.: If you'd like a patch, just contact me. 


- HtmlUnitTestingEngineImpl

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=3190055&group_id=61302

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
JWebUnit-development mailing list
JWebUnit-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to