I see you add two Cookie Headers.

On Saturday, August 9, 2014 3:08:32 PM UTC-4, Gaurav Vaish 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.

Reply via email to