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

Cookie duplication #104

Closed
jaygen opened this issue Apr 2, 2013 · 4 comments
Closed

Cookie duplication #104

jaygen opened this issue Apr 2, 2013 · 4 comments

Comments

@jaygen
Copy link

jaygen commented Apr 2, 2013

Hi,

browsermob-proxy (with the latest git revision) is presently duplicating cookies in some cases.

You can test this like so:

  1. Point browser to http://www.html-kit.com/tools/cookietester/
  2. Press Set Test Cookie
  3. On the resulting page, observe that two copies of the cookie are present.

After much digging around I found that the RequestAddCookies Interceptor was adding cookies from the CookieStore to the request headers even though the Cookies header for those cookies existed. It also decides that the cookies are of version 0 and thus it adds a Cookies2 version header even though Cookies2 was obsoleted by RFC-6265.

I didn't bother to look around to see if the Cookies header was supposed to have been removed at some point, I just disabled the RequestAddCookies interceptor by adding

httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES);

to the BrowserMobHttpClient constructor. This ruins the cookie parsing that RequestCookiesInterceptor is attempting to do, but I'd rather have unparsed cookies in my hars than be duplicating cookie headers. This issue was rather hard to track down because it only affected one client who has a .NET backend which deals with duplicate cookies by joining them with a comma. 😣

@lightbody
Copy link
Member

Thanks for the report. I'll see what I can do.

@lightbody
Copy link
Member

FYI -- I'm working on this right now.

On Mon, Apr 1, 2013 at 10:16 PM, Jason Kay notifications@github.com wrote:

Hi,

browsermob-proxy (with the latest git revision) is presently duplicating
cookies in some cases.

You can test this like so:

  1. Point browser to http://www.html-kit.com/tools/cookietester/
  2. Press Set Test Cookie
  3. On the resulting page, observe that two copies of the cookie are
    present.

After much digging around I found that the RequestAddCookies Interceptor
was adding cookies from the CookieStore to the request headers even though
the Cookies header for those cookies existed. It also decides that the
cookies are of version 0 and thus it adds a Cookies2 version header even
though Cookies2 was obsoleted by RFC-6265.

I didn't bother to look around to see if the Cookies header was supposed
to have been removed at some point, I just disabled the RequestAddCookies
interceptor by adding

httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES);

to the BrowserMobHttpClient constructor. This ruins the cookie parsing
that RequestCookiesInterceptor is attempting to do, but I'd rather have
unparsed cookies in my hars than be duplicating cookie headers. This issue
was rather hard to track down because it only affected one client who has a
.NET backend which deals with duplicate cookies by joining them with a
comma. [image: 😣]


Reply to this email directly or view it on GitHubhttps://github.com//issues/104
.

@lightbody
Copy link
Member

Update: I have failing tests written. Now I'm trying to figure out what @gomezd was doing back in #16, which seems to be related to all this.

@jaygen
Copy link
Author

jaygen commented Apr 21, 2013

Thank you, Patrick 😎

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

2 participants