AZGroups.com

Bringing together Arizona Technology Users And Enhancing the Careers of Developers
Welcome to AZGroups.com Sign in | Join | Help
in Search

SetPostData function not posting stream when using Catlhttpclient

Last post 04-07-2008, 10:02 AM by Subbu. 0 replies.
Sort Posts: Previous Next
  •  04-07-2008, 10:02 AM 928

    SetPostData function not posting stream when using Catlhttpclient

    Hello,
    
    I am using the following code to post data to a server using the 
    catlhttpclient classes:
    
    BYTE* PostData;
    CString postdata;
    
    postdata += _T("admin_password=&login_mode=user&user_name=");
    
    PostData = new BYTE[postdata.GetLength()+1];
            memcpy( PostData, postdata, postdata.GetLength() + 1 );
            PostData[postdata.GetLength() + 1] = 0;
    
            
    navData.SetPostData(PostData,postdata.GetLength()+1,_T("application/octet-stream"));
    
            navData.SetMethod(_T("POST"));
    
        if (client->Navigate( m_urlStr, &navData ))
        {
    
    ......
    }
    
    
    The navigate call to the server fails with a 404. When a look at the http 
    stream, I do not see the posted data  stream
    
    POST /login.cgi? HTTP/1.1
    Content-Length: 49
    Content-Type: application/octet-stream
    Referer: http://10.0.5.28
    Host: 10.0.5.28
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) 
    Gecko/20070216 Firefox/1.5.0.10 
    <<the postdata variable string should be here and I do not see it???>>>
    
    I even converted the raw bytes in the "PostData" variable to UTF8 encoding 
    and then tried posting but I got no results.
    
    What am doing wrong?
    
  • View as RSS news feed in XML
    Powered by Community Server, by Telligent Systems