Ah... I see. How did I miss that...

Thnx for the pointer.

- Gaurav

On Sunday, 10 August 2014 04:03:10 UTC-7, mbanzon wrote:
>
> It have been ages since I've messed with HTTP on Android - but as far as I 
> recall the DefaultHttpClient has a CookieStore - as far as I remember 
> cookies can be set through that.
>
>
> On Sun, Aug 10, 2014 at 7:19 AM, Gaurav Vaish <[email protected] 
> <javascript:>> wrote:
>
>> There is no other way to add cookie, isn't it?
>>
>> Or do you mean it is my responsibility to format / combine all cookies?
>>
>> What's the purpose of CookieSpecPNames.SINGLE_COOKIE_HEADER parameter 
>> then?
>> How do I use that?
>>
>> - Gaurav
>>
>>
>> On Saturday, 9 August 2014 12:38:00 UTC-7, mbanzon wrote:
>>
>>> You don't set a cookie - you set a header. Twice.
>>>
>>> It's the expected result...
>>>
>>>
>>> On Sat, Aug 9, 2014 at 9:08 PM, Gaurav Vaish <[email protected]> 
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I noticed that DefaultHttpClient as well as AndroidHttpClient do not 
>>>> work nicely if multiple "Cookie" or "Cookie2" headers are set in a request.
>>>>
>>>> I tried with a simple test code:
>>>>  
>>>>         String url = "http://www.myserver.com";;
>>>>         DefaultHttpClient dhc = new DefaultHttpClient();
>>>>         HttpParams hparams = dhc.getParams();
>>>>         hparams.setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, 
>>>> true);
>>>>
>>>>         HttpGet req =new HttpGet(url);
>>>>
>>>>         req.addHeader("Cookie", "A=B");
>>>>         req.addHeader("Cookie", "C=D");
>>>>         req.addHeader("User-Agent", "AndroidExp/ApacheHttpClient");
>>>>
>>>>         try {
>>>>             HttpResponse response = dhc.execute(req);
>>>>             message = (response == null) ? "No response" : ("Status -> 
>>>> " + response.getStatusLine().getStatusCode());
>>>>         } catch(Exception e) {
>>>>             message = e.getClass().getName() + " => " + e.getMessage();
>>>>             e.printStackTrace();
>>>>         } catch(RuntimeException e) {
>>>>             message = e.getClass().getName() + " => " + e.getMessage();
>>>>             e.printStackTrace();
>>>>         }
>>>>
>>>>
>>>> And then monitored via Charles Proxy. The request being created is as 
>>>> follows:
>>>>
>>>> GET / HTTP/1.1
>>>> Cookie: A=B
>>>> Cookie: C=D
>>>> User-Agent: AndroidExp/ApacheHttpClientTask
>>>>
>>>> As per HTTP spec, there can be only one "Cookie" header.
>>>> The same happens with AndroidHttpClient as well.
>>>>
>>>> Do I have a wrong config or did I just find a bug in the code?
>>>>
>>>> Any pointers will be useful.
>>>>
>>>> - Gaurav
>>>> www.m10v.com
>>>>
>>>>
>>>>  -- 
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Android Developers" group.
>>>> To post to this group, send email to [email protected]
>>>>
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/android-developers?hl=en
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Android Developers" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> -- 
>>> Michael Banzon
>>> http://michaelbanzon.com/ 
>>>
>>
>
>
> -- 
> Michael Banzon
> http://michaelbanzon.com/ 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to