[Webkit-unassigned] [Bug 17917] Cookie support for HTTP soup backend

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 1 07:15:09 PDT 2008


julien.chaffraix at gmail.com changed:

           What    |Removed                     |Added
                 CC|                            |julien.chaffraix at gmail.com

------- Comment #6 from julien.chaffraix at gmail.com  2008-04-01 07:15 PDT -------
I do not know libsoup, so I will just comment on the interaction with the other

CookieJar.h and CookieJarGtk.h are currently shared with the cURL backend and
your changes do not take that into account.

For CookieJarGtk, we have the choice between 
adding the proper #if USE guards or split it into two files.
I do not really think we can share code in this case so I would vote for
splitting the files and moving them in their own directory.

diff --git a/WebCore/platform/CookieJar.h b/WebCore/platform/CookieJar.h

index 38efd04..3cd86dd 100644

--- a/WebCore/platform/CookieJar.h

+++ b/WebCore/platform/CookieJar.h

@@ -26,6 +26,10 @@

 #ifndef CookieJar_h

 #define CookieJar_h


Shoud be USE(SOUP).

+#include <libsoup/soup.h>



 namespace WebCore {

     class KURL;

@@ -35,7 +39,9 @@ namespace WebCore {

     String cookies(const Document* document, const KURL&);

     void setCookies(Document* document, const KURL&, const KURL&
policyBaseURL, const String&);

     bool cookiesEnabled(const Document* document);



Same as above.

+    SoupCookieJar* getCookieJar(void);




diff --git a/WebCore/platform/gtk/CookieJarGtk.cpp

index 2f76ebc..eace692 100644

--- a/WebCore/platform/gtk/CookieJarGtk.cpp

+++ b/WebCore/platform/gtk/CookieJarGtk.cpp

@@ -1,4 +1,7 @@

+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*- */


+ *  Copyright (C) 2008 Xan Lopez <xan at gnome.org>

+ *

  *  This library is free software; you can redistribute it and/or

  *  modify it under the terms of the GNU Lesser General Public

  *  License as published by the Free Software Foundation; either

@@ -15,31 +18,56 @@


 #include "config.h"

+#include "CString.h"

 #include "CookieJar.h"

 #include "KURL.h"

 #include "PlatformString.h"

 #include "StringHash.h"

-#include <wtf/HashMap.h>

+#include <libsoup/soup.h>

 namespace WebCore {

-static HashMap<String, String> cookieJar;

+SoupCookieJar* getCookieJar()


+    static SoupCookieJar* jar = NULL;


+    if (!jar)

+        jar = soup_cookie_jar_new ();


+    return jar;


-void setCookies(Document* /*document*/, const KURL& url, const KURL&
/*policyURL*/, const String& value)

+void setCookies(Document* document, const KURL& url, const KURL& policyURL,
const String& value)

Why do you change this line while you do not use the parameters?


-    cookieJar.set(url.string(), value);

+    SoupCookieJar* jar = getCookieJar();

+    if (!jar) return;

We usually put the if and the return on two different lines.

+    SoupURI* origin = soup_uri_new(url.string().utf8().data());


+    soup_cookie_jar_set_cookie(jar, origin, value.utf8().data());

+    soup_uri_free(origin);


-String cookies(const Document* /*document*/, const KURL& url)

+String cookies(const Document* document, const KURL& url)

Same as above.


-    return cookieJar.get(url.string());

+    SoupCookieJar* jar = getCookieJar();

+    if (!jar) return String();

Same as above.

Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the webkit-unassigned mailing list