Author: dmacvicar Date: Tue Oct 28 17:31:12 2008 New Revision: 11527 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11527&view=rev Log: - fix curl anonymous id header - rename the header name to make it a little bit shorter Modified: trunk/libzypp/zypp/media/MediaAria2c.cc trunk/libzypp/zypp/media/MediaCurl.cc trunk/libzypp/zypp/media/MediaCurl.h Modified: trunk/libzypp/zypp/media/MediaAria2c.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaAria2c.cc?rev=11527&r1=11526&r2=11527&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaAria2c.cc (original) +++ trunk/libzypp/zypp/media/MediaAria2c.cc Tue Oct 28 17:31:12 2008 @@ -98,12 +98,12 @@ 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 Modified: trunk/libzypp/zypp/media/MediaCurl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaCurl.cc?rev=11527&r1=11526&r2=11527&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaCurl.cc (original) +++ trunk/libzypp/zypp/media/MediaCurl.cc Tue Oct 28 17:31:12 2008 @@ -203,9 +203,9 @@ } 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(); } @@ -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,14 @@ 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 +732,12 @@ // void MediaCurl::disconnectFrom() { + if ( _customHeaders ) + { + curl_slist_free_all(_customHeaders); + _customHeaders = 0L; + } + if ( _curl ) { curl_easy_cleanup( _curl ); Modified: trunk/libzypp/zypp/media/MediaCurl.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/media/MediaCurl.h?rev=11527&r1=11526&r2=11527&view=diff ============================================================================== --- trunk/libzypp/zypp/media/MediaCurl.h (original) +++ trunk/libzypp/zypp/media/MediaCurl.h Tue Oct 28 17:31:12 2008 @@ -114,6 +114,7 @@ CURL *_curl; char _curlError[ CURL_ERROR_SIZE ]; long _curlDebug; + curl_slist *_customHeaders; mutable std::string _userpwd; std::string _proxy; -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org