diff --git a/VERSION.cmake b/VERSION.cmake index 1c558669..8ebe8b0f 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -1,3 +1,3 @@ SET(LIBREPO_MAJOR "1") -SET(LIBREPO_MINOR "17") -SET(LIBREPO_PATCH "2") +SET(LIBREPO_MINOR "18") +SET(LIBREPO_PATCH "0") diff --git a/librepo.spec b/librepo.spec index 3a5757fe..25dc741c 100644 --- a/librepo.spec +++ b/librepo.spec @@ -28,7 +28,7 @@ %global dnf_conflict 2.8.8 Name: librepo -Version: 1.17.2 +Version: 1.18.0 Release: 1%{?dist} Summary: Repodata downloading library diff --git a/librepo/handle.c b/librepo/handle.c index 27fcbbbd..eec674dc 100644 --- a/librepo/handle.c +++ b/librepo/handle.c @@ -407,6 +407,14 @@ lr_handle_setopt(LrHandle *handle, c_rc = curl_easy_setopt(c_h, CURLOPT_USERPWD, va_arg(arg, char *)); break; + case LRO_USERNAME: + c_rc = curl_easy_setopt(c_h, CURLOPT_USERNAME, va_arg(arg, char *)); + break; + + case LRO_PASSWORD: + c_rc = curl_easy_setopt(c_h, CURLOPT_PASSWORD, va_arg(arg, char *)); + break; + case LRO_PROXY: c_rc = curl_easy_setopt(c_h, CURLOPT_PROXY, va_arg(arg, char *)); break; diff --git a/librepo/handle.h.in b/librepo/handle.h.in index b3c19007..dc10b5a4 100644 --- a/librepo/handle.h.in +++ b/librepo/handle.h.in @@ -153,7 +153,10 @@ typedef enum { Use LRO_HTTPAUTHMETHODS */ LRO_USERPWD, /*!< (char *) - User and password for http authetification in format user:password */ + User and password for http authetification in format user:password. + The user and password strings are not URL decoded, so there is no way to send in + a username containing a colon using this option. The option is DEPRECATED! + Use LRO_USERNAME and LRO_PASSWORD */ LRO_PROXY, /*!< (char *) Address of proxy server eg. "proxy-host.com:8080" */ @@ -170,7 +173,9 @@ typedef enum { Use LRO_PROXYAUTHMETHODS */ LRO_PROXYUSERPWD, /*!< (char *) - User and password for proxy in format user:password */ + User and password for proxy in format user:password + Both the username and the password are URL decoded before use, so if the username + contains, for example, a colon, it should be encoded as %3A.*/ LRO_PROGRESSCB, /*!< (LrProgressCb) Progress callback */ @@ -429,6 +434,12 @@ typedef enum { Path to a file containing the list of PEM format trusted CA certificates. Used for proxy. */ + LRO_USERNAME, /*!< (char *) + User for http authetification */ + + LRO_PASSWORD, /*!< (char *) + Password for http authetification */ + LRO_SENTINEL, /*!< Sentinel */ } LrHandleOption; /*!< Handle config options */ diff --git a/librepo/python/__init__.py b/librepo/python/__init__.py index 118b9349..a005e703 100644 --- a/librepo/python/__init__.py +++ b/librepo/python/__init__.py @@ -90,6 +90,17 @@ *String or None*. Set username and password for HTTP authentication. Param must be in format 'username:password'. + The user and password strings are not URL decoded, so there is no way to send in + a username containing a colon using this option. The option is DEPRECATED! + Use LRO_USERNAME and LRO_PASSWORD. + +.. data:: LRO_USERNAME + + *String or None*. Set username for HTTP authentication. + +.. data:: LRO_PASSWORD + + *String or None*. Set password for HTTP authentication. .. data:: LRO_PROXY @@ -116,6 +127,8 @@ *String or None*. Set username and password for proxy authentication in format 'username:password'. + Both the username and the password are URL decoded before use, so if the username + contains, for example, a colon, it should be encoded as %3A. .. data:: LRO_PROGRESSCB @@ -1259,6 +1272,14 @@ class Handle(_librepo.Handle): See: :data:`.LRO_USERPWD` + .. attribute:: username: + + See: :data:`.LRO_USERNAME` + + .. attribute:: password: + + See: :data:`.LRO_PASSWORD` + .. attribute:: proxy: See: :data:`.LRO_PROXY` diff --git a/librepo/python/handle-py.c b/librepo/python/handle-py.c index 32bf4e19..ccc1ef42 100644 --- a/librepo/python/handle-py.c +++ b/librepo/python/handle-py.c @@ -293,6 +293,8 @@ py_setopt(_HandleObject *self, PyObject *args) case LRO_MIRRORLISTURL: case LRO_METALINKURL: case LRO_USERPWD: + case LRO_USERNAME: + case LRO_PASSWORD: case LRO_PROXY: case LRO_PROXYUSERPWD: case LRO_DESTDIR: diff --git a/librepo/python/librepomodule.c b/librepo/python/librepomodule.c index 3908bbc2..b7b1b593 100644 --- a/librepo/python/librepomodule.c +++ b/librepo/python/librepomodule.c @@ -238,6 +238,8 @@ PyInit__librepo(void) PYMODULE_ADDINTCONSTANT(LRO_LOCAL); PYMODULE_ADDINTCONSTANT(LRO_HTTPAUTH); PYMODULE_ADDINTCONSTANT(LRO_USERPWD); + PYMODULE_ADDINTCONSTANT(LRO_USERNAME); + PYMODULE_ADDINTCONSTANT(LRO_PASSWORD); PYMODULE_ADDINTCONSTANT(LRO_PROXY); PYMODULE_ADDINTCONSTANT(LRO_PROXYPORT); PYMODULE_ADDINTCONSTANT(LRO_PROXYTYPE);