Turn off cookies when retrieving services repoindex.xml (bnc #573897)
authorMichael Andres <ma@suse.de>
Mon, 22 Feb 2010 12:08:24 +0000 (13:08 +0100)
committerMichael Andres <ma@suse.de>
Mon, 22 Feb 2010 12:08:24 +0000 (13:08 +0100)
zypp/RepoManager.cc
zypp/media/MediaCurl.cc
zypp/media/MediaManager.h

index 23b3da8..647da17 100644 (file)
@@ -1878,9 +1878,13 @@ namespace zypp
       }
     }
 
+    // repoindex.xml must be fetched always without using cookies (bnc #573897)
+    Url serviceUrl( service.url() );
+    serviceUrl.setQueryParam( "cookies", "0" );
+
     // download the repo index file
     media::MediaManager mediamanager;
-    media::MediaAccessId mid = mediamanager.open( service.url() );
+    media::MediaAccessId mid = mediamanager.open( serviceUrl );
     mediamanager.attach( mid );
     mediamanager.provideFile( mid, "repo/repoindex.xml" );
     Pathname path = mediamanager.localPath(mid, "repo/repoindex.xml" );
index 62f0c86..be10129 100644 (file)
@@ -642,7 +642,10 @@ void MediaCurl::attachTo (bool next)
    *---------------------------------------------------------------*/
 
   _currentCookieFile = _cookieFile.asString();
-  SET_OPTION(CURLOPT_COOKIEFILE, _currentCookieFile.c_str() );
+  if ( str::strToBool( _url.getQueryParam( "cookies" ), true ) )
+    SET_OPTION(CURLOPT_COOKIEFILE, _currentCookieFile.c_str() );
+  else
+    MIL << "No cookies requested" << endl;
   SET_OPTION(CURLOPT_COOKIEJAR, _currentCookieFile.c_str() );
   SET_OPTION(CURLOPT_PROGRESSFUNCTION, &progressCallback );
   SET_OPTION(CURLOPT_NOPROGRESS, false );
index c0c411e..0798eae 100644 (file)
@@ -379,6 +379,8 @@ namespace zypp
      *     "ftp://user:pass@server/%2fhome/user/path/to/media" -- both
      *     URLs points to the same directory on the server.
      *   - Query parameters:
+     *     - <tt>cookies</tt>:
+     *       Turn off using cookies by setting it to "0" (or false, no, off).
      *     - <tt>proxy</tt>:
      *       A proxy hostname or hostname and port separated by ':'.
      *     - <tt>proxyport</tt>: