enonic/cms-ce — pull request #1 by knutz3n (2013-04-05 13:11:19+00:00)
Title: Support multiple Set-Cookie headers in bin/rpc requests

Http proxies might add Set-Cookie headers on responses which causes the Enonic API client to ignore the JSESSIONID in login responses. An example response which causes the problems, is given below.

Set-Cookie: JSESSIONID=83F7B05CD29A6A11A97839A47BD5C211; Path=/
Content-Type: application/x-java-serialized-object;charset=UTF-8
Date: Fri, 05 Apr 2013 11:34:30 GMT
Set-Cookie: clusternode=Alpha;path=/;
Connection: close

This patch loops through all HTTP Set-Cookie headers and checks for the JSESSIONID.