termux-packages/packages/apt/0005-http2-fix.patch
Leonid Pliushch 7e6a37fe9a apt: update patches
Reorganize patches for better understanding and ensure they are applied in
expected order.

Another changes:

 * gnupg is now in recommends (used by apt-key).

 * x11-repo is now in suggests.

 * TCSAFLUSH patch is dropped because it is covered by one of NDK patches
   where TCSAFLUSH value is replaced with TCSANOW.
2019-11-13 14:43:04 +02:00

26 lines
886 B
Diff

diff -uNr apt-1.4.9/methods/basehttp.cc apt-1.4.9.mod/methods/basehttp.cc
--- apt-1.4.9/methods/basehttp.cc 2019-01-18 12:42:07.000000000 +0200
+++ apt-1.4.9.mod/methods/basehttp.cc 2019-11-12 22:43:18.109996205 +0200
@@ -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
{