This commit is contained in:
parent
8b948ed289
commit
51a2c6e33b
113
bnc-439532.diff
Normal file
113
bnc-439532.diff
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
--- zypp/media/MediaCurl.cc 2008-10-28 21:55:46.000000000 +0100
|
||||||
|
+++ /space/git/suse/zypp/libzypp/zypp/media/MediaCurl.cc 2008-10-28 17:31:05.000000000 +0100
|
||||||
|
@@ -185,7 +185,7 @@
|
||||||
|
|
||||||
|
Pathname MediaCurl::_cookieFile = "/var/lib/YaST2/cookies";
|
||||||
|
|
||||||
|
-const char *const MediaCurl::anonymousIdHeader()
|
||||||
|
+static const char *const anonymousIdHeader()
|
||||||
|
{
|
||||||
|
// we need to add the release and identifier to the
|
||||||
|
// agent string.
|
||||||
|
@@ -203,14 +203,14 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string _value(
|
||||||
|
- str::form(
|
||||||
|
- "X-ZYpp-AnonymousUniqueId: %s",
|
||||||
|
- target ? target->anonymousUniqueId().c_str() : "" )
|
||||||
|
+ str::trim( str::form(
|
||||||
|
+ "X-ZYpp-AnonymousId: %s",
|
||||||
|
+ target ? target->anonymousUniqueId().c_str() : "" ) )
|
||||||
|
);
|
||||||
|
return _value.c_str();
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-const char *const MediaCurl::agentString()
|
||||||
|
+
|
||||||
|
+static const char *const agentString()
|
||||||
|
{
|
||||||
|
// we need to add the release and identifier to the
|
||||||
|
// agent string.
|
||||||
|
@@ -244,7 +244,8 @@
|
||||||
|
: MediaHandler( url_r, attach_point_hint_r,
|
||||||
|
"/", // urlpath at attachpoint
|
||||||
|
true ), // does_download
|
||||||
|
- _curl( NULL )
|
||||||
|
+ _curl( NULL ),
|
||||||
|
+ _customHeaders(0L)
|
||||||
|
{
|
||||||
|
_curlError[0] = '\0';
|
||||||
|
_curlDebug = 0L;
|
||||||
|
@@ -491,18 +492,7 @@
|
||||||
|
disconnectFrom();
|
||||||
|
ZYPP_THROW(MediaCurlSetOptException(_url, _curlError));
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- // now add the anonymous id header
|
||||||
|
- curl_slist *chunk = NULL;
|
||||||
|
- chunk = curl_slist_append(chunk, anonymousIdHeader());
|
||||||
|
- ret = curl_easy_setopt ( _curl, CURLOPT_HTTPHEADER, chunk );
|
||||||
|
- curl_slist_free_all(chunk);
|
||||||
|
|
||||||
|
- if ( ret != 0) {
|
||||||
|
- disconnectFrom();
|
||||||
|
- ZYPP_THROW(MediaCurlSetOptException(_url, _curlError));
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -714,6 +704,15 @@
|
||||||
|
ZYPP_THROW(MediaCurlSetOptException(_url, _curlError));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // now add the anonymous id header
|
||||||
|
+ _customHeaders = curl_slist_append(_customHeaders, anonymousIdHeader());
|
||||||
|
+
|
||||||
|
+ ret = curl_easy_setopt ( _curl, CURLOPT_HTTPHEADER, _customHeaders );
|
||||||
|
+
|
||||||
|
+ if ( ret != 0) {
|
||||||
|
+ disconnectFrom();
|
||||||
|
+ ZYPP_THROW(MediaCurlSetOptException(_url, _curlError));
|
||||||
|
+ }
|
||||||
|
|
||||||
|
// FIXME: need a derived class to propelly compare url's
|
||||||
|
MediaSourceRef media( new MediaSource(_url.getScheme(), _url.asString()));
|
||||||
|
@@ -734,6 +733,12 @@
|
||||||
|
//
|
||||||
|
void MediaCurl::disconnectFrom()
|
||||||
|
{
|
||||||
|
+ if ( _customHeaders )
|
||||||
|
+ {
|
||||||
|
+ curl_slist_free_all(_customHeaders);
|
||||||
|
+ _customHeaders = 0L;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if ( _curl )
|
||||||
|
{
|
||||||
|
curl_easy_cleanup( _curl );
|
||||||
|
--- zypp/media/MediaCurl.h 2008-10-28 21:55:46.000000000 +0100
|
||||||
|
+++ /space/git/suse/zypp/libzypp/zypp/media/MediaCurl.h 2008-10-28 17:31:05.000000000 +0100
|
||||||
|
@@ -94,13 +94,6 @@
|
||||||
|
|
||||||
|
static int progressCallback( void *clientp, double dltotal, double dlnow,
|
||||||
|
double ultotal, double ulnow );
|
||||||
|
-
|
||||||
|
- /** The user agent string */
|
||||||
|
- static const char *const agentString();
|
||||||
|
-
|
||||||
|
- /** anonymous id header used to count unique users */
|
||||||
|
- static const char *const anonymousIdHeader();
|
||||||
|
-
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Return a comma separated list of available authentication methods
|
||||||
|
@@ -114,6 +107,7 @@
|
||||||
|
CURL *_curl;
|
||||||
|
char _curlError[ CURL_ERROR_SIZE ];
|
||||||
|
long _curlDebug;
|
||||||
|
+ curl_slist *_customHeaders;
|
||||||
|
|
||||||
|
mutable std::string _userpwd;
|
||||||
|
std::string _proxy;
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Oct 28 22:01:40 CET 2008 - dmacvicar@suse.de
|
||||||
|
|
||||||
|
- don't free the header before curl_perform as curl does not
|
||||||
|
copy it. (bnc#439532)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Oct 26 14:53:56 CET 2008 - coolo@suse.de
|
Sun Oct 26 14:53:56 CET 2008 - coolo@suse.de
|
||||||
|
|
||||||
|
@ -25,10 +25,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|||||||
AutoReqProv: on
|
AutoReqProv: on
|
||||||
Summary: Package, Patch, Pattern, and Product Management
|
Summary: Package, Patch, Pattern, and Product Management
|
||||||
Version: 5.19.0
|
Version: 5.19.0
|
||||||
Release: 2
|
Release: 3
|
||||||
Source: libzypp-5.19.0.tar.bz2
|
Source: libzypp-5.19.0.tar.bz2
|
||||||
Source1: libzypp-rpmlintrc
|
Source1: libzypp-rpmlintrc
|
||||||
Patch0: r11488.diff
|
Patch0: r11488.diff
|
||||||
|
Patch1: bnc-439532.diff
|
||||||
Prefix: /usr
|
Prefix: /usr
|
||||||
Provides: yast2-packagemanager
|
Provides: yast2-packagemanager
|
||||||
Obsoletes: yast2-packagemanager
|
Obsoletes: yast2-packagemanager
|
||||||
@ -98,6 +99,7 @@ Authors:
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p0
|
%patch0 -p0
|
||||||
|
%patch1 -p0
|
||||||
|
|
||||||
%build
|
%build
|
||||||
mkdir build
|
mkdir build
|
||||||
@ -230,6 +232,9 @@ rm -rf "$RPM_BUILD_ROOT"
|
|||||||
%{_libdir}/pkgconfig/libzypp.pc
|
%{_libdir}/pkgconfig/libzypp.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 28 2008 dmacvicar@suse.de
|
||||||
|
- don't free the header before curl_perform as curl does not
|
||||||
|
copy it. (bnc#439532)
|
||||||
* Sun Oct 26 2008 coolo@suse.de
|
* Sun Oct 26 2008 coolo@suse.de
|
||||||
- adding svn r11488 to fix compile of PackageKit
|
- adding svn r11488 to fix compile of PackageKit
|
||||||
* Fri Oct 24 2008 ma@suse.de
|
* Fri Oct 24 2008 ma@suse.de
|
||||||
|
Loading…
Reference in New Issue
Block a user