curl-library
Help libcurl fetch NTLM authentication messages
Date: Wed, 20 Apr 2011 16:23:24 +0200
Dear all,
I am developing an application that needs NTLM on every message. I am
trying to output to a file the messages sent and received in the
authentication but I am not able to do it. My strategy is to activate
de verbose option and then capture the stderr stream, but i am not
receiving anything. I have tried to use File *out_msgs =
fopen("C:/out.txt", "w"); my_setopt(curl, CURLOPT_STDERR, out_msgs);
to idicate the output stream but i had acces violation problems. Any
guess of how to do it? I have attatched a part of the code where I am
testing this, the file where i am outputting the information appears
empty. Apologize for my english.
Thank you very much.
void get(int argc, _TCHAR* argv[])
{
CURL *curl;
CURLcode res;
struct stat file_info;
struct MemoryStruct chunk;
chunk.memory = (char*)malloc(1); /* will be grown as needed by the
realloc above */
chunk.size = mem;
char *file;
char *url;
int sockfd = -1;
File * out_msgs = freopen("C:/out.txt", "w", stderr);
if(argc < 2)
return 1;
url = (char*)argv[1];
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
struct curl_slist *headers=NULL;
curl_easy_setopt(curl,CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
/* set user name and password for the authentication */
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:pass");
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
res = curl_easy_perform(curl);
fclose(out_msgs);
/* always cleanup */
curl_easy_cleanup(curl);
}
curl_global_cleanup();
return 0;
}
Alvaro
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-20