From 753349fb2eb5e015d2dc7dd036f565272523c70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1ximo=20Casta=C3=B1eda?= Date: Mon, 28 Nov 2022 20:30:11 +0100 Subject: [PATCH] WebPositive: save the cookie jar in the user settings directory also for the curl backend The files and formats are different for libnetservices and curl backends, but now they are under the same directory whatever the installed haikuwebkit version uses. Change-Id: Iab87d5fd27ebea1fa0a8967a9802dfa2fb11240a Reviewed-on: https://review.haiku-os.org/c/haiku/+/5835 Reviewed-by: waddlesplash --- src/apps/webpositive/BrowserApp.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/apps/webpositive/BrowserApp.cpp b/src/apps/webpositive/BrowserApp.cpp index c08fea248e..11bb6a4703 100644 --- a/src/apps/webpositive/BrowserApp.cpp +++ b/src/apps/webpositive/BrowserApp.cpp @@ -65,8 +65,6 @@ const char* kApplicationSignature = "application/x-vnd.Haiku-WebPositive"; const char* kApplicationName = B_TRANSLATE_SYSTEM_NAME("WebPositive"); static const uint32 PRELOAD_BROWSING_HISTORY = 'plbh'; -#define ENABLE_NATIVE_COOKIES 1 - BrowserApp::BrowserApp() : @@ -99,7 +97,6 @@ BrowserApp::BrowserApp() } #endif -#if ENABLE_NATIVE_COOKIES BString cookieStorePath = kApplicationName; cookieStorePath << "/Cookies"; fCookies = new SettingsMessage(B_USER_SETTINGS_DIRECTORY, @@ -110,7 +107,14 @@ BrowserApp::BrowserApp() fContext->SetCookieJar( BPrivate::Network::BNetworkCookieJar(&cookieArchive)); } -#endif + + BPath curlCookies; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &curlCookies) == B_OK + && curlCookies.Append(kApplicationName) == B_OK + && curlCookies.Append("cookie.jar.db") == B_OK) { + + setenv("CURL_COOKIE_JAR_PATH", curlCookies.Path(), 0); + } BString sessionStorePath = kApplicationName; sessionStorePath << "/Session";