Closed bdr99 closed 9 years ago
Hi @bdr99 I have been reading more about cookie encoding, http://tools.ietf.org/html/rfc6265#section-4.1.1, and it looks like the existing url decoding for cookies in VBA-Web goes a little too far (leading to issues like "+" being decoded incorrectly in your case). I'll update the library with more cookie-specific encoding/decoding shortly, thanks for raising this issue.
(Also, thanks for the detailed issue, including a test case!)
You're welcome, glad I could help!
I ran into this problem when I was writing a macro that authenticates to a web service which requires a session cookie. The session cookie is a string of characters which sometimes includes a plus sign. These plus signs are getting changed to spaces when the cookie is saved to the response's
Cookies
Dictionary. I worked around it by using something likesessionCookie = replace(sessionCookie, " ", "+")
, but it is not an ideal solution.Looking at the code, it appears that this is because of the call to
WebHelpers.UrlDecode
here in theWebResponse
class. Why do cookies need to be UrlDecoded? Is it necessary?Here is some example code which replicates the problem:
The response header that comes from httpbin.org is as follows:
The
Set-Cookie
header sayscookie=abc+def
, so I would expectresponse.Cookies(1)("Value")
to beabc+def
, but theMsgBox
instead displaysabc def
.