I have a problem with cookies. I use httpclient 4.1.2.
I have a cookieStore in my code, to manage the cookies.
The problem is when I set an individual Cookie header for the request, than
the client sends 2 Cookie headers. The first is what I set in the header,
and the second is what generated by the cookieStore.
Here is the code where I set the cookie header:
httpget.setHeader("Cookie", request.getHeader(name));
I added the Single_Cookie_Header parameter, and it not solved my problem:
httpclient.getParams().setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER,
true);
My request header looks like this:
EBUG: org.apache.http.headers - >> GET /owa/aut/logon.aspx HTTP/1.1
DEBUG: org.apache.http.headers - >> user-agent: Mozilla/5.0 (Windows NT 6.1;
WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
DEBUG: org.apache.http.headers - >> accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
DEBUG: org.apache.http.headers - >> accept-language:
en-US,en;q=0.8,de-DE;q=0.7,de;q=0.5,hu-HU;q=0.3,hu;q=0.2
DEBUG: org.apache.http.headers - >> accept-encoding: gzip, deflate
DEBUG: org.apache.http.headers - >> accept-charset:
ISO-8859-1,utf-8;q=0.7,*;q=0.7
DEBUG: org.apache.http.headers - >> connection: keep-alive
DEBUG: org.apache.http.headers - >> Cookie: cookieTest=1; PBack=0
DEBUG: org.apache.http.headers - >> Host: example.com
DEBUG: org.apache.http.headers - >> Cookie:
OutlookSession=69f6e376b5e54bef81a15613d8d2a257
DEBUG: org.apache.http.headers - >> Accept-Encoding: gzip,deflate
The solution can't be to add these cookies to cookieStore, because I dont
know the domain and path variables, it only knows the browser from where I
get.
So how can I make to have only 1 Cookie header with all these values?
Thx a lot,
Attila