- From: Jonathan Oexner <Jonathan.Oexner@Sun.COM>
- Date: Thu, 20 Feb 2003 15:37:36 -0500
- To: www-lib@w3.org
- Message-id: <3E553C90.3050801@Sun.COM>
Hi,
I'm kinda new to the libwww, so bear with me. I'm trying to write a simple HTTP/HTTPS client that takes a URL, does a GET and spits the output to the screen using the HTLoadToChunk function. For some reason, an HTTPS URL causes the function to prompt the user for a file to print to, and never returns. A plain ol' HTTP URL works as planned. Any ideas what I need to do to fix this?
Thanks,
-Jon
#include <stdio.h>
#include "WWWLib.h"
#include "WWWHTTP.h"
#include "WWWInit.h"
#include "WWWSSL.h"
int terminate_handler (HTRequest *request, HTResponse *response,
void *param, int status){
/* Delete our request again */
HTRequest_delete(request);
/* Close down SSL */
HTSSLhttps_terminate();
/* Delete our profile */
HTProfile_delete();
exit(status ? status : 0);
}
PRIVATE int printer (const char * fmt, va_list pArgs)
{
return (vfprintf(stdout, fmt, pArgs));
}
PRIVATE int tracer (const char * fmt, va_list pArgs)
{
return (vfprintf(stderr, fmt, pArgs));
}
int main(int argc, char **argv) {
HTRequest *request=NULL;
HTChunk *chunk = NULL;
char *url=argv[1];
char *cwd = NULL;
char *absolute_url = NULL;
HTPrint_setCallback(printer);
HTTrace_setCallback(tracer);
HTSSL_protMethod_set(HTSSL_V23);
HTSSL_verifyDepth_set(2);
HTSSLhttps_init(YES);
HTProfile_newNoCacheClient("configUtility", "1.0");
HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL, HT_FILTER_LAST);
request = HTRequest_new();
printf("url = %s\n",url);
chunk = HTLoadToChunk(url, request);
if(chunk) {printf("Yay, chunk ain't null!\n"); }
else {printf("Boo, chunk is null.\n");}
}
Received on Thursday, 20 February 2003 15:37:48 UTC