httrack icon indicating copy to clipboard operation
httrack copied to clipboard

Junk cookies in request ($Version and $Path)

Open XP1 opened this issue 7 years ago • 0 comments

There is a problem with junk cookies being added to requests. Because the cookie header doesn't match or contains unexpected cookies, the server rejects the request.

Bad junk cookies:

Cookie: $Version=1; name=value; $Path=/; has_js=1; $Path=/

Good, no junk cookies:

Cookie: name=value; has_js=1

Section of source code:

        b = cookie_find(b, "", jump_identification_const(adr), fil);  // prochain cookie satisfaisant aux conditions
        if (b != NULL) {
          max_cookies--;
          if (!cook) {
            print_buffer(&bstr, "Cookie: $Version=1; ");
            cook = 1;
          } else
            print_buffer(&bstr, "; ");
          print_buffer(&bstr, "%s", cookie_get(buffer, b, 5));
          print_buffer(&bstr, "=%s", cookie_get(buffer, b, 6));
          print_buffer(&bstr, "; $Path=%s", cookie_get(buffer, b, 2));
          b = cookie_nextfield(b);
        }

https://github.com/xroche/httrack/blob/master/src/htslib.c#L1037

XP1 avatar Aug 27 '17 08:08 XP1