termux-packages/packages/apt/0012-termux-id.patch
Leonid Pliushch fd66e2fe29
get rid of verify-prefix.patch.txt
Switching to a more "soft" solution which will be focused on apt only.

Apt will now send an application package name (com.termux) and prefix
(/data/data/com.termux/files/usr) as part of user-agent string. That
will allow to distinguish real Termux users from parties which download
our packages and binary-patching them for the custom prefix.

Note that this will disable user's possibility to set custom User-Agent
for apt.
2020-12-24 16:42:32 +02:00

23 lines
1.0 KiB
Diff

diff -uNr apt-2.1.14/methods/http.cc apt-2.1.14.mod/methods/http.cc
--- apt-2.1.14/methods/http.cc 2020-12-15 15:07:36.000000000 +0200
+++ apt-2.1.14.mod/methods/http.cc 2020-12-24 16:23:15.722168489 +0200
@@ -341,7 +341,7 @@
Req << "Proxy-Authorization: Basic "
<< Base64Encode(Proxy.User + ":" + Proxy.Password) << "\r\n";
- Req << "User-Agent: " << Owner->ConfigFind("User-Agent", "Debian APT-HTTP/1.3 (" PACKAGE_VERSION ")") << "\r\n";
+ Req << "User-Agent: Debian APT-HTTP/1.3 (" PACKAGE_VERSION ") Termux (@TERMUX_APP_PACKAGE@; install-prefix:@TERMUX_PREFIX@)" << "\r\n";
Req << "\r\n";
@@ -955,8 +955,7 @@
Req << "Authorization: Basic "
<< Base64Encode(Uri.User + ":" + Uri.Password) << "\r\n";
- Req << "User-Agent: " << ConfigFind("User-Agent",
- "Debian APT-HTTP/1.3 (" PACKAGE_VERSION ")");
+ Req << "User-Agent: Debian APT-HTTP/1.3 (" PACKAGE_VERSION ") Termux (@TERMUX_APP_PACKAGE@; install-prefix:@TERMUX_PREFIX@)";
#ifdef HAVE_SYSTEMD
if (ConfigFindB("User-Agent-Non-Interactive", false))