Package: dput Version: 1.0.3 Severity: normal Tags: patch Using dput to an HTTP host that expects Basic authentication ("hsg" in the config below) results in the following stack trace:
Uploading to hsg (via http to localhost:8123): Uploading thequux-apt-config_2019.11.02.dsc: need authentication. Traceback (most recent call last): File "/usr/bin/dput", line 11, in <module> load_entry_point('dput==1.0.3', 'console_scripts', 'execute-dput')() File "/usr/share/dput/dput/dput.py", line 1156, in main files_to_upload, debug, 0, progress=progress) File "/usr/share/dput/dput/methods/http.py", line 154, in upload url, res.msg, pwman).get_auth_headers() File "/usr/share/dput/dput/methods/http.py", line 82, in get_auth_headers ah.http_error_401(self, None, 401, None, self.resp_headers) File "/usr/lib/python3.7/urllib/request.py", line 1025, in http_error_401 url = req.full_url AttributeError: 'AuthHandlerHackAround' object has no attribute 'full_url' I would have expected this to prompt me for a password and then proceed to upload the package. The attached patch seems to fix the problem, but it has not been thoroughly tested (only a quick trial). -- Package-specific info: -- /etc/dput.cf -- # Example dput.cf that defines the host that can be used # with dput for uploading. [DEFAULT] login = * method = ftp hash = md5 allow_unsigned_uploads = 0 allow_dcut = 0 run_lintian = 0 run_dinstall = 0 check_version = 0 scp_compress = 0 post_upload_command = pre_upload_command = passive_ftp = 1 default_host_main = allowed_distributions = (?!UNRELEASED) [ftp-master] fqdn = ftp.upload.debian.org incoming = /pub/UploadQueue/ login = anonymous allow_dcut = 1 method = ftp # Please, upload your package to the proper archive # https://www.debian.org/doc/manuals/developers-reference/pkgs.html#bug-security-upload allowed_distributions = (?!UNRELEASED|.*-security) # https://lists.debian.org/debian-project/2009/05/msg00036.html [ftp-eu] fqdn = ftp.eu.upload.debian.org method = ftp incoming = /pub/UploadQueue/ login = anonymous allow_dcut = 1 # Please, upload your package to the proper archive # https://www.debian.org/doc/manuals/developers-reference/pkgs.html#bug-security-upload allowed_distributions = (?!UNRELEASED|.*-security) # https://lists.debian.org/debian-devel-announce/2008/09/msg00007.html [ssh-upload] login = * # login = another_username fqdn = ssh.upload.debian.org method = scp incoming = /srv/upload.debian.org/UploadQueue/ allow_dcut = 1 # Please, upload your package to the proper archive # https://www.debian.org/doc/manuals/developers-reference/pkgs.html#bug-security-upload allowed_distributions = (?!UNRELEASED|.*-security) # And if you want to override one of the defaults, add it here. # For example, comment out the next line # post_upload_command = /path/to/some/script # pre_upload_command = /path/to/some/script [security-master] fqdn = ftp.security.upload.debian.org method = ftp incoming = /pub/SecurityUploadQueue login = anonymous allow_dcut = 1 # This has been added at the request of the security team. # Please be sure to know what you are doing before taking it out. pre_upload_command = /usr/share/dput/helper/security-warning [security-master-unembargoed] fqdn = ftp.security.upload.debian.org method = ftp incoming = /pub/OpenSecurityUploadQueue login = anonymous allow_dcut = 1 # This has been added at the request of the security team. # Please be sure to know what you are doing before taking it out. pre_upload_command = /usr/share/dput/helper/security-warning [ubuntu] fqdn = upload.ubuntu.com method = ftp incoming = / login = anonymous [ppa] fqdn = ppa.launchpad.net method = ftp # replace <launchpad-id> with your Launchpad ID incoming = ~<launchpad-id>/ubuntu login = anonymous [mentors] method = ftp fqdn = mentors.debian.net incoming = /pub/UploadQueue login = anonymous [local] method = local incoming = ~/public_html/debian/mini-dinstall/incoming run_dinstall = 0 post_upload_command = /usr/bin/mini-dinstall --batch # Local variables: # coding: utf-8 # mode: conf # End: # vim: fileencoding=utf-8 filetype=config : -- /home/thequux/.dput.cf -- [hsg] fqdn = localhost:8123 method = http login = thequux incoming = /incoming # distributions = hsg [DEFAULT] login = * method = ftp hash = md5 allow_unsigned_uploads = 0 allow_dcut = 0 distributions = allowed_distributions = (?!UNRELEASED) run_lintian = 0 run_dinstall = 0 check_version = 0 scp_compress = 0 default_host_main = post_upload_command = pre_upload_command = ssh_config_options = passive_ftp = 1 progress_indicator = 0 delayed = [ftp-master] fqdn = ftp.upload.debian.org incoming = /pub/UploadQueue/ login = anonymous allow_dcut = 1 method = ftp allowed_distributions = (?!UNRELEASED|.*-security) [ftp-eu] fqdn = ftp.eu.upload.debian.org method = ftp incoming = /pub/UploadQueue/ login = anonymous allow_dcut = 1 allowed_distributions = (?!UNRELEASED|.*-security) [ssh-upload] login = * fqdn = ssh.upload.debian.org method = scp incoming = /srv/upload.debian.org/UploadQueue/ allow_dcut = 1 allowed_distributions = (?!UNRELEASED|.*-security) [security-master] fqdn = ftp.security.upload.debian.org method = ftp incoming = /pub/SecurityUploadQueue login = anonymous allow_dcut = 1 pre_upload_command = /usr/share/dput/helper/security-warning [security-master-unembargoed] fqdn = ftp.security.upload.debian.org method = ftp incoming = /pub/OpenSecurityUploadQueue login = anonymous allow_dcut = 1 pre_upload_command = /usr/share/dput/helper/security-warning [ubuntu] fqdn = upload.ubuntu.com method = ftp incoming = / login = anonymous [ppa] fqdn = ppa.launchpad.net method = ftp incoming = ~<launchpad-id>/ubuntu login = anonymous [mentors] method = ftp fqdn = mentors.debian.net incoming = /pub/UploadQueue login = anonymous [local] method = local incoming = ~/public_html/debian/mini-dinstall/incoming run_dinstall = 0 post_upload_command = /usr/bin/mini-dinstall --batch fqdn = localhost [hsg] fqdn = localhost:8123 method = http login = thequux incoming = /incoming -- System Information: Debian Release: bullseye/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 5.3.0-1-amd64 (SMP w/8 CPU cores) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages dput depends on: ii python3 3.7.5-1 ii python3-debian 0.1.36 ii python3-gpg 1.13.1-1 ii python3-pkg-resources 41.4.0-1 dput recommends no packages. Versions of packages dput suggests: ii lintian 2.32.0 pn mini-dinstall <none> ii openssh-client 1:8.1p1-1 ii rsync 3.1.3-8 Versions of packages dput is related to: ii devscripts 2.19.7 ii gnupg 2.2.17-3 ii lintian 2.32.0 ii rsync 3.1.3-8 pn ssh <none> -- no debconf information
diff --git a/dput/methods/http.py b/dput/methods/http.py index ef966bc..d9e1e3a 100644 --- a/dput/methods/http.py +++ b/dput/methods/http.py @@ -50,6 +50,7 @@ class AuthHandlerHackAround: self.headers = {} # data self.url = url + self.full_url = url self.resp_headers = resp_headers self.authhandlers = [] self.timeout = {} @@ -68,6 +69,9 @@ class AuthHandlerHackAround: def add_unredirected_header(self, k, v): self.headers[k] = v + def get_header(self, k, default=None): + return self.headers.get(k, default) + def get_full_url(self): return self.url
signature.asc
Description: OpenPGP digital signature