Discussion:
Effects of INTERNET_FLAG_EXISTING_CONNECT and Basic Authentication
(too old to reply)
LizardWiz
2007-12-06 18:48:06 UTC
Permalink
Can anyone tell me how INTERNET_FLAG_EXISTING_CONNECT flag works in the
header? I have a system that I am communicating with that claims that
sometimes when I send a HTTP get using WinInet that the authentication is
left out of the internet header.

Is it possible that the connection does not send the authentication in the
header if somehow it determines that it has successfully reused an existing
connection?

Thanks in advance if anyone can helpme with this...

Here is a sample of how I am using WinInet in C++, it is pretty standard:

CInternetSession m_InternetSession;
CHttpConnection* m_pConnection = NULL;
CHttpFile* m_pFile = NULL;
DWORD m_HttpRequestFlags = INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE;

m_pConnection = m_InternetSession.GetHttpConnection(strHTTPSiteConnection,
nHTTPSitePort, strHTTPSiteUser, strHTTPSitePassword);

m_pFile = m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,
(LPCSTR)m_strURL, NULL, NULL, NULL, NULL, m_HttpRequestFlags);

m_pFile->SendRequest();
--
~LizardWiz()
Volodymyr Shcherbyna
2007-12-10 12:36:57 UTC
Permalink
Why are you trying to reuse connection object? According to documentation
this is useful only in case of ftp connections. Did you tried to sniff all
packets sent from your application? Does this behaviour happens constantly?
--
Volodymyr
Post by LizardWiz
Can anyone tell me how INTERNET_FLAG_EXISTING_CONNECT flag works in the
header? I have a system that I am communicating with that claims that
sometimes when I send a HTTP get using WinInet that the authentication is
left out of the internet header.
Is it possible that the connection does not send the authentication in the
header if somehow it determines that it has successfully reused an existing
connection?
Thanks in advance if anyone can helpme with this...
CInternetSession m_InternetSession;
CHttpConnection* m_pConnection = NULL;
CHttpFile* m_pFile = NULL;
DWORD m_HttpRequestFlags = INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE;
m_pConnection = m_InternetSession.GetHttpConnection(strHTTPSiteConnection,
nHTTPSitePort, strHTTPSiteUser, strHTTPSitePassword);
m_pFile = m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,
(LPCSTR)m_strURL, NULL, NULL, NULL, NULL, m_HttpRequestFlags);
m_pFile->SendRequest();
--
~LizardWiz()
LizardWiz
2007-12-10 18:19:02 UTC
Permalink
No this doesn't happen constantly, but when it does happen it happens
continuously until something is done about it. I tried to sniff the packets
when it last happened with Ethereal, but the problem is that this is a thread
in a service that fires hourly, so instead of waiting patiently I restarted
the service so that the thread would run instantly. Needless to say that it
stopped, however, the strange thing is that this was actually the first time
that it stopped just by us restarting our service (it usually requires the
receiving service to be restarted). I have no actual idea if we are indeed
sending no authorization line in the internet header, that is what the other
service is reporting to us as the cause for an error that we are getting back
from them. But thhat is coming from them after forwarding the request
through a number of servers...

Why we are using this flag does not matter, it is there, even though it may
be useless. I am sure it was just an oversight by someone. I am just
wondering what the symptoms would be if somehow a connection got reused. I
should also note that ALL of the responses that we are getting back from the
other service has the "Connection: close" line in the header. Doesn't the
existence of this line prohibit a connection from being reused with the
INTERNET_FLAG_EXISTING_CONNECT flag?
--
~LizardWiz()
Post by Volodymyr Shcherbyna
Why are you trying to reuse connection object? According to documentation
this is useful only in case of ftp connections. Did you tried to sniff all
packets sent from your application? Does this behaviour happens constantly?
--
Volodymyr
Post by LizardWiz
Can anyone tell me how INTERNET_FLAG_EXISTING_CONNECT flag works in the
header? I have a system that I am communicating with that claims that
sometimes when I send a HTTP get using WinInet that the authentication is
left out of the internet header.
Is it possible that the connection does not send the authentication in the
header if somehow it determines that it has successfully reused an existing
connection?
Thanks in advance if anyone can helpme with this...
CInternetSession m_InternetSession;
CHttpConnection* m_pConnection = NULL;
CHttpFile* m_pFile = NULL;
DWORD m_HttpRequestFlags = INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_RELOAD | INTERNET_FLAG_DONT_CACHE;
m_pConnection = m_InternetSession.GetHttpConnection(strHTTPSiteConnection,
nHTTPSitePort, strHTTPSiteUser, strHTTPSitePassword);
m_pFile = m_pConnection->OpenRequest(CHttpConnection::HTTP_VERB_GET,
(LPCSTR)m_strURL, NULL, NULL, NULL, NULL, m_HttpRequestFlags);
m_pFile->SendRequest();
--
~LizardWiz()
Continue reading on narkive:
Search results for 'Effects of INTERNET_FLAG_EXISTING_CONNECT and Basic Authentication' (Questions and Answers)
17
replies
What's preventing TV over the internet?
started 2007-10-02 13:41:09 UTC
internet
Loading...