libzypp  17.8.0
MediaCurl.cc File Reference
#include <iostream>
#include <list>
#include "zypp/base/Logger.h"
#include "zypp/ExternalProgram.h"
#include "zypp/base/String.h"
#include "zypp/base/Gettext.h"
#include "zypp/base/Sysconfig.h"
#include "zypp/media/MediaCurl.h"
#include "zypp/media/ProxyInfo.h"
#include "zypp/media/MediaUserAuth.h"
#include "zypp/media/CredentialManager.h"
#include "zypp/media/CurlConfig.h"
#include "zypp/thread/Once.h"
#include "zypp/Target.h"
#include "zypp/ZYppFactory.h"
#include "zypp/ZConfig.h"
#include <cstdlib>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <errno.h>
#include <dirent.h>
#include <unistd.h>
Include dependency graph for MediaCurl.cc:

Go to the source code of this file.

Namespaces

 zypp
 Easy-to use interface to the ZYPP dependency resolver.
 
 zypp::env
 
 zypp::media
 

Macros

#define DETECT_DIR_INDEX   0
 
#define CONNECT_TIMEOUT   60
 
#define TRANSFER_TIMEOUT_MAX   60 * 60
 
#define EXPLICITLY_NO_PROXY   "_none_"
 
#define CURLVERSION_AT_LEAST(M, N, O)   LIBCURL_VERSION_NUM >= ((((M)<<8)+(N))<<8)+(O)
 
#define SET_OPTION(opt, val)
 
#define SET_OPTION_OFFT(opt, val)   SET_OPTION(opt,(curl_off_t)val)
 
#define SET_OPTION_LONG(opt, val)   SET_OPTION(opt,(long)val)
 
#define SET_OPTION_VOID(opt, val)   SET_OPTION(opt,(void*)val)
 

Functions

int zypp::env::ZYPP_MEDIA_CURL_IPRESOLVE ()
 
void zypp::media::fillSettingsFromUrl (const Url &url, TransferSettings &s)
 Fills the settings structure using options passed on the url for example ?timeout=x&proxy=foo. More...
 
void zypp::media::fillSettingsSystemProxy (const Url &url, TransferSettings &s)
 Reads the system proxy configuration and fills the settings structure proxy information. More...
 
static const char *const zypp::media::anonymousIdHeader ()
 initialized only once, this gets the anonymous id from the target, which we pass in the http header More...
 
static const char *const zypp::media::distributionFlavorHeader ()
 initialized only once, this gets the distribution flavor from the target, which we pass in the http header More...
 
static const char *const zypp::media::agentString ()
 initialized only once, this gets the agent string which also includes the curl version More...
 

Macro Definition Documentation

◆ DETECT_DIR_INDEX

#define DETECT_DIR_INDEX   0

Definition at line 41 of file MediaCurl.cc.

◆ CONNECT_TIMEOUT

#define CONNECT_TIMEOUT   60

Definition at line 42 of file MediaCurl.cc.

◆ TRANSFER_TIMEOUT_MAX

#define TRANSFER_TIMEOUT_MAX   60 * 60

Definition at line 43 of file MediaCurl.cc.

◆ EXPLICITLY_NO_PROXY

#define EXPLICITLY_NO_PROXY   "_none_"

Definition at line 45 of file MediaCurl.cc.

◆ CURLVERSION_AT_LEAST

#define CURLVERSION_AT_LEAST (   M,
  N,
 
)    LIBCURL_VERSION_NUM >= ((((M)<<8)+(N))<<8)+(O)

Definition at line 48 of file MediaCurl.cc.

◆ SET_OPTION

#define SET_OPTION (   opt,
  val 
)
Value:
do { \
ret = curl_easy_setopt ( _curl, opt, val ); \
if ( ret != 0) { \
ZYPP_THROW(MediaCurlSetOptException(_url, _curlError)); \
} \
} while ( false )
Todo:
deprecate SET_OPTION and use the typed versions below.

Definition at line 546 of file MediaCurl.cc.

◆ SET_OPTION_OFFT

#define SET_OPTION_OFFT (   opt,
  val 
)    SET_OPTION(opt,(curl_off_t)val)

Definition at line 553 of file MediaCurl.cc.

◆ SET_OPTION_LONG

#define SET_OPTION_LONG (   opt,
  val 
)    SET_OPTION(opt,(long)val)

Definition at line 554 of file MediaCurl.cc.

◆ SET_OPTION_VOID

#define SET_OPTION_VOID (   opt,
  val 
)    SET_OPTION(opt,(void*)val)

Definition at line 555 of file MediaCurl.cc.

Variable Documentation

◆ curl

CURL* curl

Definition at line 198 of file MediaCurl.cc.

◆ url

Url url

Definition at line 199 of file MediaCurl.cc.

◆ timeout

time_t timeout

Definition at line 200 of file MediaCurl.cc.

◆ reached

bool reached

Definition at line 201 of file MediaCurl.cc.

◆ fileSizeExceeded

bool fileSizeExceeded

Definition at line 202 of file MediaCurl.cc.

◆ report

callback::SendReport<DownloadProgressReport>* report

Definition at line 203 of file MediaCurl.cc.

◆ _expectedFileSize

ByteCount _expectedFileSize

Definition at line 204 of file MediaCurl.cc.

◆ _timeStart

time_t _timeStart = 0

Start total stats.

Definition at line 206 of file MediaCurl.cc.

◆ _timeLast

time_t _timeLast = 0

Start last period(~1sec)

Definition at line 207 of file MediaCurl.cc.

◆ _timeRcv

time_t _timeRcv = 0

Start of no-data timeout.

Definition at line 208 of file MediaCurl.cc.

◆ _timeNow

time_t _timeNow = 0

Now.

Definition at line 209 of file MediaCurl.cc.

◆ _dnlTotal

double _dnlTotal = 0.0

Bytes to download or 0 if unknown.

Definition at line 211 of file MediaCurl.cc.

◆ _dnlLast

double _dnlLast = 0.0

Bytes downloaded at period start.

Definition at line 212 of file MediaCurl.cc.

◆ _dnlNow

double _dnlNow = 0.0

Bytes downloaded now.

Definition at line 213 of file MediaCurl.cc.

◆ _dnlPercent

int _dnlPercent = 0

Percent completed or 0 if _dnlTotal is unknown.

Definition at line 215 of file MediaCurl.cc.

◆ _drateTotal

double _drateTotal = 0.0

Download rate so far.

Definition at line 217 of file MediaCurl.cc.

◆ _drateLast

double _drateLast = 0.0

Download rate in last period.

Definition at line 218 of file MediaCurl.cc.

◆ drate_period

double drate_period

Definition at line 282 of file MediaCurl.cc.

◆ dload_period

double dload_period

Definition at line 284 of file MediaCurl.cc.

◆ secs

long secs

Definition at line 286 of file MediaCurl.cc.

◆ drate_avg

double drate_avg

Definition at line 288 of file MediaCurl.cc.

◆ ltime

time_t ltime

Definition at line 290 of file MediaCurl.cc.

◆ dload

double dload

Definition at line 292 of file MediaCurl.cc.

◆ uload

double uload

Definition at line 294 of file MediaCurl.cc.