diff options
author | George Hazan <ghazan@miranda.im> | 2019-08-26 14:57:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-08-26 14:57:51 +0300 |
commit | 93a09024ab433c866e87c5a6e33f982d7e8e32ab (patch) | |
tree | 13f86c292e2f4a628834a55466e27993ca99864a /src/mir_app | |
parent | cb2efce1a4fe9c89c5fef63b3aca63f3e63983fc (diff) |
unified fake User-Agent field generation for all http-related protocols
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/netlib.cpp | 13 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index b44be34fa0..7f11bd20b9 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -273,6 +273,7 @@ Miranda_OkToExit @344 Miranda_GetVersion @345
Miranda_GetFileVersion @346
Miranda_GetVersionText @347
+Netlib_GetUserAgent @348
Netlib_CloseHandle @349
Netlib_Recv @350
Netlib_Send @351
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a41e448502..375f32fc0c 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -273,6 +273,7 @@ Miranda_OkToExit @344 Miranda_GetVersion @345
Miranda_GetFileVersion @346
Miranda_GetVersionText @347
+Netlib_GetUserAgent @348
Netlib_CloseHandle @349
Netlib_Recv @350
Netlib_Send @351
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index 287bd4f194..8dee6ff88f 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -31,6 +31,7 @@ HANDLE hConnectionHeaderMutex, hConnectionOpenMutex, hEventConnected = NULL, hEv DWORD g_LastConnectionTick;
int connectionTimeout;
HANDLE hSendEvent = nullptr, hRecvEvent = nullptr;
+static char szUserAgent[100];
typedef BOOL(WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD);
@@ -388,6 +389,13 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_GetConnNlu(HANDLE hConn) /////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(char*) Netlib_GetUserAgent()
+{
+ return szUserAgent;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(void) Netlib_Shutdown(HNETLIBCONN h)
{
if (h) {
@@ -491,6 +499,11 @@ int LoadNetlibModule(void) }
}
+ #define FAKE_VER "68.0.1"
+ char osVer[100];
+ OS_GetShortString(osVer, _countof(osVer));
+ mir_snprintf(szUserAgent, "Mozilla/5.0 (%s; rv:%s) Gecko/20100101 Firefox/%s", osVer, FAKE_VER, FAKE_VER);
+
hConnectionOpenMutex = connectionTimeout ? CreateMutex(nullptr, FALSE, nullptr) : nullptr;
g_LastConnectionTick = GetTickCount();
|