debbisect: handle non-absolute Location headers
snapshot.d.o sometimes returns location headers that aren't absolute:
$ cat ~/example.txt
$ curl --head http://snapshot.debian.org/archive/debian/20240525T055828Z/
HTTP/1.1 302 FOUND
Date: Tue, 27 Aug 2024 22:41:41 GMT
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Permissions-Policy: interest-cohort=()
Content-Length: 253
Location: /archive/debian/20240525T031625Z/
Cache-Control: max-age=600, public
Expires: Tue, 27 Aug 2024 22:51:41 GMT
X-Clacks-Overhead: GNU Terry Pratchett
Content-Type: text/html; charset=utf-8
X-Varnish: 18921807 18775977
Age: 453
Via: 1.1 varnish (Varnish/7.1)
connection: close
$ curl --head http://snapshot.debian.org/archive/debian/20240525T055828Z/
HTTP/1.1 302 FOUND
Date: Tue, 27 Aug 2024 22:48:52 GMT
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Permissions-Policy: interest-cohort=()
Content-Length: 273
Location: http://snapshot.debian.org/archive/debian/20240525T031625Z/
Cache-Control: max-age=600, public
Expires: Tue, 27 Aug 2024 22:58:52 GMT
X-Clacks-Overhead: GNU Terry Pratchett
Content-Type: text/html; charset=utf-8
X-Varnish: 82071043 88047937
Age: 12
Via: 1.1 varnish (Varnish/6.5)
connection: close
This can result in debbisect failing early with a somewhat unclear assertion failure:
Traceback (most recent call last):
File "/usr/bin/debbisect", line 1229, in <module>
main()
File "/usr/bin/debbisect", line 1216, in main
res = bisect(good, bad, staticargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/debbisect", line 549, in bisect
newts = sanitize_timestamp(good + diff / 2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/bin/debbisect", line 124, in sanitize_timestamp
assert location.startswith(prefix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError
This fixes the issue by handling both kinds of Location headers.
Signed-off-by: Mike Gerow gerow@mgerow.com