Advertisement
Guest User

Untitled

a guest
May 1st, 2017
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.45 KB | None | 0 0
  1. commit 0cf62e1355dd217a7f023e0db54052785a718e21
  2. Author: Xan Lopez <xlopez@igalia.com>
  3. Date: Thu Feb 4 00:01:41 2010 +0200
  4.  
  5. 2010-02-03 Xan Lopez <xlopez@igalia.com>
  6.  
  7. Reviewed by NOBODY (OOPS!).
  8.  
  9. Bump minimum libsoup requirement to 2.29.90
  10.  
  11. * configure.ac:
  12.  
  13. WebCore:
  14.  
  15. 2010-02-03 Xan Lopez <xlopez@igalia.com>
  16.  
  17. Reviewed by NOBODY (OOPS!).
  18.  
  19. Set first party URI in all SoupMessages. This allows libsoup to
  20. implement a "no third party cookies" policy in case it wants
  21. to. Also start a non-JSC-specific, gtk-specific GOwnPtr module and
  22. use it for SoupURI.
  23.  
  24. * GNUmakefile.am:
  25. * platform/gtk/GOwnPtrGtk.cpp: Added.
  26. (WTF::SoupURI):
  27. (WTF::GstElement):
  28. * platform/gtk/GOwnPtrGtk.h: Added.
  29. * platform/network/soup/CookieJarSoup.cpp:
  30. (WebCore::setCookies):
  31. * platform/network/soup/ResourceHandleSoup.cpp:
  32. (WebCore::restartedCallback):
  33. (WebCore::startHttp):
  34. * platform/network/soup/ResourceRequestSoup.cpp:
  35. (WebCore::ResourceRequest::toSoupMessage):
  36. (WebCore::ResourceRequest::updateFromSoupMessage):
  37.  
  38. diff --git a/ChangeLog b/ChangeLog
  39. index 5cc6c04..1987b5c 100644
  40. --- a/ChangeLog
  41. +++ b/ChangeLog
  42. @@ -1,3 +1,11 @@
  43. +2010-02-03 Xan Lopez <xlopez@igalia.com>
  44. +
  45. + Reviewed by NOBODY (OOPS!).
  46. +
  47. + Bump minimum libsoup requirement to 2.29.90
  48. +
  49. + * configure.ac:
  50. +
  51. 2010-02-02 Gustavo Noronha Silva <gns@gnome.org>
  52.  
  53. Reviewed by Xan Lopez.
  54. diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
  55. index fbacc54..aed0a3e 100644
  56. --- a/WebCore/ChangeLog
  57. +++ b/WebCore/ChangeLog
  58. @@ -1,3 +1,26 @@
  59. +2010-02-03 Xan Lopez <xlopez@igalia.com>
  60. +
  61. + Reviewed by NOBODY (OOPS!).
  62. +
  63. + Set first party URI in all SoupMessages. This allows libsoup to
  64. + implement a "no third party cookies" policy in case it wants
  65. + to. Also start a non-JSC-specific, gtk-specific GOwnPtr module and
  66. + use it for SoupURI.
  67. +
  68. + * GNUmakefile.am:
  69. + * platform/gtk/GOwnPtrGtk.cpp: Added.
  70. + (WTF::SoupURI):
  71. + (WTF::GstElement):
  72. + * platform/gtk/GOwnPtrGtk.h: Added.
  73. + * platform/network/soup/CookieJarSoup.cpp:
  74. + (WebCore::setCookies):
  75. + * platform/network/soup/ResourceHandleSoup.cpp:
  76. + (WebCore::restartedCallback):
  77. + (WebCore::startHttp):
  78. + * platform/network/soup/ResourceRequestSoup.cpp:
  79. + (WebCore::ResourceRequest::toSoupMessage):
  80. + (WebCore::ResourceRequest::updateFromSoupMessage):
  81. +
  82. 2010-02-03 Drew Wilson <atwilson@chromium.org>
  83.  
  84. Reviewed by Alexey Proskuryakov.
  85. diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
  86. index 9f973da..973eba3 100644
  87. --- a/WebCore/GNUmakefile.am
  88. +++ b/WebCore/GNUmakefile.am
  89. @@ -2009,6 +2009,8 @@ webcoregtk_sources += \
  90. WebCore/platform/gtk/FileSystemGtk.cpp \
  91. WebCore/platform/gtk/GRefPtrGtk.cpp \
  92. WebCore/platform/gtk/GRefPtrGtk.h \
  93. + WebCore/platform/gtk/GOwnPtrGtk.cpp \
  94. + WebCore/platform/gtk/GOwnPtrGtk.h \
  95. WebCore/platform/gtk/GtkPluginWidget.cpp \
  96. WebCore/platform/gtk/GtkPluginWidget.h \
  97. WebCore/platform/gtk/KURLGtk.cpp \
  98. diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp
  99. new file mode 100644
  100. index 0000000..3bb1335
  101. --- /dev/null
  102. +++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp
  103. @@ -0,0 +1,40 @@
  104. +/*
  105. + * Copyright (C) 2010 Igalia S.L
  106. + *
  107. + * This library is free software; you can redistribute it and/or
  108. + * modify it under the terms of the GNU Lesser General Public
  109. + * License as published by the Free Software Foundation; either
  110. + * version 2 of the License, or (at your option) any later version.
  111. + *
  112. + * This library is distributed in the hope that it will be useful,
  113. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  114. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  115. + * Lesser General Public License for more details.
  116. + *
  117. + * You should have received a copy of the GNU Lesser General Public
  118. + * License along with this library; if not, write to the Free Software
  119. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  120. + */
  121. +
  122. +
  123. +#include "config.h"
  124. +#include "GOwnPtrGtk.h"
  125. +
  126. +#include <gst/gstelement.h>
  127. +#include <libsoup/soup-uri.h>
  128. +
  129. +namespace WTF {
  130. +
  131. +template <> void freeOwnedGPtr<SoupURI>(SoupURI* ptr)
  132. +{
  133. + if (ptr)
  134. + soup_uri_free(ptr);
  135. +}
  136. +
  137. +template <> void freeOwnedGPtr<GstElement>(GstElement* ptr)
  138. +{
  139. + if (ptr)
  140. + gst_object_unref(ptr);
  141. +}
  142. +
  143. +}
  144. diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h
  145. new file mode 100644
  146. index 0000000..c585002
  147. --- /dev/null
  148. +++ b/WebCore/platform/gtk/GOwnPtrGtk.h
  149. @@ -0,0 +1,35 @@
  150. +/*
  151. + * Copyright (C) 2010 Igalia S.L
  152. + *
  153. + * This library is free software; you can redistribute it and/or
  154. + * modify it under the terms of the GNU Library General Public
  155. + * License as published by the Free Software Foundation; either
  156. + * version 2 of the License, or (at your option) any later version.
  157. + *
  158. + * This library is distributed in the hope that it will be useful,
  159. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  160. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  161. + * Library General Public License for more details.
  162. + *
  163. + * You should have received a copy of the GNU Library General Public License
  164. + * along with this library; see the file COPYING.LIB. If not, write to
  165. + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  166. + * Boston, MA 02110-1301, USA.
  167. + */
  168. +
  169. +#ifndef GOwnPtrGtk_h
  170. +#define GOwnPtrGtk_h
  171. +
  172. +#include "GOwnPtr.h"
  173. +
  174. +typedef struct _SoupURI SoupURI;
  175. +typedef struct _GstElement GstElement;
  176. +
  177. +namespace WTF {
  178. +
  179. +template<> void freeOwnedGPtr<SoupURI>(SoupURI* ptr);
  180. +template<> void freeOwnedGPtr<GstElement>(GstElement* ptr);
  181. +
  182. +}
  183. +
  184. +#endif
  185. diff --git a/WebCore/platform/network/soup/CookieJarSoup.cpp b/WebCore/platform/network/soup/CookieJarSoup.cpp
  186. index 3eb578a..6f4cc2b 100644
  187. --- a/WebCore/platform/network/soup/CookieJarSoup.cpp
  188. +++ b/WebCore/platform/network/soup/CookieJarSoup.cpp
  189. @@ -24,6 +24,7 @@
  190. #include "Cookie.h"
  191. #include "CString.h"
  192. #include "Document.h"
  193. +#include "GOwnPtrGtk.h"
  194. #include "KURL.h"
  195.  
  196. namespace WebCore {
  197. @@ -54,16 +55,19 @@ void setDefaultCookieJar(SoupCookieJar* jar)
  198. g_object_ref(cookieJar);
  199. }
  200.  
  201. -void setCookies(Document* /*document*/, const KURL& url, const String& value)
  202. +void setCookies(Document* document, const KURL& url, const String& value)
  203. {
  204. SoupCookieJar* jar = defaultCookieJar();
  205. if (!jar)
  206. return;
  207.  
  208. - SoupURI* origin = soup_uri_new(url.string().utf8().data());
  209. + GOwnPtr<SoupURI> origin(soup_uri_new(url.string().utf8().data()));
  210. + GOwnPtr<SoupURI> firstParty(soup_uri_new(document->firstPartyForCookies().string().utf8().data()));
  211.  
  212. - soup_cookie_jar_set_cookie(jar, origin, value.utf8().data());
  213. - soup_uri_free(origin);
  214. + soup_cookie_jar_set_cookie_with_first_party(jar,
  215. + origin.get(),
  216. + firstParty.get(),
  217. + value.utf8().data());
  218. }
  219.  
  220. String cookies(const Document* /*document*/, const KURL& url)
  221. diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
  222. index da16f4a..7862191 100644
  223. --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
  224. +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
  225. @@ -34,6 +34,7 @@
  226. #include "DocLoader.h"
  227. #include "FileSystem.h"
  228. #include "Frame.h"
  229. +#include "GOwnPtrGtk.h"
  230. #include "HTTPParsers.h"
  231. #include "Logging.h"
  232. #include "MIMETypeRegistry.h"
  233. @@ -209,6 +210,13 @@ static void restartedCallback(SoupMessage* msg, gpointer data)
  234.  
  235. if (d->client())
  236. d->client()->willSendRequest(handle, request, response);
  237. +
  238. + // Update the first party in case the base URL changed with the redirect
  239. + String firstPartyString = request.firstPartyForCookies().string();
  240. + if (!firstPartyString.isEmpty()) {
  241. + GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
  242. + soup_message_set_first_party(d->m_msg, firstParty.get());
  243. + }
  244. }
  245.  
  246. static void gotHeadersCallback(SoupMessage* msg, gpointer data)
  247. @@ -484,6 +492,11 @@ static bool startHttp(ResourceHandle* handle)
  248. g_signal_connect(d->m_msg, "content-sniffed", G_CALLBACK(contentSniffedCallback), handle);
  249. g_signal_connect(d->m_msg, "got-chunk", G_CALLBACK(gotChunkCallback), handle);
  250.  
  251. + String firstPartyString = request.firstPartyForCookies().string();
  252. + if (!firstPartyString.isEmpty()) {
  253. + GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
  254. + soup_message_set_first_party(d->m_msg, firstParty.get());
  255. + }
  256. g_object_set_data(G_OBJECT(d->m_msg), "resourceHandle", reinterpret_cast<void*>(handle));
  257.  
  258. FormData* httpBody = d->m_request.httpBody();
  259. diff --git a/WebCore/platform/network/soup/ResourceRequestSoup.cpp b/WebCore/platform/network/soup/ResourceRequestSoup.cpp
  260. index 0d4e0f9..bf289e3 100644
  261. --- a/WebCore/platform/network/soup/ResourceRequestSoup.cpp
  262. +++ b/WebCore/platform/network/soup/ResourceRequestSoup.cpp
  263. @@ -22,6 +22,7 @@
  264.  
  265. #include "CString.h"
  266. #include "GOwnPtr.h"
  267. +#include "GOwnPtrGtk.h"
  268. #include "PlatformString.h"
  269.  
  270. #include <libsoup/soup.h>
  271. @@ -44,6 +45,12 @@ SoupMessage* ResourceRequest::toSoupMessage() const
  272. soup_message_headers_append(soupHeaders, it->first.string().utf8().data(), it->second.utf8().data());
  273. }
  274.  
  275. + String firstPartyString = firstPartyForCookies().string();
  276. + if (!firstPartyString.isEmpty()) {
  277. + GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
  278. + soup_message_set_first_party(soupMessage, firstParty.get());
  279. + }
  280. +
  281. // Body data is only handled at ResourceHandleSoup::startHttp for
  282. // now; this is because this may not be a good place to go
  283. // openning and mmapping files. We should maybe revisit this.
  284. @@ -69,9 +76,14 @@ void ResourceRequest::updateFromSoupMessage(SoupMessage* soupMessage)
  285. if (soupMessage->request_body->data)
  286. m_httpBody = FormData::create(soupMessage->request_body->data, soupMessage->request_body->length);
  287.  
  288. - // FIXME: m_allowCookies and m_firstPartyForCookies should
  289. - // probably be handled here and on doUpdatePlatformRequest
  290. - // somehow.
  291. + SoupURI* firstParty = soup_message_get_first_party(soupMessage);
  292. + if (firstParty) {
  293. + GOwnPtr<gchar> firstPartyURI(soup_uri_to_string(firstParty, FALSE));
  294. + m_firstPartyForCookies = KURL(KURL(), String::fromUTF8(firstPartyURI.get()));
  295. + }
  296. +
  297. + // FIXME: m_allowCookies should probably be handled here and on
  298. + // doUpdatePlatformRequest somehow.
  299. }
  300.  
  301. unsigned initializeMaximumHTTPConnectionCountPerHost()
  302. diff --git a/configure.ac b/configure.ac
  303. index 082486b..56a3963 100644
  304. --- a/configure.ac
  305. +++ b/configure.ac
  306. @@ -190,7 +190,7 @@ if test "$with_hildon" = "yes"; then
  307. fi
  308.  
  309. # minimum base dependencies
  310. -LIBSOUP_REQUIRED_VERSION=2.28.2
  311. +LIBSOUP_REQUIRED_VERSION=2.29.90
  312. CAIRO_REQUIRED_VERSION=1.6
  313. FONTCONFIG_REQUIRED_VERSION=2.4
  314. FREETYPE2_REQUIRED_VERSION=9.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement