cURL / Mailing Lists / curl-library / Single Mail

curl-library

[Problems with Proxy Implementation with CURL/C++]

From: Gibran Akram <gibran.akram_at_gmail.com>
Date: Fri, 24 Oct 2008 13:21:41 +0600

Hi, I'm using cURL to connect to a ftp Server via a Proxy server. Here is a
code snippet of what I'm doing:

    //Snippets:

    sprintf(AuthStr, "%s:%s", pEntity->GetProxyUser(),
pEntity->GetProxyPswd());

    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_PROXY, "
192.168.1.250"); //Proxy URL
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_PROXYPORT,
8080); //Proxy Port
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_PROXYUSERPWD,
AuthStr); //Proxy Username:Password
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_PROXYTYPE,
CURLPROXY_HTTP); //Proxy Type
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_HTTPPROXYTUNNEL,
1); //Tunneling
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_PROXYAUTH,
CURLAUTH_BASIC);
    sprintf(AuthStr, "%s:%s", pUname, pPswd);
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_USERPWD,
AuthStr);

    //All of the above calls return: CURLE_OK

    CurlRetCode =
curl_easy_setopt(m_pCURLEZHandle,CURLOPT_WRITEFUNCTION,WriteToDiskX);
    CurlRetCode =
curl_easy_setopt(m_pCURLEZHandle,CURLOPT_WRITEDATA,(void*)&m_StInfo);
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle,
CURLOPT_VERBOSE,VERBOSEMODE);
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_NOPROGRESS, 1);

    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_FAILONERROR, 1);
    CurlRetCode = curl_easy_setopt(m_pCURLEZHandle, CURLOPT_URL,RmFile);
//URL TO USE FOR FILE DOWNLOAD

    if(CurlRetCode == CURLE_OK)
    {
        OpenZFileForWrite(pFileName);
        CurlRetCode = curl_easy_perform(m_pCURLEZHandle);

   //.... SNIPPET END ..... //

However, the curl_easy_perform call is returning CURLE_RECV_ERROR (56) and
the error buffer has "The requested URL returned error: 403"

Can't figure out what I've missed here... can anyone give a tip?
Received on 2008-10-24