alexrainman / ModernHttpClient

ModernHttpClient
MIT License
126 stars 27 forks source link

How get cookies? #74

Open MakcStudio opened 3 years ago

MakcStudio commented 3 years ago

in response to the request, I get cookies, but for some reason the container does not save them automatically. Why isn't this possible? aren't these standard functions?

MakcStudio commented 3 years ago

I spent a whole day trying to figure out why this shitcode doesn't do what I need, and as it turned out, it doesn't even accept cookies sent to it, but uses some kind of cookie container that is static for all cookies. In General, if someone needs to use cookies with this shit, I advise you to download and manage this library for yourself

alexrainman commented 3 years ago

This "shit" code is used by thou devs around the world. The cookie handler is not static, it uses each platform cookie container. If you want to send cookies, use SetCookie method. Yes, it doesn't offer a ReadCookie method. I may add it to this "shitty" code if i have some time.

MakcStudio commented 3 years ago

This "shit" code is used by thou devs around the world. The cookie handler is not static, it uses each platform cookie container. If you want to send cookies, use SetCookie method. Yes, it doesn't offer a ReadCookie method. I may add it to this "shitty" code if i have some time.

The method for getting cookies is good. It would be great if it also collected cookies there during the redirect. You use Cookie storage (in the ios project, when passing nativeCookie, nothing is done with them, I corrected this code yesterday)

This is not normal logic if you need to send different cookies all the time. I have several accounts and several sessions in the app. Using a single storage is wildly inconvenient. I would advise you to abandon the implementation of cookies through storage with a cache, disable it completely, so that people completely add the necessary cookies manually.

Your library helped me solve the problem with ssl , but it caused other problems that I had to solve. Not very intuitive problems, I spent a long time debugging your code yesterday to understand where cookies come from (after I removed them in SendAsync) It turns out this happens in session, if my container is empty, in session it still inserts cookies from storage.

alexrainman commented 3 years ago

If you have something you think need to be fixed, please submit a PR.