summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-30 08:46:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-30 08:46:22 +0000
commiteaa183e14a412210dac9320cdaa2114c555a24ac (patch)
treec69e683797fa80443a2c82b6df6335f452caa5b9
parentbd33df2d4b9534d2241283f2b20d83f5b1811ebc (diff)
Miranda HTTP user agent unification (not to have problems with sites)
git-svn-id: http://svn.miranda-ng.org/main/trunk@11955 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_netlib.h2
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp4
-rw-r--r--plugins/NewsAggregator/Src/Utils.cpp4
-rw-r--r--plugins/Non-IM Contact/src/http.cpp2
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp2
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp2
-rw-r--r--plugins/Quotes/src/HTTPSession.cpp2
-rw-r--r--plugins/SmileyAdd/src/download.cpp2
-rw-r--r--plugins/Weather/src/weather_http.cpp2
-rw-r--r--plugins/WebView/src/webview_getdata.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/libgadu/libgadu.h3
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.cpp2
-rw-r--r--protocols/MSN/src/msn_global.h2
-rw-r--r--protocols/Xfire/src/socket.cpp2
-rw-r--r--protocols/Yahoo/src/libyahoo2/yahoo_httplib.cpp9
-rw-r--r--protocols/Yahoo/src/proto.cpp2
-rw-r--r--protocols/Yahoo/src/yahoo.cpp4
18 files changed, 27 insertions, 23 deletions
diff --git a/include/m_netlib.h b/include/m_netlib.h
index 4e5475d9a9..54898493f3 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -43,6 +43,8 @@ typedef struct NETLIBHTTPREQUEST_tag NETLIBHTTPREQUEST;
struct NETLIBOPENCONNECTION_tag;
typedef struct NETLIBOPENCONNECTION_tag NETLIBOPENCONNECTION;
+#define NETLIB_USER_AGENT "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)"
+
//Initialises the netlib for a set of connections
//wParam = 0
//lParam = (LPARAM)(NETLIBUSER*)&nu
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index a64678f434..96423dbc33 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -352,7 +352,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent
cursor_ptr cursor(txn, m_dbEventsSort);
if (mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY) != MDB_SUCCESS)
return 0;
- if (mdb_cursor_get(cursor, &key, &data, MDB_NEXT_NODUP) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) != MDB_SUCCESS)
return 0;
DBEventSortingKey *pKey = (DBEventSortingKey*)key.mv_data;
@@ -376,7 +376,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent
cursor_ptr cursor(txn, m_dbEventsSort);
if (mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY) != MDB_SUCCESS)
return 0;
- if (mdb_cursor_get(cursor, &key, &data, MDB_PREV_NODUP) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
return 0;
DBEventSortingKey *pKey = (DBEventSortingKey*)key.mv_data;
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp
index 2f7ed8bafe..26d17c22a0 100644
--- a/plugins/NewsAggregator/Src/Utils.cpp
+++ b/plugins/NewsAggregator/Src/Utils.cpp
@@ -63,7 +63,7 @@ void GetNewsData(TCHAR *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg)
nlhr.headersCount = 4;
nlhr.headers = headers;
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ nlhr.headers[0].szValue = NETLIB_USER_AGENT;
nlhr.headers[1].szName = "Cache-Control";
nlhr.headers[1].szValue = "no-cache";
nlhr.headers[2].szName = "Pragma";
@@ -387,7 +387,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
nlhr.headersCount = 4;
nlhr.headers = headers;
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ nlhr.headers[0].szValue = NETLIB_USER_AGENT;
nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
nlhr.headers[2].szName = "Cache-Control";
diff --git a/plugins/Non-IM Contact/src/http.cpp b/plugins/Non-IM Contact/src/http.cpp
index 9ba9a80b6a..f67baf0391 100644
--- a/plugins/Non-IM Contact/src/http.cpp
+++ b/plugins/Non-IM Contact/src/http.cpp
@@ -45,7 +45,7 @@ int InternetDownloadFile (char *szUrl)
nlhr.headers=(NETLIBHTTPHEADER*)malloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
memcpy(nlhr.headers,nlhr.headers,sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
nlhr.headers[nlhr.headersCount-1].szName="User-Agent";
- nlhr.headers[nlhr.headersCount-1].szValue="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ nlhr.headers[nlhr.headersCount-1].szValue=NETLIB_USER_AGENT;
// download the page
NETLIBHTTPREQUEST *nlhrReply=(NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,(WPARAM)hNetlibUser,(LPARAM)&nlhr);
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index ef9ec95a38..9a898dd28c 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -120,7 +120,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
nlhr.headersCount = 4;
nlhr.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ nlhr.headers[0].szValue = NETLIB_USER_AGENT;
nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
nlhr.headers[2].szName = "Cache-Control";
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 3d5ad55bcc..897950ecc5 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -296,7 +296,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc)
nlhr.headersCount = 4;
nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ nlhr.headers[0].szValue = NETLIB_USER_AGENT;
nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
nlhr.headers[2].szName = "Cache-Control";
diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp
index 89fbd02cbb..f54a5cc69c 100644
--- a/plugins/Quotes/src/HTTPSession.cpp
+++ b/plugins/Quotes/src/HTTPSession.cpp
@@ -156,7 +156,7 @@ namespace
nlhr.headersCount = 4;
nlhr.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ nlhr.headers[0].szValue = NETLIB_USER_AGENT;
nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
nlhr.headers[2].szName = "Cache-Control";
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp
index 1f6d928d95..8ccde91d0b 100644
--- a/plugins/SmileyAdd/src/download.cpp
+++ b/plugins/SmileyAdd/src/download.cpp
@@ -54,7 +54,7 @@ bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl)
nlhr.headersCount = 2;
nlhr.headers=(NETLIBHTTPHEADER*)alloca(sizeof(NETLIBHTTPHEADER)*nlhr.headersCount);
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ nlhr.headers[0].szValue = NETLIB_USER_AGENT;
nlhr.headers[1].szName = "Connection";
nlhr.headers[1].szValue = "close";
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index 05547fd798..c59ee3bdfc 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -51,7 +51,7 @@ int findHeader(NETLIBHTTPREQUEST *nlhrReply, char *hdr)
int InternetDownloadFile (char *szUrl, char *cookie, char *userAgent, TCHAR **szData)
{
if (userAgent == NULL || userAgent[0] == 0)
- userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
+ userAgent = NETLIB_USER_AGENT;
NETLIBHTTPHEADER headers[5];
headers[0].szName = "User-Agent";
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp
index c53d01f15d..5563711733 100644
--- a/plugins/WebView/src/webview_getdata.cpp
+++ b/plugins/WebView/src/webview_getdata.cpp
@@ -112,7 +112,7 @@ void GetData(void *param)
NETLIBHTTPHEADER headers[2];
headers[0].szName = "User-Agent";
- headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 6.0; Win32)";
+ headers[0].szValue = NETLIB_USER_AGENT;
headers[1].szName = "Content-Length";
headers[1].szValue = NULL;
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index c43f9e0dfa..a28c471e2a 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -424,7 +424,7 @@ void __cdecl GGPROTO::setavatarthread(void *param)
httpHeaders[5].szName = "User-Agent";
httpHeaders[5].szValue = "avatars to avatars";
httpHeaders[6].szName = "From";
- httpHeaders[6].szValue = "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl-PL) AppleWebKit/533.3 (KHTML, like Gecko) Qt/4.7.1 Safari/533.3";
+ httpHeaders[6].szValue = NETLIB_USER_AGENT;
httpHeaders[7].szName = "Content-type";
httpHeaders[7].szValue = "application/x-www-form-urlencoded; charset=utf-8";
httpHeaders[8].szName = "Accept";
diff --git a/protocols/Gadu-Gadu/src/libgadu/libgadu.h b/protocols/Gadu-Gadu/src/libgadu/libgadu.h
index 6d2db69f96..33224836c3 100644
--- a/protocols/Gadu-Gadu/src/libgadu/libgadu.h
+++ b/protocols/Gadu-Gadu/src/libgadu/libgadu.h
@@ -39,6 +39,7 @@
#ifdef GG_CONFIG_MIRANDA
#include <m_ssl.h>
+#include <m_netlib.h>
#endif
#if defined(__cplusplus) || defined(_WIN32)
@@ -1542,7 +1543,7 @@ int gg_dcc7_handle_abort(struct gg_session *sess, struct gg_event *e, void *payl
#define GG_DEFAULT_PORT 8074
#define GG_HTTPS_PORT 443
-#define GG_HTTP_USERAGENT "Mozilla/4.7 [en] (Win98; I)"
+#define GG_HTTP_USERAGENT NETLIB_USER_AGENT
#define GG_DEFAULT_CLIENT_VERSION "10.1.0.11070"
#define GG_DEFAULT_PROTOCOL_VERSION 0x2e
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp
index 825cdd8068..fcab8c9715 100644
--- a/protocols/IcqOscarJ/src/icq_proto.cpp
+++ b/protocols/IcqOscarJ/src/icq_proto.cpp
@@ -182,7 +182,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const TCHAR* aUserName) :
nlu.ptszDescriptiveName = szBuffer;
nlu.szSettingsModule = m_szModuleName;
nlu.szHttpGatewayHello = "http://http.proxy.icq.com/hello";
- nlu.szHttpGatewayUserAgent = "Mozilla/4.08 [en] (WinNT; U ;Nav)";
+ nlu.szHttpGatewayUserAgent = NETLIB_USER_AGENT;
nlu.pfnHttpGatewayInit = icq_httpGatewayInit;
nlu.pfnHttpGatewayBegin = icq_httpGatewayBegin;
nlu.pfnHttpGatewayWrapSend = icq_httpGatewayWrapSend;
diff --git a/protocols/MSN/src/msn_global.h b/protocols/MSN/src/msn_global.h
index 5eb3ebba1b..8756e2bd23 100644
--- a/protocols/MSN/src/msn_global.h
+++ b/protocols/MSN/src/msn_global.h
@@ -128,7 +128,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MSN_DEFAULT_GATEWAY_PORT 80
const char MSN_DEFAULT_LOGIN_SERVER[] = "messenger.hotmail.com";
const char MSN_DEFAULT_GATEWAY[] = "gateway.messenger.hotmail.com";
-const char MSN_USER_AGENT[] = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1)";
+const char MSN_USER_AGENT[] = NETLIB_USER_AGENT;
#define MSN_BLOCK "/BlockCommand"
#define MSN_INVITE "/InviteCommand"
diff --git a/protocols/Xfire/src/socket.cpp b/protocols/Xfire/src/socket.cpp
index 302e117d4f..1863639249 100644
--- a/protocols/Xfire/src/socket.cpp
+++ b/protocols/Xfire/src/socket.cpp
@@ -214,7 +214,7 @@ bool Socket::connect ( const std::string host, const int port, int useproxy,std:
/*if (useproxy&&status==0) {
char temp[1024];
- this->send("CONNECT cs.xfire.com:25999 HTTP/1.1\nHost: cs.xfire.com:25999\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\n\n");
+ this->send("CONNECT cs.xfire.com:25999 HTTP/1.1\nHost: cs.xfire.com:25999\nUser-Agent: " + NETLIB_USER_AGENT + "\n\n");
this->recv((char*)temp,1024);
}*/
diff --git a/protocols/Yahoo/src/libyahoo2/yahoo_httplib.cpp b/protocols/Yahoo/src/libyahoo2/yahoo_httplib.cpp
index 551c64fbe7..2f3a8d1485 100644
--- a/protocols/Yahoo/src/libyahoo2/yahoo_httplib.cpp
+++ b/protocols/Yahoo/src/libyahoo2/yahoo_httplib.cpp
@@ -329,13 +329,14 @@ void yahoo_http_post(int id, const char *url, const char *cookies, long content_
snprintf(buff, sizeof(buff),
"POST %s HTTP/1.0\r\n"
- "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
+ "User-Agent: %s\r\n"
"Pragma: no-cache\r\n"
"Host: %s\r\n"
"Content-Length: %ld\r\n"
"%s"
"\r\n",
- path,
+ path,
+ NETLIB_USER_AGENT,
host, content_length,
ck);
@@ -361,12 +362,12 @@ void yahoo_http_get(int id, const char *url, const char *cookies,
snprintf(buff, sizeof(buff),
"GET %s HTTP/1.0\r\n"
- "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
+ "User-Agent: %s\r\n"
"Pragma: no-cache\r\n"
"Host: %s\r\n"
"%s"
"\r\n",
- path, host, ck);
+ path, NETLIB_USER_AGENT, host, ck);
yahoo_send_http_request(id, host, port, buff, callback, data);
}
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp
index 020574af1b..10ec6ed568 100644
--- a/protocols/Yahoo/src/proto.cpp
+++ b/protocols/Yahoo/src/proto.cpp
@@ -83,7 +83,7 @@ int CYahooProto::OnModulesLoadedEx(WPARAM, LPARAM)
#ifdef HTTP_GATEWAY
// Here comes the Gateway Code!
nlu.szHttpGatewayHello = NULL;
- nlu.szHttpGatewayUserAgent = "User-Agent: Mozilla/4.01 [en] (Win95; I)";
+ nlu.szHttpGatewayUserAgent = "User-Agent: " + NETLIB_USER_AGENT;
nlu.pfnHttpGatewayInit = YAHOO_httpGatewayInit;
nlu.pfnHttpGatewayBegin = NULL;
nlu.pfnHttpGatewayWrapSend = YAHOO_httpGatewayWrapSend;
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp
index 70541ad599..c26ff0573a 100644
--- a/protocols/Yahoo/src/yahoo.cpp
+++ b/protocols/Yahoo/src/yahoo.cpp
@@ -1283,7 +1283,7 @@ void CYahooProto::ext_send_http_request(enum yahoo_connection_type type, const c
}
httpHeaders[i].szName = "User-Agent";
- httpHeaders[i].szValue = "Mozilla/4.0 (compatible; MSIE 5.5)";
+ httpHeaders[i].szValue = NETLIB_USER_AGENT;
i++;
httpHeaders[i].szName = "Host";
@@ -1451,7 +1451,7 @@ char * CYahooProto::ext_send_https_request(struct yahoo_data *yd, const char *ho
nlhr.headersCount = 3;
nlhr.headers=(NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER)*(nlhr.headersCount+5));
nlhr.headers[0].szName = "User-Agent";
- nlhr.headers[0].szValue = "Mozilla/4.0 (compatible; MSIE 5.5)";
+ nlhr.headers[0].szValue = NETLIB_USER_AGENT;
nlhr.headers[1].szName = "Cache-Control";
nlhr.headers[1].szValue = "no-cache";
nlhr.headers[2].szName = "Connection";