Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1556

Default CookieSpecs provider not found for AbstractHttpClient subclass

    XMLWordPrintableJSON

Details

    Description

      When a client based on the deprecated AbstractHttpClient is created without customizing the default CookieSpecRegistry, the default CookiePolicy is not subsequently found from this CookieSpecRegistry in org.apache.http.client.protocol.RequestAddCookies.java line 149. The reason is that RequestAddCookies is looking up the non-deprecated CookieSpecs.DEFAULT (String value "default") by default but the CookieSpecRegistry was constructed with the deprecated CookiePolicy.BEST_MATCH (String value "best-match") as the default.

      Adding the line

      registry.register(
      CookieSpecs.DEFAULT,
      new BestMatchSpecFactory());

      to org.apache.http.impl.client.AbstractHttpClient::createCookieSpecRegistry method appears to fix this issue.

      Attachments

        Activity

          People

            Unassigned Unassigned
            timo.kinnunen Timo Kinnunen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: