8276774 Solution Proposal for Cookie stored in CookieHandler not sent if user headers contain cookie
pierre.viret at postfinance.ch
pierre.viret at postfinance.ch
Mon Nov 8 06:32:38 UTC 2021
Hi
I have filled a bug report for a problem with Cookie in HttpClient and following bug was opened now:
Issue: https://bugs.openjdk.java.net/browse/JDK-8276774
Proposal to solve the problem for Http/1.1:
* Class jdk/internal/net/http/Http1Request.java, Method collectHeaders0
* Replace line 112 with: HttpHeaders filteredSystemHeaders = HttpHeaders.of(systemHeaders.map(), (k,v) -> uh.firstValue(k).isEmpty());
* Replace line 118 with: collectHeaders1(sb, filteredSystemHeaders, nocookies);
The idea is that the line 127: "collectCookies(sb, systemHeaders, userHeaders);" will then use the real system headers containing the Cookie header with the cookies from the CookieManager, and so we should collect both cookies from userHeaders and from systemHeaders together.
Could someone please check this and perform the fix ?
Note that the same problem probably impacts the HTTP/2 implementation as the same filter is used in jdk.internal.net.http.Stream.headerFrame(long) at line 658
sysh = HttpHeaders.of(sysh.map(), (k,v) -> uh.firstValue(k).isEmpty());
So we should check this case, too.
Regards,
Pierre
Remarque concernant la sécurité:
Ce courriel provenant de PostFinance est signé. Vous trouverez d'autres informations à ce sujet sous:
https://www.postfinance.ch/e-signature.
Ne divulguez jamais vos éléments de sécurité à des tiers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20211108/46765a7d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5744 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20211108/46765a7d/smime.p7s>
More information about the net-dev
mailing list