Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

AhcClientHandler.handleCookie() method #9

@agherardi

Description

@agherardi

Hi,
Method AhcClientHandler.handleCookie() does the following:

private void handleCookie(final RequestBuilder requestBuilder) {
    for (final Cookie c : cookies) {
        requestBuilder.addCookie(c);
    }
}

This ends up calling RequestBuilderBase.addCookie():

public T addCookie(Cookie cookie) {
    lazyInitCookies();
    request.cookies.add(cookie);
    return derived.cast(this);
}

Won't this cause all cookies to be attached to the request, regardless of domain/path/expiration, etc.?

If I run this code:

client.resource("http://www.amazon.com").get(ClientResponse.class);
client.resource("http://10.220.178.235").get(ClientResponse.class);

looking at the wireshark capture, I see the Amazon cookies being sent to 10.220.178.235.

Thoughts?

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions