bitemyapp / twitcurl

Automatically exported from code.google.com/p/twitcurl
0 stars 0 forks source link

proxies don't always need username and password #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

Cant set proxy if it does not have a password. I have changed your code to 
this, I believe you should update it too: 

void twitCurl::prepareCurlProxy()
{
    if( !m_curlProxyParamsSet)
    {
        /* Reset existing proxy details in cURL */
        curl_easy_setopt( m_curlHandle, CURLOPT_PROXY, NULL );
        curl_easy_setopt( m_curlHandle, CURLOPT_PROXYUSERPWD, NULL 
);
        curl_easy_setopt( m_curlHandle, CURLOPT_PROXYAUTH, 
(long)CURLAUTH_ANY );

        /* Prepare username and password for proxy server */
        std::string proxyIpPort( "" );
        utilMakeCurlParams( proxyIpPort, getProxyServerIp(), 
getProxyServerPort() );
        curl_easy_setopt( m_curlHandle, CURLOPT_PROXY, 
proxyIpPort.c_str() );

        /* Proxy username and password */
        if( m_proxyUserName.length() && m_proxyPassword.length() ) 
{
            std::string proxyUserPass( "" );
            utilMakeCurlParams( proxyUserPass, 
getProxyUserName(), getProxyPassword() );
            curl_easy_setopt( m_curlHandle, 
CURLOPT_PROXYUSERPWD, proxyUserPass.c_str() );
        }

        /* Set the flag to true indicating that proxy info is set 
in cURL */
        m_curlProxyParamsSet = true;
    }

}

Original issue reported on code.google.com by jbalodi...@gmail.com on 19 Jan 2010 at 6:38

GoogleCodeExporter commented 8 years ago
Hi,

Thanks for the heads-up. I'll update source.

Original comment by swatkat....@gmail.com on 1 Apr 2010 at 5:22

GoogleCodeExporter commented 8 years ago

Original comment by swatkat....@gmail.com on 6 Mar 2011 at 3:55