Skip to content
Permalink
Browse files
2010-10-27 Sergio Villar Senin <svillar@igalia.com>
        Reviewed by Martin Robinson.

        [Gtk] http/tests/xmlhttprequest/basic-auth-default.html fails
        https://bugs.webkit.org/show_bug.cgi?id=38956

        * platform/gtk/Skipped: removed test from skipped list
2010-10-27  Sergio Villar Senin  <svillar@igalia.com>

        Reviewed by Martin Robinson.

        [Gtk] http/tests/xmlhttprequest/basic-auth-default.html fails
        https://bugs.webkit.org/show_bug.cgi?id=38956

        Added a new utility function that turns SoupURIs into
        KURLs. That addresses some issues with SoupURIs like for example
        soup_uri_to_string ignoring the URI password. Basic authentication
        using URL credentials should work now.

        * GNUmakefile.am:
        * platform/network/soup/ResourceHandleSoup.cpp:
        (WebCore::ResourceHandle::start):
        (WebCore::ResourceHandle::loadResourceSynchronously):
        * platform/network/soup/ResourceRequestSoup.cpp:
        (WebCore::ResourceRequest::updateFromSoupMessage):
        * platform/network/soup/ResourceResponseSoup.cpp:
        (WebCore::ResourceResponse::updateFromSoupMessage):
        * platform/network/soup/SoupURIUtils.cpp: Added.
        (WebCore::soupURIToKURL):
        * platform/network/soup/SoupURIUtils.h: Added.

Canonical link: https://commits.webkit.org/61172@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mrobinson committed Oct 27, 2010
1 parent eb1deb8 commit a80a3f8796f2ff658802afc82b88b00194157b37
Showing 9 changed files with 131 additions and 13 deletions.
@@ -1,3 +1,12 @@
2010-10-27 Sergio Villar Senin <svillar@igalia.com>

Reviewed by Martin Robinson.

[Gtk] http/tests/xmlhttprequest/basic-auth-default.html fails
https://bugs.webkit.org/show_bug.cgi?id=38956

* platform/gtk/Skipped: removed test from skipped list

2010-10-27 Martin Robinson <mrobinson@igalia.com>

Rebaseline a couple tests after r70569.
@@ -5229,9 +5229,6 @@ http/tests/workers/text-encoding.html
# https://bugs.webkit.org/show_bug.cgi?id=31302
fast/css/font-face-woff.html

# https://bugs.webkit.org/show_bug.cgi?id=38956
http/tests/xmlhttprequest/basic-auth-default.html

# https://bugs.webkit.org/show_bug.cgi?id=40049
http/tests/inspector/resource-har-conversion.html
http/tests/inspector/resource-parameters.html
@@ -1,3 +1,27 @@
2010-10-27 Sergio Villar Senin <svillar@igalia.com>

Reviewed by Martin Robinson.

[Gtk] http/tests/xmlhttprequest/basic-auth-default.html fails
https://bugs.webkit.org/show_bug.cgi?id=38956

Added a new utility function that turns SoupURIs into
KURLs. That addresses some issues with SoupURIs like for example
soup_uri_to_string ignoring the URI password. Basic authentication
using URL credentials should work now.

* GNUmakefile.am:
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::updateFromSoupMessage):
* platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::ResourceResponse::updateFromSoupMessage):
* platform/network/soup/SoupURIUtils.cpp: Added.
(WebCore::soupURIToKURL):
* platform/network/soup/SoupURIUtils.h: Added.

2010-10-27 Ademar de Souza Reis Jr <ademar.reis@openbossa.org>

Reviewed by Andreas Kling.
@@ -3616,6 +3616,8 @@ webcoregtk_sources += \
WebCore/platform/network/soup/SocketStreamError.h \
WebCore/platform/network/soup/SocketStreamHandle.h \
WebCore/platform/network/soup/SocketStreamHandleSoup.cpp \
WebCore/platform/network/soup/SoupURIUtils.cpp \
WebCore/platform/network/soup/SoupURIUtils.h \
WebCore/platform/network/soup/cache/soup-directory-input-stream.c \
WebCore/platform/network/soup/cache/soup-directory-input-stream.h \
WebCore/platform/network/soup/cache/soup-http-input-stream.c \
@@ -672,6 +672,15 @@ bool ResourceHandle::start(NetworkingContext* context)
if (context && !context->isValid())
return false;

if (!(d->m_user.isEmpty() || d->m_pass.isEmpty())) {
// If credentials were specified for this request, add them to the url,
// so that they will be passed to NetworkRequest.
KURL urlWithCredentials(firstRequest().url());
urlWithCredentials.setUser(d->m_user);
urlWithCredentials.setPass(d->m_pass);
d->m_firstRequest.setURL(urlWithCredentials);
}

KURL url = firstRequest().url();
String urlString = url.string();
String protocol = url.protocol();
@@ -25,6 +25,7 @@
#include "HTTPParsers.h"
#include "MIMETypeRegistry.h"
#include "PlatformString.h"
#include "SoupURIUtils.h"
#include <wtf/text/CString.h>

#include <libsoup/soup.h>
@@ -88,9 +89,7 @@ SoupMessage* ResourceRequest::toSoupMessage() const

void ResourceRequest::updateFromSoupMessage(SoupMessage* soupMessage)
{
SoupURI* soupURI = soup_message_get_uri(soupMessage);
GOwnPtr<gchar> uri(soup_uri_to_string(soupURI, FALSE));
m_url = KURL(KURL(), String::fromUTF8(uri.get()));
m_url = soupURIToKURL(soup_message_get_uri(soupMessage));

m_httpMethod = String::fromUTF8(soupMessage->method);

@@ -107,10 +106,8 @@ void ResourceRequest::updateFromSoupMessage(SoupMessage* soupMessage)

#ifdef HAVE_LIBSOUP_2_29_90
SoupURI* firstParty = soup_message_get_first_party(soupMessage);
if (firstParty) {
GOwnPtr<gchar> firstPartyURI(soup_uri_to_string(firstParty, FALSE));
m_firstPartyForCookies = KURL(KURL(), String::fromUTF8(firstPartyURI.get()));
}
if (firstParty)
m_firstPartyForCookies = soupURIToKURL(firstParty);
#endif

m_soupFlags = soup_message_get_flags(soupMessage);
@@ -25,6 +25,7 @@
#include "HTTPParsers.h"
#include "MIMETypeRegistry.h"
#include "PlatformString.h"
#include "SoupURIUtils.h"
#include <wtf/text/CString.h>

using namespace std;
@@ -56,9 +57,7 @@ SoupMessage* ResourceResponse::toSoupMessage() const

void ResourceResponse::updateFromSoupMessage(SoupMessage* soupMessage)
{
SoupURI* soupURI = soup_message_get_uri(soupMessage);
GOwnPtr<gchar> uri(soup_uri_to_string(soupURI, FALSE));
m_url = KURL(KURL(), String::fromUTF8(uri.get()));
m_url = soupURIToKURL(soup_message_get_uri(soupMessage));

m_httpStatusCode = soupMessage->status_code;

@@ -0,0 +1,44 @@
/*
* Copyright (C) 20010 Igalia S.L.
*
* 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 "SoupURIUtils.h"

#include "GOwnPtr.h"
#include <libsoup/soup.h>

namespace WebCore {

// Motivated by https://bugs.webkit.org/show_bug.cgi?id=38956. libsoup
// does not add the password to the URL when calling
// soup_uri_to_string, and thus the requests are not properly
// built. Fixing soup_uri_to_string is a no-no as the maintainer does
// not want to break compatibility with previous implementations
KURL soupURIToKURL(SoupURI* soupURI)
{
GOwnPtr<gchar> urlString(soup_uri_to_string(soupURI, FALSE));
KURL url(KURL(), String::fromUTF8(urlString.get()));

if (!soupURI->password)
return url;

url.setPass(String::fromUTF8(soupURI->password));
return url;
}

}
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2010 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef SoupURIUtils_h
#define SoupURIUtils_h

#include "KURL.h"

typedef struct _SoupURI SoupURI;

namespace WebCore {
KURL soupURIToKURL(SoupURI* soupURI);
}

#endif

0 comments on commit a80a3f8

Please sign in to comment.