static const std::string _value(
str::form(
- "X-ZYpp-AnonymousUniqueId: %s",
+ "X-Zypp-AnonymousId: %s",
target ? target->anonymousUniqueId().c_str() : "" )
);
return _value.c_str();
}
-
+
const char *const MediaAria2c::agentString()
{
// we need to add the release and identifier to the
}
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();
}
: MediaHandler( url_r, attach_point_hint_r,
"/", // urlpath at attachpoint
true ), // does_download
- _curl( NULL )
+ _curl( NULL ),
+ _customHeaders(0L)
{
_curlError[0] = '\0';
_curlDebug = 0L;
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));
- }
-
}
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()));
//
void MediaCurl::disconnectFrom()
{
+ if ( _customHeaders )
+ {
+ curl_slist_free_all(_customHeaders);
+ _customHeaders = 0L;
+ }
+
if ( _curl )
{
curl_easy_cleanup( _curl );