title: Android httpclient cookie rejected illegal path attribute
body: <p>I'm building an android application which use httpclient to post and retrieve data to a wordpress server.</p>
  
  <p>I can't send a post data because of the invalid path in the cookie. Here's the log I retrieved:</p>
  
  <pre><code>Cookie rejected: "BasicClientCookie[version=0,name=wordpress_654732f696815924ebd07fb96f161421,domain=[my-domain],path=/wp-content/plugins,expiry=Thu Feb 13 07:53:10 GMT+07:00 2014]".Illegal path attribute "/wp-content/plugins". Path of origin: "/api/auth/generate_auth_cookie/"
  
  Cookie rejected: "BasicClientCookie[version=0,name=wordpress_654732f696815924ebd07fb96f161421,domain=[my-domain],path=/wp-admin,expiry=Thu Feb 13 07:53:10 GMT+07:00 2014]". Illegal path attribute "/wp-admin". Path of origin: "/api/auth/generate_auth_cookie/"
  </code></pre>
  
  <p>I've searched the forum, and tried solutions given, but it still rejects the cookie from the app. Several solutions I've tried are:</p>
  
  <ul>
  <li><p>set cookie policy</p>
  
  <pre><code>httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY,
  CookiePolicy.BROWSER_COMPATIBILITY);
  </code></pre></li>
  <li><p>This example (<a href="https://stackoverflow.com/questions/4291241/java-htmlunit-cant-login-to-wordpress/4364330#4364330">here</a>)</p></li>
  <li><p><a href="https://stackoverflow.com/questions/874903/how-can-i-force-javas-httpclient-to-accept-invalid-cookies">This</a> solution, still no result</p></li>
  </ul>
  
  <p>here's my android code so far for sending http post data</p>
  
  <pre><code> CookieStore cookieStore = new BasicCookieStore();
          httpclient.setCookieStore(cookieStore);
  
          CookieSpecFactory csf = new CookieSpecFactory() {
              @Override
              public CookieSpec newInstance(HttpParams httpParams) {
                  return new BrowserCompatSpec(){
                      @Override
                      public void validate (Cookie cookie, CookieOrigin origin)
                              throws MalformedCookieException{
                              Log.d("COOKIE", "force validate cookie path info: " + cookie.getPath() +
                                      ", origin: " + origin.getPath());
                      }
                  };
              }
          };
          httpclient.getCookieSpecs().register("custom_validate", csf);
          httpclient.getParams().setParameter(ClientPNames.COOKIE_POLICY, "custom_validate");
  
          HttpPost httppost = new HttpPost(url);
          if(postData != null){
              httppost.setEntity(postData);
          }
  
          HttpResponse response = httpclient.execute(httppost);
  </code></pre>
  
  <p>I've gone through this all day, but no results. 
  Can anyone help?</p>