Hello community,
here is the log from the commit of package libzypp
checked in at Wed Apr 12 10:28:22 CEST 2006.
--------
--- libzypp/libzypp.changes 2006-04-11 16:51:49.000000000 +0200
+++ STABLE/libzypp/libzypp.changes 2006-04-11 20:21:01.000000000 +0200
@@ -1,0 +2,7 @@
+Tue Apr 11 19:48:51 CEST 2006 - mt@suse.de
+
+- Improved Url path name "//" vs. "/%2f" handling; now if the
+ url has an authority, "/%2f" is used for ftp only (#163784)
+- rev 3062
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libzypp.spec ++++++
--- /var/tmp/diff_new_pack.NmABKh/_old 2006-04-12 10:24:23.000000000 +0200
+++ /var/tmp/diff_new_pack.NmABKh/_new 2006-04-12 10:24:23.000000000 +0200
@@ -18,7 +18,7 @@
Autoreqprov: on
Summary: Package, Patch, Pattern, and Product Management
Version: 0.0.8
-Release: 90
+Release: 92
Source: zypp-0.0.0.tar.bz2
Prefix: /usr
Provides: yast2-packagemanager
@@ -104,6 +104,10 @@
%{_libdir}/pkgconfig/libzypp.pc
%changelog -n libzypp
+* Tue Apr 11 2006 - mt@suse.de
+- Improved Url path name "//" vs. "/%%2f" handling; now if the
+ url has an authority, "/%%2f" is used for ftp only (#163784)
+- rev 3062
* Tue Apr 11 2006 - jsrain@suse.de
- fixed storing patch scripts to target store (#159928)
- rev 3058
++++++ zypp-0.0.0.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zypp-0.0.0/po/zypp.pot new/zypp-0.0.0/po/zypp.pot
--- old/zypp-0.0.0/po/zypp.pot 2006-04-10 16:32:06.000000000 +0200
+++ new/zypp-0.0.0/po/zypp.pot 2006-04-10 19:07:28.000000000 +0200
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: translation@suse.de\n"
-"POT-Creation-Date: 2006-04-10 16:32+0200\n"
+"POT-Creation-Date: 2006-04-10 19:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zypp-0.0.0/testsuite/solver/data.deptestomatic/yast-tests/build911a-test.xml new/zypp-0.0.0/testsuite/solver/data.deptestomatic/yast-tests/build911a-test.xml
--- old/zypp-0.0.0/testsuite/solver/data.deptestomatic/yast-tests/build911a-test.xml 2006-04-11 12:04:12.000000000 +0200
+++ new/zypp-0.0.0/testsuite/solver/data.deptestomatic/yast-tests/build911a-test.xml 1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!-- check freshenPool -->
-<test>
-<setup>
- <channel name="packages" file="build911/build911a_packages.xml"/>
- <channel name="selections" file="build911/build911a_selections.xml"/>
- <locale name="de"/>
- <locale name="de_DE"/>
- <arch name="x86_64"/>
-</setup>
-<trial>
- <install channel="selections" kind="selection" name="default"/>
- <freshen/>
-</trial>
-</test>
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zypp-0.0.0/zypp/Url.cc new/zypp-0.0.0/zypp/Url.cc
--- old/zypp-0.0.0/zypp/Url.cc 2006-03-23 16:31:59.000000000 +0100
+++ new/zypp-0.0.0/zypp/Url.cc 2006-04-11 20:11:55.000000000 +0200
@@ -202,9 +202,11 @@
addUrlByScheme("nfs", ref);
addUrlByScheme("smb", ref);
addUrlByScheme("cifs", ref);
- addUrlByScheme("ftp", ref);
addUrlByScheme("http", ref);
addUrlByScheme("https", ref);
+ ref->config("path_encode_slash2", "y"); // always encode 2. slash
+ addUrlByScheme("ftp", ref);
+ addUrlByScheme("sftp", ref);
}
bool
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zypp-0.0.0/zypp/url/UrlBase.cc new/zypp-0.0.0/zypp/url/UrlBase.cc
--- old/zypp-0.0.0/zypp/url/UrlBase.cc 2006-04-04 12:37:32.000000000 +0200
+++ new/zypp-0.0.0/zypp/url/UrlBase.cc 2006-04-11 20:11:55.000000000 +0200
@@ -254,6 +254,10 @@
config("require_host", "n");
config("require_pathname","n");
+ // y=yes (encode 2. slash even if authority present)
+ // n=no (don't encode 2. slash if authority present)
+ config("path_encode_slash2", "n");
+
config("rx_username", "^([a-zA-Z0-9!$&'\\(\\)*+=,;~\\._-]|%[a-fA-F0-9]{2})+$");
config("rx_password", "^([a-zA-Z0-9!$&'\\(\\)*+=,:;~\\._-]|%[a-fA-F0-9]{2})+$");
@@ -486,10 +490,15 @@
tmp.pathname = getPathName(zypp::url::E_ENCODED);
if( !tmp.pathname.empty())
{
- if(url.find("/") != std::string::npos &&
- tmp.pathname.at(0) != '/')
+ if(url.find("/") != std::string::npos)
{
- url += "/";
+ // Url contains authority (that may be empty),
+ // we may need a rewrite of the encoded path.
+ tmp.pathname = cleanupPathName(tmp.pathname, true);
+ if(tmp.pathname.at(0) != '/')
+ {
+ url += "/";
+ }
}
url += tmp.pathname;
@@ -659,7 +668,7 @@
if(eflag == zypp::url::E_DECODED)
return zypp::url::decode(m_data->pathname);
else
- return m_data->pathname;
+ return cleanupPathName(m_data->pathname);
}
@@ -1225,23 +1234,59 @@
// ---------------------------------------------------------------
std::string
- UrlBase::cleanupPathName(const std::string &path)
+ UrlBase::cleanupPathName(const std::string &path) const
+ {
+ bool authority = !getHost(zypp::url::E_ENCODED).empty();
+ return cleanupPathName(path, authority);
+ }
+
+ // ---------------------------------------------------------------
+ std::string
+ UrlBase::cleanupPathName(const std::string &path, bool authority) const
{
std::string copy( path);
- if( copy.size() >= 3 && str::toLower(copy.substr(0, 3)) == "%2f")
+ // decode the first slash if it is encoded ...
+ if(copy.size() >= 3 && copy.at(0) != '/' &&
+ str::toLower(copy.substr(0, 3)) == "%2f")
{
- // decode the first slash if it is encoded ...
copy.replace(0, 3, "/");
}
- if( copy.size() >= 2 && copy.at(0) == '/' && copy.at(1) == '/')
+ // if path begins with a double slash ("//"); encode the second
+ // slash [minimal and IMO sufficient] before the first path
+ // segment, to fulfill the path-absolute rule of RFC 3986
+ // disallowing a "//" if no authority is present.
+ if( authority)
+ {
+ //
+ // rewrite of "//" to "/%2f" not required, use config
+ //
+ if(config("path_encode_slash2") == "y")
+ {
+ // rewrite "//" ==> "/%2f"
+ if(copy.size() >= 2 && copy.at(0) == '/' && copy.at(1) == '/')
+ {
+ copy.replace(1, 1, "%2F");
+ }
+ }
+ else
+ {
+ // rewrite "/%2f" ==> "//"
+ if(copy.size() >= 4 && copy.at(0) == '/' &&
+ str::toLower(copy.substr(1, 4)) == "%2f")
+ {
+ copy.replace(1, 4, "/");
+ }
+ }
+ }
+ else
{
- // path begins with a double slash ("//"); encode the second
- // [minimal and IMO sufficient] slash before the first path
- // segment, to fulfill the path-absolute rule of RFC 3986
- // disallowing a "//" if no authority is present.
- copy.replace(1, 1, "%2F");
+ // rewrite of "//" to "/%2f" is required (no authority)
+ if(copy.size() >= 2 && copy.at(0) == '/' && copy.at(1) == '/')
+ {
+ copy.replace(1, 1, "%2F");
+ }
}
return copy;
}
@@ -1249,7 +1294,7 @@
// ---------------------------------------------------------------
bool
- UrlBase::isValidHost(const std::string &host)
+ UrlBase::isValidHost(const std::string &host) const
{
try
{
@@ -1278,7 +1323,7 @@
// ---------------------------------------------------------------
bool
- UrlBase::isValidPort(const std::string &port)
+ UrlBase::isValidPort(const std::string &port) const
{
try
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/zypp-0.0.0/zypp/url/UrlBase.h new/zypp-0.0.0/zypp/url/UrlBase.h
--- old/zypp-0.0.0/zypp/url/UrlBase.h 2006-04-04 12:37:32.000000000 +0200
+++ new/zypp-0.0.0/zypp/url/UrlBase.h 2006-04-11 20:11:55.000000000 +0200
@@ -1003,15 +1003,31 @@
*
* It is not required if there is an authority ("//" behind
* the "scheme:"), that is in the path-abempty rule, but it
- * is allowed and used e.g. in ftp url's defined by RFC1738.
+ * is used e.g. in ftp url's defined by RFC1738.
+ *
+ * We apply this operation in both cases (for all paths),
+ * but if \p authority is true, the encoding of the second
+ * slash depends on the schema configuration (for ftp only).
*
- * We apply this operation in both cases (for all paths).
+ * \param path The encoded path name to cleanup.
+ * \param authority Whether the url contains authority or not.
+ * \return A modified encoded path.
+ */
+ virtual std::string
+ cleanupPathName(const std::string &path, bool authority) const;
+
+ /**
+ * Utility method to cleanup an encoded path name.
+ *
+ * This variant of the method checks if the host component
+ * in the url is empty or not to differentiate if there is
+ * an authority.
*
- * \param path The encoded path name to cleanup.
+ * \param path The encoded path name to cleanup.
* \return A modified encoded path.
*/
virtual std::string
- cleanupPathName(const std::string &path);
+ cleanupPathName(const std::string &path) const;
/**
* \brief Verifies specified host or IP.
@@ -1035,7 +1051,7 @@
* \return True, if host seems to be valid.
*/
virtual bool
- isValidHost(const std::string &host);
+ isValidHost(const std::string &host) const;
/**
* \brief Verifies specified port number.
@@ -1044,7 +1060,7 @@
* \return True, if port number is valid.
*/
virtual bool
- isValidPort(const std::string &port);
+ isValidPort(const std::string &port) const;
private:
UrlBaseData *m_data;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...