How can I force Java's HttpClient to accept invalid cookies?

后端 未结 6 1010
南方客
南方客 2020-12-15 14:25

I\'m working on a script that logs into WordPress, however, HttpClient\'s cookie policy identifies the cookies set by WordPress to be invalid:

May 17, 2009 1         


        
6条回答
  •  一整个雨季
    2020-12-15 15:16

    Check this post for further hints: Java HtmlUnit - can't login to wordpress

    In similar situations I was able to use the following code (although I admit it doesn't work in the specific wordpress case):

    HttpClient client = new HttpClient();
    client.getParams().setParameter("http.protocol.single-cookie-header", true);
    client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY);
    

提交回复
热议问题