VBA-tools / VBA-Web

VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web
http://vba-tools.github.io/VBA-Web/
MIT License
2.01k stars 494 forks source link

Override UrlEncodingMode for cookies #235

Closed bdr99 closed 8 years ago

bdr99 commented 8 years ago

I have a web service that I am communicating with. I need to send the web service a cookie which contains some special characters, such as the "=" character. This used to work fine, but in the newest version, VBA-Web automatically changes "=" to "%3D" in my cookies, which has made me unable to communicate with my web service. I was reading in the changelog about the new UrlEncodingMode feature, and the various UrlEncodingModes, but I can't figure out how to set which one it uses. How can I accomplish this?

timhall commented 8 years ago

Thanks for raising this @bdr99 I misread the RFC and applied the name encoding to both the name and value. The value encoding allows many more characters (including =) so I'll update that tomorrow.

bdr99 commented 8 years ago

@timhall Great! Thanks! :+1:

timhall commented 8 years ago

@bdr99 released in 4.1.1, let me know if that works for you.

Also, to override cookie encoding, you can add cookies to the request collection directly (rather than with AddCookie):

Request.AddCookie "a[0]", "1; extra=info"
' -> Encoded (using 4.1.1) as a%5B0%5D=1%3B%20extra=info

Request.Cookies.Add WebHelpers.CreateKeyValue("a[0]", "1; extra=info")
' -> Unencoded as a[0]=1; extra=info