summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-04-17 12:44:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-04-17 12:44:57 +0000
commit7137d2b9395dc051e2adbe0c83553479646cedb1 (patch)
tree43b9d98bb245bba34591ee1ee2b62b15a5004f97
parentf955b9916066920d8405274dc1d047a675df5fe2 (diff)
- unused netlib flags removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@16689 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/delphi/m_netlib.inc31
-rw-r--r--include/m_netlib.h5
-rw-r--r--protocols/GTalkExt/src/inbox.cpp2
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp2
-rw-r--r--protocols/MRA/src/MraAvatars.cpp1
-rw-r--r--protocols/MSN/src/msn_commands.cpp2
-rw-r--r--protocols/MSN/src/msn_proto.cpp2
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp2
-rw-r--r--protocols/WhatsApp/src/proto.cpp2
-rw-r--r--protocols/Yahoo/src/avatar.cpp2
-rw-r--r--src/mir_app/src/netlibhttp.cpp22
-rw-r--r--src/mir_app/src/netlibhttpproxy.cpp2
-rw-r--r--src/mir_app/src/netlibopenconn.cpp2
13 files changed, 25 insertions, 52 deletions
diff --git a/include/delphi/m_netlib.inc b/include/delphi/m_netlib.inc
index e2d87ee369..edbf277804 100644
--- a/include/delphi/m_netlib.inc
+++ b/include/delphi/m_netlib.inc
@@ -89,39 +89,24 @@ const
REQUEST_PUT = 5;
REQUEST_DELETE = 6;
- NLHRF_GENERATEHOST = $00000001; // auto generate a 'host' header from .szUrl
- NLHRF_REMOVEHOST = $00000002; // remove any host and/or protocol portion
- // of szUrl before sending it
- NLHRF_SMARTREMOVEHOST = $00000004; // removes host and/or protocol from szUrl
- // unless the connection was opened through
- // an HTTP or HTTPS proxy.
- NLHRF_SMARTAUTHHEADER = $00000008; // if the connection was opened through an
- // HTTP or HTTPS proxy then send a
- // Proxy-Authorization header if required.
+ NLHRF_MANUALHOST = $00000002; // don't remove any host and/or protocol portion of szUrl before sending it
NLHRF_HTTP11 = $00000010; // use HTTP 1.1
- NLHRF_PERSISTENT = $00000020; // preserve connection on exit, open connection provided
- // in the nlc field of the reply it should be supplied in
+ NLHRF_PERSISTENT = $00000020; // preserve connection on exit, open connection provided in the nlc field of the reply it should be supplied in
// nlc field of request for reuse or closed if not needed
NLHRF_SSL = $00000040; // use ssl connection
NLHRF_NOPROXY = $00000080; // do not use proxy server
- NLHRF_REDIRECT = $00000100; // handle HTTP redirect requests (response 30x), the
- // resulting url provided in szUrl of the response
+ NLHRF_REDIRECT = $00000100; // handle HTTP redirect requests (response 30x), the resulting url provided in szUrl of the response
NLHRF_NODUMP = $00010000; // never dump this to the log
- NLHRF_NODUMPHEADERS = $00020000; // don't dump http headers (only useful for
- // POSTs and MS_NETLIB_HTTPTRANSACTION
- NLHRF_DUMPPROXY = $00040000; // this transaction is a proxy communication.
- // For dump filtering only.
- NLHRF_DUMPASTEXT = $00080000; // dump posted and reply data as text.
- // Headers are always dumped as text.
+ NLHRF_NODUMPHEADERS = $00020000; // don't dump http headers (only useful for POSTs and MS_NETLIB_HTTPTRANSACTION
+ NLHRF_DUMPPROXY = $00040000; // this transaction is a proxy communication. For dump filtering only.
+ NLHRF_DUMPASTEXT = $00080000; // dump posted and reply data as text. Headers are always dumped as text.
NLHRF_NODUMPSEND = $00100000; // do not dump sent message.
// for TNETLIBBUFFER.flags
- MSG_NOHTTPGATEWAYWRAP = $010000; // don't wrap outgoing packet using
- // TNETLIBUSER.pfnHttpGatewayWrapSend
+ MSG_NOHTTPGATEWAYWRAP = $010000; // don't wrap outgoing packet using TNETLIBUSER.pfnHttpGatewayWrapSend
MSG_NODUMP = $020000; // don't dump this packet to the log
- MSG_DUMPPROXY = $040000; // this is proxy communication, for dump
- // filtering only
+ MSG_DUMPPROXY = $040000; // this is proxy communication, for dump filtering only
MSG_DUMPASTEXT = $080000; // don't dump as hex, it's text
MSG_RAW = $100000; // send as raw, bybpass HTTP proxy stuff
MSG_DUMPSSL = $200000; // this is SSL traffic. For dump filtering only.
diff --git a/include/m_netlib.h b/include/m_netlib.h
index accc3db99e..577eb3b2a9 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -462,10 +462,7 @@ typedef struct {
#define REQUEST_PUT 5
#define REQUEST_DELETE 6
-#define NLHRF_GENERATEHOST 0x00000001 // auto-generate a "Host" header from szUrl
-#define NLHRF_REMOVEHOST 0x00000002 // remove any host and/or protocol portion of szUrl before sending it
-#define NLHRF_SMARTREMOVEHOST 0x00000004 // removes host and/or protocol from szUrl unless the connection was opened through an HTTP or HTTPS proxy.
-#define NLHRF_SMARTAUTHHEADER 0x00000008 // if the connection was opened through an HTTP or HTTPS proxy then send a Proxy-Authorization header if required.
+#define NLHRF_MANUALHOST 0x00000001 // do not remove any host and/or protocol portion of szUrl before sending it
#define NLHRF_HTTP11 0x00000010 // use HTTP 1.1
#define NLHRF_PERSISTENT 0x00000020 // preserve connection on exit, open connection provided in the nlc field of the reply
// it should be supplied in nlc field of request for reuse or closed if not needed
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp
index e97e6a02c0..2a7084a404 100644
--- a/protocols/GTalkExt/src/inbox.cpp
+++ b/protocols/GTalkExt/src/inbox.cpp
@@ -55,7 +55,7 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams)
{
NETLIBHTTPREQUEST nlhr = { sizeof(nlhr) };
nlhr.requestType = REQUEST_POST;
- nlhr.flags = NLHRF_GENERATEHOST | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP | NLHRF_NODUMPHEADERS;
+ nlhr.flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP | NLHRF_NODUMPHEADERS;
nlhr.szUrl = reqUrl;
nlhr.headers = (NETLIBHTTPHEADER*)&HEADER_URL_ENCODED;
nlhr.headersCount = 1;
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index e6d8027464..8130aa286c 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -2194,7 +2194,7 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg)
NETLIBHTTPREQUEST request = { 0 };
request.cbSize = sizeof(request);
request.requestType = REQUEST_GET;
- request.flags = NLHRF_GENERATEHOST | NLHRF_SMARTREMOVEHOST | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11;
+ request.flags = NLHRF_HTTP11;
request.szUrl = JABBER_SERVER_URL;
NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index 76339802f0..62b329e576 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -387,7 +387,6 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR
NETLIBHTTPREQUEST nlhr = { 0 };
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = dwRequestType;
- nlhr.flags = (NLHRF_GENERATEHOST | NLHRF_SMARTREMOVEHOST | NLHRF_SMARTAUTHHEADER);
nlhr.szUrl = szBuff;
nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
nlhr.headersCount = 4;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index 50c68307c5..a2a7dab1be 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -469,7 +469,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli)
NETLIBHTTPREQUEST nlhr = { 0 }, *nlhrReply;
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_GENERATEHOST | NLHRF_PERSISTENT | NLHRF_SMARTAUTHHEADER;
+ nlhr.flags = NLHRF_PERSISTENT;
nlhr.szUrl = uri;
nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
nlhr.headersCount = _countof(nlbhHeaders);
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index fff6248b7b..4db3c921d2 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -534,7 +534,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg)
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_GENERATEHOST | NLHRF_SMARTREMOVEHOST | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11;
+ nlhr.flags = NLHRF_HTTP11;
nlhr.szUrl = ft->szInvcookie;
nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
diff --git a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp
index 7d3d02b30d..9b85cf80bb 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp
@@ -51,7 +51,7 @@ namespace MediaUploader
nlhr.szUrl = (char*)host.c_str();
nlhr.headers = s_imageHeaders;
nlhr.headersCount = _countof(s_imageHeaders);
- nlhr.flags = NLHRF_HTTP11 | NLHRF_GENERATEHOST | NLHRF_REMOVEHOST | NLHRF_SSL;
+ nlhr.flags = NLHRF_HTTP11 | NLHRF_SSL;
nlhr.pData = (char*)allVector.data();
nlhr.dataLength = (int)allVector.size();
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index c4fa89948d..ba5cde24f7 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -259,7 +259,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number,
nlhr.szUrl = url.GetBuffer();
nlhr.headers = s_registerHeaders;
nlhr.headersCount = _countof(s_registerHeaders);
- nlhr.flags = NLHRF_HTTP11 | NLHRF_GENERATEHOST | NLHRF_REMOVEHOST | NLHRF_SSL;
+ nlhr.flags = NLHRF_HTTP11 | NLHRF_SSL;
NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
(WPARAM)WASocketConnection::hNetlibUser, (LPARAM)&nlhr);
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp
index 449c5cfe26..60a1579281 100644
--- a/protocols/Yahoo/src/avatar.cpp
+++ b/protocols/Yahoo/src/avatar.cpp
@@ -179,7 +179,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt)
nlhr.cbSize = sizeof(nlhr);
nlhr.requestType = REQUEST_GET;
- nlhr.flags = NLHRF_NODUMP | NLHRF_GENERATEHOST | NLHRF_SMARTAUTHHEADER;
+ nlhr.flags = NLHRF_NODUMP;
nlhr.szUrl = avt->pic_url;
nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr);
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index bd8069457a..8429ef512c 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -436,7 +436,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
if (!pszUrl) {
pszUrl = pszFullUrl;
- if (nlhr->flags & (NLHRF_SMARTREMOVEHOST | NLHRF_REMOVEHOST | NLHRF_GENERATEHOST)) {
+ if (!(nlhr->flags & NLHRF_MANUALHOST)) {
bool usingProxy = nlc->proxyType == PROXYTYPE_HTTP && !(nlhr->flags & NLHRF_SSL);
mir_free(szHost);
@@ -450,14 +450,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam)
if (ppath == phost)
phost = NULL;
- if (nlhr->flags & NLHRF_GENERATEHOST) {
- szHost = mir_strdup(phost);
- if (ppath && phost)
- szHost[ppath - phost] = 0;
- }
+ szHost = mir_strdup(phost);
+ if (ppath && phost)
+ szHost[ppath - phost] = 0;
- if (nlhr->flags & NLHRF_REMOVEHOST || (nlhr->flags & NLHRF_SMARTREMOVEHOST && !usingProxy))
- pszUrl = ppath ? ppath : "/";
+ pszUrl = ppath ? ppath : "/";
if (usingProxy && phost && !nlc->dnsThroughProxy) {
char *tszHost = mir_strdup(phost);
@@ -848,21 +845,16 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam)
if (nlc == NULL)
return 0;
- NETLIBHTTPREQUEST nlhrSend;
- char szUserAgent[64];
-
- nlhrSend = *nlhr;
- nlhrSend.flags &= ~NLHRF_REMOVEHOST;
- nlhrSend.flags |= NLHRF_GENERATEHOST | NLHRF_SMARTREMOVEHOST | NLHRF_SMARTAUTHHEADER;
+ NETLIBHTTPREQUEST nlhrSend = *nlhr;
bool doneUserAgentHeader = NetlibHttpFindHeader(nlhr, "User-Agent") != NULL;
bool doneAcceptEncoding = NetlibHttpFindHeader(nlhr, "Accept-Encoding") != NULL;
-
if (!doneUserAgentHeader || !doneAcceptEncoding) {
nlhrSend.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER) * (nlhrSend.headersCount + 2));
memcpy(nlhrSend.headers, nlhr->headers, sizeof(NETLIBHTTPHEADER) * nlhr->headersCount);
}
+ char szUserAgent[64];
if (!doneUserAgentHeader) {
nlhrSend.headers[nlhrSend.headersCount].szName = "User-Agent";
nlhrSend.headers[nlhrSend.headersCount].szValue = szUserAgent;
diff --git a/src/mir_app/src/netlibhttpproxy.cpp b/src/mir_app/src/netlibhttpproxy.cpp
index 2de8379dfe..f5216d1b38 100644
--- a/src/mir_app/src/netlibhttpproxy.cpp
+++ b/src/mir_app/src/netlibhttpproxy.cpp
@@ -72,7 +72,7 @@ static bool NetlibHttpGatewaySend(NetlibConnection *nlc, RequestType reqType, co
nlhrSend.pData = (char*)buf;
nlhrSend.dataLength = len;
- nlhrSend.flags = NLHRF_GENERATEHOST | NLHRF_DUMPPROXY | NLHRF_SMARTAUTHHEADER | NLHRF_NOPROXY | NLHRF_REDIRECT;
+ nlhrSend.flags = NLHRF_DUMPPROXY | NLHRF_NOPROXY | NLHRF_REDIRECT;
if (nlc->nlhpi.flags & NLHPIF_HTTP11)
nlhrSend.flags |= NLHRF_HTTP11;
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp
index 3f9406594e..f6586e6494 100644
--- a/src/mir_app/src/netlibopenconn.cpp
+++ b/src/mir_app/src/netlibopenconn.cpp
@@ -300,7 +300,7 @@ static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NE
nlhrSend.cbSize = sizeof(nlhrSend);
nlhrSend.requestType = REQUEST_CONNECT;
- nlhrSend.flags = NLHRF_GENERATEHOST | NLHRF_DUMPPROXY | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11 | NLHRF_NOPROXY | NLHRF_REDIRECT;
+ nlhrSend.flags = NLHRF_DUMPPROXY | NLHRF_HTTP11 | NLHRF_NOPROXY | NLHRF_REDIRECT;
if (nlc->dnsThroughProxy)
mir_snprintf(szUrl, "%s:%u", nloc->szHost, nloc->wPort);
else {