Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpLoader does not fully support cookies #86

Open
grimsa opened this issue Aug 11, 2015 · 1 comment
Open

HttpLoader does not fully support cookies #86

grimsa opened this issue Aug 11, 2015 · 1 comment

Comments

@grimsa
Copy link

grimsa commented Aug 11, 2015

In fr.eolya.utils.http.HttpLoader.getAuthCookies method:

        // A CookieStore object is created
        CookieStore cookieStore = new BasicCookieStore();
        HttpContext localContext = new BasicHttpContext();

        // ... and set
        localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);

        /* ... */

        // ... and populated
        HttpResponse response = httpClient.execute(httpPost, localContext);

        /* ... */

        // However this gets a different (empty) CookieStore object, thus returning no cookies!
        List<Cookie> cookies = httpClient.getCookieStore().getCookies();
@grimsa grimsa changed the title HttpLoader#getAuthCookies does not return any cookies HttpLoader does not fully support cookies Aug 11, 2015
@grimsa
Copy link
Author

grimsa commented Aug 11, 2015

In fr.eolya.utils.http.HttpLoader.getHttpClient(String) method when a CookieStore is populated, the Domain for the cookies is not set, making them not be used later when making HTTP requests.
The current code should be fixed:

    BasicClientCookie cookie = new BasicClientCookie(pairs.getKey(), pairs.getValue());
    //cookie.setDomain("your domain");                     // <-- this should be implemented properly
    cookie.setPath("/");
    cookieStore.addCookie(cookie);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant