jenkinsci / bitbucket-branch-source-plugin

Bitbucket Branch Source Plugin
https://plugins.jenkins.io/cloudbees-bitbucket-branch-source
MIT License
216 stars 353 forks source link

Fix for "Invalid cookie header"-warning using HttpClient and Bitbucket Server Interaction #791

Closed rickard-n closed 8 months ago

rickard-n commented 9 months ago

I've identified an issue in the HttpClient configuration when interacting with Bitbucket Server. Encountering a warning: "WARNING ... processCookies: Invalid cookie header." This warning is triggered during the cookie parsing process, which seems to be incompatible with the cookie formats sent by Bitbucket Server.

Initially, I considered changing the default cookie specification to CookieSpecs.STANDARD to address this compatibility issue. However, I realized that this might not be the most efficient solution. Current code seems to create a new cookie store for each request.

Therefore, to simplify the HTTP interactions and eliminate the warning, I've opted to deactivate cookie handling in the HttpClient when interacting with Bitbucket Server. By disabling cookie management, we not only avoid the warning but also prevent other cookie-related problems.

Please review the changes and let me know if you have any concerns or if further adjustments are required.

Your checklist for this pull request

lifeofguenter commented 9 months ago

Thanks! Looks good to me - I can not imagine cookies being needed at all?