<none>

"Paul Accosta" <[email protected]>
Newsgroups gmane.comp.lib.libwww
Message-ID <[email protected]>
Im really stuck on this I cant figure out what is wrong. My requests do
not fully get deleted. Can someone tell something wrong from the code?

char * post(char * auth, char * dst_str, char key[5][32], char
value[5][32], int numfields)
{
	HTChunk * chunk = NULL;
	HTRequest * POSTrequest = NULL;
    HTAnchor * dst = NULL;
	HTAssocList * formfields = NULL;
	char  data[64];
	int x=0;
	int size;
	char *string = NULL;
	unsigned char *ct;
	char ci[512];
	char co[544];
	int *status;

	ct = (unsigned char *)malloc(sizeof(unsigned char)*32);
	memcpy(ct,"foo:foobar",13);
			//-- SET SSL PROTO --//
	HTSSL_protMethod_set(HTSSL_V23);
    HTSSL_verifyDepth_set(2);
			//-- REGISTER SSL --//
    HTSSLhttps_init(NO);
	HTUU_encode(ct, strlen((char *)ct), ci);
	strcpy(co, "Basic ");
	strcat(co, ci);

			//- Set Up Data -//
	formfields = HTAssocList_new();
  //-- Create a new premptive client --//
  HTProfile_newNoCacheClient("libwww-POST", "1.0");
    //-- Need our own trace and print functions --//
    HTPrint_setCallback(printer);
    HTTrace_setCallback(tracer);
    //-- Add our own filter to update the history list --//
    HTNet_addAfter(terminate_handler, NULL, NULL, HT_ALL,
HT_FILTER_LAST);
	HTHost_setEventTimeout(10);

    if (data && *data && dst_str && *dst_str) 
	{
		char * cwd = HTGetCurrentDirectoryURL();
		for(x=0;x<numfields;x++)
		{
			HTAssocList_addObject(formfields,key[x],value[x]);
		}
	
		POSTrequest = HTRequest_new();
		HTRequest_setOutputFormat(POSTrequest,WWW_SOURCE);
		HTRequest_addConnection(POSTrequest, "close", "");
		HTRequest_addCredentials(POSTrequest, "Authorization", co);

		dst = HTAnchor_findAddress(dst_str);
		chunk = HTPostFormAnchorToChunk(formfields,dst,POSTrequest);
		HTEventList_loop(POSTrequest);
		string = HTChunk_toCString(chunk);
		size = HTChunkSize(chunk);	
	}
	HTAnchor_delete(dst);
	HTAssocList_delete(formfields);
	HT_FREE(formfields);
	HTRequest_delete(POSTrequest);
	HTSSLhttps_terminate();
	HTProfile_delete();
	return string;

}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.