W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2003

[www-lib] <none>

From: Paul Accosta <paco@hungary.cc>
Date: Mon, 28 Apr 2003 21:58:30 +0200
Message-ID: <20030428195831.19869.qmail@web2.mailbox.hu>
To: www-lib@w3.org
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;

}
Received on Monday, 28 April 2003 15:58:33 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:43 GMT