Prev: App built by VS2008 causes "side-by-side configuration"-error in Vista
Next: How to convert time from one timezone to another?
From: Chizl on 21 Apr 2008 17:32 Language: VC6 I'm using WinHTTP, direct API, and cannot use anything else, so please don't tell me to use some other API process. I have code to use a proxy however, I dont have a proxy to test with yet, so I'm preparing the code but not clear if it's correct. When using the proxy, I have the following. ==[ Example 1 ]============================== hSession = WinHttpOpen(T2OLE(AGENT_NAME), ( szProxyName.length()>0 ) ? WINHTTP_ACCESS_TYPE_NAMED_PROXY : WINHTTP_ACCESS_TYPE_NO_PROXY, ( szProxyName.length()>0 ) ? T2OLE(szProxyName.c_str()) : WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); if(bResults && dwProxyAuthScheme) bResults = WinHttpSetCredentials( hRequest, WINHTTP_AUTH_TARGET_PROXY, dwProxyAuthScheme, T2OLE(szProxyUserName.c_str()), T2OLE(szProxyPassword.c_str()), NULL ); ========================================== I recently found out the port may be different so I went and looked and their is no place to put the port, but I'm assuming I can pass it in with the proxy name (e.g. proxyname:85). While looking to see if this is correct I ran across this which made me think, I may be doing the whole proxy with WinHTTP incorrectly, but realize it also may just be another way to do it, but neither is particularly the wrong way. I didn't see with this way how to set user/pass unless it's to use the same WinHttpSetCredentials like above. ==[ Example 2 ]============================== WINHTTP_PROXY_INFO proxyInfo; proxyInfo.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; proxyInfo.lpszProxy = L"proxy_name"; proxyInfo.lpszProxyBypass = L"<local>"; // Set the proxy information for this session. WinHttpSetOption( hSession, WINHTTP_OPTION_PROXY, &proxyInfo, sizeof(proxyInfo)); ========================================= Can someone clear this up so I can have a better understanding of proxies with WinHTTP?
From: Chizl on 22 Apr 2008 09:55 Is this a question that can't be answered by the mighty C++ developers of the world!? :) "Chizl" <Chizl(a)NoShitMail.com> wrote in message news:O7X3jc$oIHA.2068(a)TK2MSFTNGP05.phx.gbl... > Language: VC6 > > I'm using WinHTTP, direct API, and cannot use anything else, so please > don't tell me to use some other API process. > > I have code to use a proxy however, I dont have a proxy to test with yet, > so I'm preparing the code but not clear if it's correct. When using the > proxy, I have the following. > > ==[ Example 1 ]============================== > hSession = > WinHttpOpen(T2OLE(AGENT_NAME), > ( szProxyName.length()>0 ) ? > WINHTTP_ACCESS_TYPE_NAMED_PROXY : WINHTTP_ACCESS_TYPE_NO_PROXY, > ( szProxyName.length()>0 ) ? > T2OLE(szProxyName.c_str()) : WINHTTP_NO_PROXY_NAME, > WINHTTP_NO_PROXY_BYPASS, > 0); > > > if(bResults && dwProxyAuthScheme) > bResults = WinHttpSetCredentials( hRequest, > WINHTTP_AUTH_TARGET_PROXY, > dwProxyAuthScheme, > T2OLE(szProxyUserName.c_str()), > T2OLE(szProxyPassword.c_str()), > NULL ); > ========================================== > > I recently found out the port may be different so I went and looked and > their is no place to put the port, but I'm assuming I can pass it in with > the proxy name (e.g. proxyname:85). While looking to see if this is > correct I ran across this which made me think, I may be doing the whole > proxy with WinHTTP incorrectly, but realize it also may just be another > way to do it, but neither is particularly the wrong way. I didn't see > with this way how to set user/pass unless it's to use the same > WinHttpSetCredentials like above. > > ==[ Example 2 ]============================== > WINHTTP_PROXY_INFO proxyInfo; > proxyInfo.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; > proxyInfo.lpszProxy = L"proxy_name"; > proxyInfo.lpszProxyBypass = L"<local>"; > > // Set the proxy information for this session. > WinHttpSetOption( hSession, WINHTTP_OPTION_PROXY, > &proxyInfo, sizeof(proxyInfo)); > > ========================================= > > Can someone clear this up so I can have a better understanding of proxies > with WinHTTP? >
From: Tim Roberts on 23 Apr 2008 23:10
"Chizl" <Chizl(a)NoShitMail.com> wrote: > >Is this a question that can't be answered by the mighty C++ developers of >the world!? :) You only waited 14 hours before whining. It takes longer than that for newsgroup postings to wrap around the world and come back. Your second case seems designed only for proxies that do not require authentication. >"Chizl" <Chizl(a)NoShitMail.com> wrote: >> Language: VC6 >> >> I'm using WinHTTP, direct API, and cannot use anything else, so please >> don't tell me to use some other API process. >> >> I have code to use a proxy however, I dont have a proxy to test with yet, >> so I'm preparing the code but not clear if it's correct. Wouldn't it be quicker just to set up a proxy? It wouldn't take you more than a couple of hours to set up a dedicated machine with a simple proxy server. Then you could watch this process in real life. -- Tim Roberts, timr(a)probo.com Providenza & Boekelheide, Inc. |