apt: Fix HTTP/2 compatibility

Thanks its-pointless for finding the issue!
This commit is contained in:
Fredrik Fornwall 2018-12-30 23:12:46 +01:00
parent ae2bdf510a
commit a171cf132a
2 changed files with 26 additions and 1 deletions

View File

@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://packages.debian.org/apt
TERMUX_PKG_DESCRIPTION="Front-end for the dpkg package manager"
TERMUX_PKG_DEPENDS="libcurl, liblzma, dpkg, gpgv, libc++, termux-exec"
TERMUX_PKG_VERSION=1.4.8
TERMUX_PKG_REVISION=7
TERMUX_PKG_REVISION=8
TERMUX_PKG_SHA256=767ad7d6efb64cde52faececb7d3c0bf49800b9fe06f3a5b0132ab4c01a5b8f8
TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/a/apt/apt_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="

View File

@ -0,0 +1,25 @@
diff -u -r ../apt-1.4.8/methods/basehttp.cc ./methods/basehttp.cc
--- ../apt-1.4.8/methods/basehttp.cc 2017-09-13 16:47:33.000000000 +0000
+++ ./methods/basehttp.cc 2018-12-30 21:42:01.326143988 +0000
@@ -90,7 +90,12 @@
// Evil servers return no version
if (Line[4] == '/')
{
- int const elements = sscanf(Line.c_str(),"HTTP/%3u.%3u %3u%359[^\n]",&Major,&Minor,&Result,Code);
+ int elements = sscanf(Line.c_str(),"HTTP/%3u %3u[^\n]",&Major,&Result);
+ if (elements == 2 && Major == 2) {
+ Minor = 0;
+ Code[0] = '\0';
+ } else {
+ elements = sscanf(Line.c_str(),"HTTP/%3u.%3u %3u%359[^\n]",&Major,&Minor,&Result,Code);
if (elements == 3)
{
Code[0] = '\0';
@@ -99,6 +104,7 @@
}
else if (elements != 4)
return _error->Error(_("The HTTP server sent an invalid reply header"));
+ }
}
else
{