From ce4cb9c4f1460bcfd462721301d6e2818b2759b4 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 20 Apr 2015 20:51:00 +0300 Subject: [PATCH] Fix sending and receiving cookies --HG-- branch : develop --- code/nel/src/gui/group_html.cpp | 6 ++++-- code/nel/src/gui/libwww.cpp | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 1a893d0d9..024d9b88e 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -416,6 +416,8 @@ namespace NLGUI } else { + receiveCookies(_CurlWWW->Request, HTTPCurrentDomain, _TrustedDomain); + // redirect, get the location and try browse again // we cant use curl redirection because 'addHTTPGetParams()' must be called on new destination std::string location(_CurlWWW->getLocationHeader()); @@ -441,6 +443,8 @@ namespace NLGUI } else { + receiveCookies(_CurlWWW->Request, HTTPCurrentDomain, _TrustedDomain); + _RedirectsRemaining = DEFAULT_RYZOM_REDIRECT_LIMIT; if ( (code < 200 || code >= 300) ) @@ -449,8 +453,6 @@ namespace NLGUI } else { - receiveCookies(_CurlWWW->Request, HTTPCurrentDomain, _TrustedDomain); - char *ch; std::string contentType; res = curl_easy_getinfo(_CurlWWW->Request, CURLINFO_CONTENT_TYPE, &ch); diff --git a/code/nel/src/gui/libwww.cpp b/code/nel/src/gui/libwww.cpp index ff73bb59a..88c6f38c4 100644 --- a/code/nel/src/gui/libwww.cpp +++ b/code/nel/src/gui/libwww.cpp @@ -387,6 +387,9 @@ namespace NLGUI // add all cookies for domain to curl handle void sendCookies(CURL *curl, const std::string &domain, bool trusted) { + // enable curl cookie engine + curl_easy_setopt(curl, CURLOPT_COOKIELIST, ""); + if (domain.empty()) return;