Commit f02b6bcb authored by alp@webkit.org's avatar alp@webkit.org

2008-04-14 Xan Lopez <xan@gnome.org>

        Reviewed by Alp Toker.

        http://bugs.webkit.org/show_bug.cgi?id=17917
        Bug 17917: Cookie support for HTTP soup backend

        Initial implementation of cookies for the http soup backend.

        Moved CookieJarGtk to CookieJarSoup in network/soup and left the original
        one as CookieJarCurl in network/curl.

        Bumped the libsoup required version to 2.23 for cookie support.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31878 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f3e867a0
2008-04-14 Xan Lopez <xan@gnome.org>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=17917
Bug 17917: Cookie support for HTTP soup backend
Bumped the libsoup required version to 2.23 for cookie support.
* configure.ac:
2008-04-11 Mark Rowe <mrowe@apple.com>
Rubber-stamped by Anders Carlsson.
......
2008-04-14 Xan Lopez <xan@gnome.org>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=17917
Bug 17917: Cookie support for HTTP soup backend
Initial implementation of cookies for the http soup backend.
Moved CookieJarGtk to CookieJarSoup in network/soup and left the original
one as CookieJarCurl in network/curl.
* GNUmakefile.am:
* platform/CookieJar.h:
* platform/network/curl/CookieJarCurl.cpp: Renamed from WebCore/platform/gtk/CookieJarGtk.cpp.
(WebCore::setCookies):
(WebCore::cookies):
* platform/network/soup/CookieJarSoup.cpp: Added.
(WebCore::getCookieJar):
(WebCore::setCookies):
(WebCore::cookies):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::start):
2008-04-14 Holger Freyther <zecke@selfish.org>
Reviewed by Alp Toker.
......@@ -990,7 +990,6 @@ webkitgtk_sources += \
WebCore/page/gtk/FrameGtk.cpp \
WebCore/page/gtk/DragControllerGtk.cpp \
WebCore/platform/gtk/ClipboardGtk.cpp \
WebCore/platform/gtk/CookieJarGtk.cpp \
WebCore/platform/gtk/CursorGtk.cpp \
WebCore/platform/gtk/ContextMenuGtk.cpp \
WebCore/platform/gtk/ContextMenuItemGtk.cpp \
......@@ -1052,6 +1051,7 @@ webcore_cppflags += \
-I$(srcdir)/WebCore/platform/network/curl
webcore_sources += \
WebCore/platform/network/curl/CookieJarCurl.cpp \
WebCore/platform/network/curl/ResourceHandleCurl.cpp \
WebCore/platform/network/curl/ResourceHandleManager.cpp
......@@ -1063,6 +1063,7 @@ webcore_cppflags += \
-I$(srcdir)/WebCore/platform/network/soup
webcore_sources += \
WebCore/platform/network/soup/CookieJarSoup.cpp \
WebCore/platform/network/soup/ResourceHandleSoup.cpp
endif
......
......@@ -26,6 +26,10 @@
#ifndef CookieJar_h
#define CookieJar_h
#if USE(SOUP)
#include <libsoup/soup.h>
#endif
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);
#if USE(SOUP)
SoupCookieJar* getCookieJar(void);
#endif
}
#endif
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*- */
/*
* Copyright (C) 2008 Xan Lopez <xan@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
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "CString.h"
#include "CookieJar.h"
#include "KURL.h"
#include "PlatformString.h"
#include "StringHash.h"
#include <libsoup/soup.h>
namespace WebCore {
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)
{
SoupCookieJar* jar = getCookieJar();
if (!jar)
return;
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)
{
SoupCookieJar* jar = getCookieJar();
if (!jar)
return String();
SoupURI* uri = soup_uri_new(url.string().utf8().data());
char* cookies = soup_cookie_jar_get_cookies(jar, uri, FALSE);
soup_uri_free(uri);
String result(cookies);
g_free(cookies);
return result;
}
bool cookiesEnabled(const Document* /*document*/)
{
return getCookieJar();
}
}
......@@ -32,6 +32,7 @@
#include "ResourceHandleClient.h"
#include "ResourceHandleInternal.h"
#include "ResourceResponse.h"
#include "CookieJar.h"
#include <libsoup/soup.h>
#include <libsoup/soup-message.h>
......@@ -285,6 +286,9 @@ bool ResourceHandle::start(Frame* frame)
if (!session) {
session = soup_session_async_new();
soup_session_add_feature(session, SOUP_SESSION_FEATURE(getCookieJar()));
const char* soup_debug = g_getenv("WEBKIT_SOUP_LOGGING");
if (soup_debug) {
int soup_debug_level = atoi(soup_debug);
......
......@@ -223,7 +223,7 @@ GTK_REQUIRED_VERSION=2.8
# optional modules
LIBCURL_REQUIRED_VERSION=7.15
LIBSOUP_REQUIRED_VERSION=2.4
LIBSOUP_REQUIRED_VERSION=2.23
LIBXSLT_REQUIRED_VERSION=1.1.7
SQLITE_REQUIRED_VERSION=3.0
GSTREAMER_REQUIRED_VERSION=0.10
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment