Exemple #1
0
int HTTP_Close(void)
{
 unsigned long r,w;

 finish_tell_io(server,&r,&w);

 PrintMessage(Inform,"Server bytes; %d Read, %d Written.",r,w); /* Used in audit-usage.pl */

 if(proxyUrl)
    FreeURL(proxyUrl);
 proxyUrl=NULL;

 return(CloseSocket(server));
}
Exemple #2
0
int SSL_Close(void)
{
 unsigned long r,w;

 if(finish_tell_io(server,&r,&w)<0)
   PrintMessage(Inform,"Error finishing IO on socket with remote host [%!s].");

 PrintMessage(Inform,"Server bytes; %lu Read, %lu Written.",r,w); /* Used in audit-usage.pl */

 if(proxyUrl)
    FreeURL(proxyUrl);
 proxyUrl=NULL;

 return(CloseSocket(server));
}
Exemple #3
0
void FreeQueItem(OneQueItem **Item)
{
/*
	SMTPC_syslog(LOG_DEBUG, "---------------%s--------------", __FUNCTION__);
	cit_backtrace();
*/
	DeleteHash(&(*Item)->MailQEntries);
	FreeStrBuf(&(*Item)->EnvelopeFrom);
	FreeStrBuf(&(*Item)->BounceTo);
	FreeStrBuf(&(*Item)->SenderRoom);
	FreeURL(&(*Item)->URL);
	memset(*Item, 0, sizeof(OneQueItem));
	free(*Item);
	Item = NULL;
}
Exemple #4
0
void FreeAsyncIOContents(AsyncIO *IO)
{
	CitContext *Ctx = IO->CitContext;

	FreeStrBuf(&IO->IOBuf);
	FreeStrBuf(&IO->SendBuf.Buf);
	FreeStrBuf(&IO->RecvBuf.Buf);

	FreeURL(&IO->ConnectMe);
	FreeStrBuf(&IO->HttpReq.ReplyData);

	if (Ctx) {
		Ctx->state = CON_IDLE;
		Ctx->kill_me = 1;
		IO->CitContext = NULL;
	}
}
Exemple #5
0
int HTTP_Close(Connection *connection)
{
 unsigned long r,w;
 int server=connection->fd;

 if(finish_tell_io(server,&r,&w)<0)
   PrintMessage(Inform,"Error finishing IO on socket with remote host [%!s].");

 PrintMessage(Inform,"Server bytes; %lu Read, %lu Written.",r,w); /* Used in audit-usage.pl */

#if 0
 /* We can clean up the connection context here, or rely on ConnectionClose to do it. */
 if(connection->proxyUrl) {FreeURL(connection->proxyUrl); connection->proxyUrl=NULL;}
#endif

 return(CloseSocket(server));
}
Exemple #6
0
char *SSL_Open(URL *Url)
{
 char *msg=NULL;
 char *proxy=NULL,*sproxy=NULL;
 int socksremotedns=0;
 socksdata_t *socksdata=NULL,socksbuf;

 /* Sort out the host. */

 if(!IsLocalNetHost(Url->host)) {
   proxy=ConfigStringURL(SSLProxy,Url);
   sproxy=ConfigStringURL(SocksProxy,Url);
   socksremotedns=ConfigBooleanURL(SocksRemoteDNS,Url);
 }

 if(proxyUrl) {
   FreeURL(proxyUrl);
   proxyUrl=NULL;
 }

 if(proxy)
   Url=proxyUrl=CreateURL("http",proxy,"/",NULL,NULL,NULL);

 /* Open the connection. */

 server=-1;

 if(Url->portnum)
   {
    if((sproxy && !(socksdata= MakeSocksData(sproxy,socksremotedns,&socksbuf))) ||
       (server=OpenUrlSocket(Url,socksdata))==-1)
      {
       msg=GetPrintMessage(Warning,"Cannot open the https (SSL) connection to %s port %d; [%!s].",Url->host,Url->portnum);
      }
    else
      {
       init_io(server);
       configure_io_timeout_rw(server,ConfigInteger(SocketTimeout));
      }
   }
 else
    msg=GetPrintMessage(Warning,"No port given for the https (SSL) connection to %s.",Url->host);

 return(msg);
}
Exemple #7
0
char *HTTP_Open(URL *Url)
{
 char *msg=NULL;
 char *proxy=NULL;
 char *server_host=NULL;
 int server_port=-1;

 /* Sort out the host. */

 if(!IsLocalNetHost(Url->host))
    proxy=ConfigStringURL(Proxies,Url);

 if(proxy)
   {
    if(proxyUrl)
       FreeURL(proxyUrl);
    proxyUrl=NULL;

    proxyUrl=CreateURL("http",proxy,"/",NULL,NULL,NULL);
    server_host=proxyUrl->host;
    server_port=proxyUrl->port;
   }
 else
   {
    server_host=Url->host;
    server_port=Url->port;
   }

 if(server_port==-1)
    server_port=DefaultPort(Url);

 /* Open the connection. */

 server=OpenClientSocket(server_host,server_port);

 if(server==-1)
    msg=GetPrintMessage(Warning,"Cannot open the HTTP connection to %s port %d; [%!s].",server_host,server_port);
 else
   {
    init_io(server);
    configure_io_timeout(server,ConfigInteger(SocketTimeout),ConfigInteger(SocketTimeout));
   }

 return(msg);
}
void DeleteSmtpOutMsg(void *v)
{
	SmtpOutMsg *Msg = v;
	AsyncIO *IO = &Msg->IO;
	EV_syslog(LOG_DEBUG, "%s Exit\n", __FUNCTION__);

	/* these are kept in our own space and free'd below */
	Msg->IO.ConnectMe = NULL;

	ares_free_data(Msg->AllMX);
	if (Msg->HostLookup.VParsedDNSReply != NULL)
		Msg->HostLookup.DNSReplyFree(Msg->HostLookup.VParsedDNSReply);
	FreeURL(&Msg->Relay);
	FreeStrBuf(&Msg->msgtext);
	FreeStrBuf(&Msg->MultiLineBuf);
	FreeAsyncIOContents(&Msg->IO);
	memset (Msg, 0, sizeof(SmtpOutMsg)); /* just to be shure... */
	free(Msg);
}
Exemple #9
0
void DeletePOP3Aggregator(void *vptr)
{
	pop3aggr *ptr = vptr;
	DeleteHashPos(&ptr->Pos);
	DeleteHash(&ptr->MsgNumbers);
//	FreeStrBuf(&ptr->rooms);
	FreeStrBuf(&ptr->pop3user);
	FreeStrBuf(&ptr->pop3pass);
	FreeStrBuf(&ptr->Host);
	FreeStrBuf(&ptr->RoomName);
	FreeURL(&ptr->IO.ConnectMe);
	FreeStrBuf(&ptr->Url);
	FreeStrBuf(&ptr->IO.IOBuf);
	FreeStrBuf(&ptr->IO.SendBuf.Buf);
	FreeStrBuf(&ptr->IO.RecvBuf.Buf);
	DeleteAsyncMsg(&ptr->IO.ReadMsg);
	if (((struct CitContext*)ptr->IO.CitContext)) {
		((struct CitContext*)ptr->IO.CitContext)->state = CON_IDLE;
		((struct CitContext*)ptr->IO.CitContext)->kill_me = 1;
	}
	FreeAsyncIOContents(&ptr->IO);
	free(ptr);
}
Exemple #10
0
int main(int argc,char **argv)
{
 URL *Url;
 URL **list,*refresh;
 int j;

 if(argc==1)
   {fprintf(stderr,"usage: test-doc URL < contents-of-url\n");return(1);}

 StderrLevel=ExtraDebug;

 InitErrorHandler("test-doc",0,1);

 InitConfigurationFile("./wwwoffle.conf");

 init_io(STDERR_FILENO);

 if(ReadConfigurationFile(STDERR_FILENO))
    PrintMessage(Fatal,"Error in configuration file 'wwwoffle.conf'.");

 finish_io(STDERR_FILENO);

 Url=SplitURL(argv[1]);

 init_io(0);

 ParseDocument(0,Url,1);

 if((refresh=GetReference(RefMetaRefresh)))
    printf("Refresh = %s\n",refresh->file);

 if((list=GetReferences(RefStyleSheet)))
    for(j=0;list[j];j++)
       printf("StyleSheet = %s\n",list[j]->file);

 if((list=GetReferences(RefImage)))
    for(j=0;list[j];j++)
       printf("Image = %s\n",list[j]->file);

 if((list=GetReferences(RefFrame)))
    for(j=0;list[j];j++)
       printf("Frame = %s\n",list[j]->file);

 if((list=GetReferences(RefScript)))
    for(j=0;list[j];j++)
       printf("Script = %s\n",list[j]->file);

 if((list=GetReferences(RefObject)))
    for(j=0;list[j];j++)
       printf("Object = %s\n",list[j]->file);

 if((list=GetReferences(RefInlineObject)))
    for(j=0;list[j];j++)
       printf("InlineObject = %s\n",list[j]->file);

 if((list=GetReferences(RefLink)))
    for(j=0;list[j];j++)
       printf("Link = %s\n",list[j]->file);

 FreeURL(Url);

 finish_io(0);

 return(0);
}
Exemple #11
0
static void
gotstatus(int nnrun)
{
	CURLMsg *msg;
	int nmsg;

	global.nrun = nnrun;

	CURLM_syslog(LOG_DEBUG,
		     "gotstatus(): about to call curl_multi_info_read\n");
	while ((msg = curl_multi_info_read(global.mhnd, &nmsg))) {
		CURL_syslog(LOG_DEBUG,
			    "got curl multi_info message msg=%d\n",
			    msg->msg);

		if (CURLMSG_DONE == msg->msg) {
			CURL *chnd;
			void *chandle = NULL;
			CURLcode sta;
			CURLMcode msta;
			AsyncIO*IO;

			chandle = NULL;;
			chnd = msg->easy_handle;
			sta = curl_easy_getinfo(chnd,
						CURLINFO_PRIVATE,
						&chandle);
			if (sta) {
				syslog(LOG_ERR,
				       "error asking curl for private"
				       " cookie of curl handle: %s\n",
				       curl_easy_strerror(sta));
				continue;
			}
			IO = (AsyncIO *)chandle;
			if (IO->ID == 0) {
				EVCURL_syslog(LOG_ERR,
					      "Error, invalid IO context %p\n",
					      IO);
				continue;
			}
			SetEVState(IO, eCurlGotStatus);

			EVCURLM_syslog(LOG_DEBUG, "request complete\n");

			IO->CitContext->lastcmd = IO->Now = ev_now(event_base);

			ev_io_stop(event_base, &IO->recv_event);
			ev_io_stop(event_base, &IO->send_event);

			sta = msg->data.result;
			if (sta) {
				EVCURL_syslog(LOG_ERR,
					      "error description: %s\n",
					      IO->HttpReq.errdesc);
				IO->HttpReq.CurlError = curl_easy_strerror(sta);
				EVCURL_syslog(LOG_ERR,
					      "error performing request: %s\n",
					      IO->HttpReq.CurlError);
				if (sta == CURLE_OPERATION_TIMEDOUT)
				{
					IO->SendBuf.fd = 0;
					IO->RecvBuf.fd = 0;
				}
			}
			sta = curl_easy_getinfo(chnd,
						CURLINFO_RESPONSE_CODE,
						&IO->HttpReq.httpcode);
			if (sta)
				EVCURL_syslog(LOG_ERR,
					      "error asking curl for "
					      "response code from request: %s\n",
					      curl_easy_strerror(sta));
			EVCURL_syslog(LOG_DEBUG,
				      "http response code was %ld\n",
				      (long)IO->HttpReq.httpcode);


			curl_slist_free_all(IO->HttpReq.headers);
			IO->HttpReq.headers = NULL;
			msta = curl_multi_remove_handle(global.mhnd, chnd);
			if (msta)
				EVCURL_syslog(LOG_ERR,
					      "warning problem detaching "
					      "completed handle from curl multi: "
					      "%s\n",
					      curl_multi_strerror(msta));

			ev_cleanup_stop(event_base, &IO->abort_by_shutdown);

			IO->HttpReq.attached = 0;
			switch(IO->SendDone(IO))
			{
			case eDBQuery:
				FreeURL(&IO->ConnectMe);
				QueueAnDBOperation(IO);
				break;
			case eSendDNSQuery:
			case eReadDNSReply:
			case eConnect:
			case eSendReply:
			case eSendMore:
			case eSendFile:
			case eReadMessage:
			case eReadMore:
			case eReadPayload:
			case eReadFile:
				break;
			case eTerminateConnection:
			case eAbort:
				curl_easy_cleanup(IO->HttpReq.chnd);
				IO->HttpReq.chnd = NULL;
				FreeStrBuf(&IO->HttpReq.ReplyData);
				FreeURL(&IO->ConnectMe);
				RemoveContext(IO->CitContext);
				IO->Terminate(IO);
			}
		}
	}
}
Exemple #12
0
void RequestMonitoredPages(void)
{
 DIR *dir;
 struct dirent* ent;

 /* Open the monitor subdirectory. */

 if(chdir("monitor"))
   {PrintMessage(Warning,"Cannot change to directory 'monitor'; [%!s] no files monitored.");return;}

 dir=opendir(".");
 if(!dir)
   {PrintMessage(Warning,"Cannot open directory 'monitor'; [%!s] no files monitored.");ChangeBackToSpoolDir();return;}

 ent=readdir(dir);
 if(!ent)
   {PrintMessage(Warning,"Cannot read directory 'monitor'; [%!s] no files monitored.");closedir(dir);ChangeBackToSpoolDir();return;}

 /* Scan through all of the files. */

 do
   {
    struct stat buf;

    if(ent->d_name[0]=='.' && (ent->d_name[1]==0 || (ent->d_name[1]=='.' && ent->d_name[2]==0)))
       continue; /* skip . & .. */

    if(stat(ent->d_name,&buf))
      {PrintMessage(Inform,"Cannot stat file 'monitor/%s'; [%!s] race condition?",ent->d_name);return;}
    else if(S_ISREG(buf.st_mode) && *ent->d_name=='O')
      {
       URL *Url=FileNameToURL(ent->d_name);
       int last,next;

       ChangeBackToSpoolDir();

       if(!Url)
          continue;

       MonitorTimes(Url,&last,&next);

       PrintMessage(Debug,"Monitoring '%s' last=%dh next=%dh => %s",Url->name,last,next,next?"No":"Yes");

       chdir("monitor");

       if(next==0)
         {
          int ifd=open(ent->d_name,O_RDONLY|O_BINARY);

          if(ifd==-1)
             PrintMessage(Warning,"Cannot open monitored file 'monitor/%s' to read; [%!s].",ent->d_name);
          else
            {
             int ofd;

             init_io(ifd);

             ChangeBackToSpoolDir();

             ofd=OpenNewOutgoingSpoolFile();

             if(ofd==-1)
                PrintMessage(Warning,"Cannot open outgoing spool file for monitored URL '%s'; [%!s].",Url->name);
             else
               {
                char *contents=(char*)malloc(buf.st_size+1);

                init_io(ofd);

                read_data(ifd,contents,buf.st_size);
                if(write_data(ofd,contents,buf.st_size)==-1)
                   PrintMessage(Warning,"Cannot write to outgoing file; disk full?");

                finish_io(ofd);
                CloseNewOutgoingSpoolFile(ofd,Url);

                free(contents);
               }

             chdir("monitor");

             finish_io(ifd);
             close(ifd);

             if(utime(URLToFileName(Url,'M',0),NULL))
                PrintMessage(Warning,"Cannot change timestamp of monitored file 'monitor/%s'; [%!s].",URLToFileName(Url,'M',0));
            }
         }

       FreeURL(Url);
      }
   }
 while((ent=readdir(dir)));

 ChangeBackToSpoolDir();

 closedir(dir);
}
Exemple #13
0
static void MonitorFormParse(int fd,URL *Url,char *request_args,Body *request_body)
{
 int i,mfd=-1;
 char **args,*url=NULL;
 URL *monUrl;
 char mofy[13]="NNNNNNNNNNNN",*dofm=NULL,dofw[8]="NNNNNNN",*hofd=NULL;
 char MofY[13],DofM[32],DofW[8],HofD[25];

 if(!request_args && !request_body)
   {
    HTMLMessage(fd,404,"WWWOFFLE Monitor Form Error",NULL,"MonitorFormError",
                "body",NULL,
                NULL);
    return;
   }

 if(request_body)
   {
    char *form=URLRecodeFormArgs(request_body->content);
    args=SplitFormArgs(form);
    free(form);
   }
 else
    args=SplitFormArgs(request_args);

 for(i=0;args[i];i++)
   {
    if(!strncmp("url=",args[i],(size_t)4))
       url=TrimArgs(URLDecodeFormArgs(args[i]+4));
    else if(!strncmp("mofy1=",args[i],(size_t)6))
       mofy[0]=args[i][6];
    else if(!strncmp("mofy2=",args[i],(size_t)6))
       mofy[1]=args[i][6];
    else if(!strncmp("mofy3=",args[i],(size_t)6))
       mofy[2]=args[i][6];
    else if(!strncmp("mofy4=",args[i],6))
       mofy[3]=args[i][6];
    else if(!strncmp("mofy5=",args[i],(size_t)6))
       mofy[4]=args[i][6];
    else if(!strncmp("mofy6=",args[i],(size_t)6))
       mofy[5]=args[i][6];
    else if(!strncmp("mofy7=",args[i],(size_t)6))
       mofy[6]=args[i][6];
    else if(!strncmp("mofy8=",args[i],(size_t)6))
       mofy[7]=args[i][6];
    else if(!strncmp("mofy9=",args[i],(size_t)6))
       mofy[8]=args[i][6];
    else if(!strncmp("mofy10=",args[i],(size_t)7))
       mofy[9]=args[i][7];
    else if(!strncmp("mofy11=",args[i],(size_t)7))
       mofy[10]=args[i][7];
    else if(!strncmp("mofy12=",args[i],(size_t)7))
       mofy[11]=args[i][7];
    else if(!strncmp("dofm=",args[i],(size_t)5))
       dofm=args[i]+5;
    else if(!strncmp("dofw0=",args[i],(size_t)6))
       dofw[0]=args[i][6];
    else if(!strncmp("dofw1=",args[i],(size_t)6))
       dofw[1]=args[i][6];
    else if(!strncmp("dofw2=",args[i],(size_t)6))
       dofw[2]=args[i][6];
    else if(!strncmp("dofw3=",args[i],(size_t)6))
       dofw[3]=args[i][6];
    else if(!strncmp("dofw4=",args[i],(size_t)6))
       dofw[4]=args[i][6];
    else if(!strncmp("dofw5=",args[i],(size_t)6))
       dofw[5]=args[i][6];
    else if(!strncmp("dofw6=",args[i],(size_t)6))
       dofw[6]=args[i][6];
    else if(!strncmp("hofd=",args[i],(size_t)5))
       hofd=args[i]+5;
    else
       PrintMessage(Warning,"Unexpected argument '%s' seen decoding form data for URL '%s'.",args[i],Url->name);
   }

 if(url==NULL || *url==0)
   {
    HTMLMessage(fd,404,"WWWOFFLE Monitor Form Error",NULL,"MonitorFormError",
                "body",request_body?request_body->content:request_args,
                NULL);
    if(url) free(url);
    free(args[0]);
    free(args);
    return;
   }

 monUrl=SplitURL(url);
 free(url);

 /* Parse the requested time */

 strcpy(MofY,"000000000000");
 for(i=0;i<12;i++)
    if(mofy[i]=='Y')
       MofY[i]='1';

 if(!dofm || !*dofm)
    strcpy(DofM,"1111111111111111111111111111111");
 else
   {
    int d,any=0,range=0,lastd=0;
    char *p=dofm;
    strcpy(DofM,"0000000000000000000000000000000");

    while(*p)
      {
       while(*p && !isdigit(*p))
         {
          if(*p=='*')
            {
             strcpy(DofM,"1111111111111111111111111111111");
             any=1;
            }
          if(*p=='-')
             range=1;
          p++;
         }
       if(!*p)
          break;
       d=atoi(p)-1;
       if(range)
         {
          if(d>30)
             d=30;
          for(;lastd<=d;lastd++)
             DofM[lastd]='1';
          range=0;
          any++;
         }
       else if(d>=0 && d<31)
         {
          DofM[d]='1';
          any++;
          lastd=d;
         }
       while(isdigit(*p))
          p++;
      }

    if(range)
       for(;lastd<=30;lastd++)
          DofM[lastd]='1';
    else
       if(!any)
          strcpy(DofM,"1111111111111111111111111111111");
   }

 strcpy(DofW,"0000000");
 for(i=0;i<7;i++)
    if(dofw[i]=='Y')
       DofW[i]='1';

 if(!hofd || !*hofd)
    strcpy(HofD,"100000000000000000000000");
 else
   {
    int h,any=0,range=0,lasth=0;
    char *p=hofd;
    strcpy(HofD,"000000000000000000000000");

    while(*p)
      {
       while(*p && !isdigit(*p))
         {
          if(*p=='*')
            {
             strcpy(HofD,"111111111111111111111111");
             any=1;
            }
          if(*p=='-')
             range=1;
          p++;
         }
       if(!*p)
          break;
       h=atoi(p);
       if(range)
         {
          if(h>23)
             h=23;
          for(;lasth<=h;lasth++)
             HofD[lasth]='1';
          range=0;
          any++;
         }
       else if(h>=0 && h<24)
         {
          HofD[h]='1';
          any++;
          lasth=h;
         }
       while(isdigit(*p))
          p++;
      }

    if(range)
       for(;lasth<=23;lasth++)
          HofD[lasth]='1';
    else
       if(!any)
          strcpy(HofD,"100000000000000000000000");
   }

 mfd=CreateMonitorSpoolFile(monUrl,MofY,DofM,DofW,HofD);

 if(mfd==-1)
    HTMLMessage(fd,500,"WWWOFFLE Server Error",NULL,"ServerError",
                "error","Cannot open file to store monitor request",
                NULL);
 else
   {
    Header *new_request_head=RequestURL(monUrl,NULL);
    char *head=HeaderString(new_request_head);

    init_io(mfd);

    write_string(mfd,head);

    finish_io(mfd);
    close(mfd);

    HTMLMessage(fd,200,"WWWOFFLE Monitor Will Get",NULL,"MonitorWillGet",
                "url",monUrl->name,
                NULL);

    free(head);
    FreeHeader(new_request_head);
   }

 free(args[0]);
 free(args);

 FreeURL(monUrl);
}
Exemple #14
0
static void MonitorFormShow(int fd,char *request_args)
{
 char MofY[13],DofM[32],DofW[8],HofD[25];
 char dofmstr[128],hofdstr[64],*p;
 char *url=NULL;
 int i,exists=0;

 if(request_args)
    url=URLDecodeFormArgs(request_args);

 if(url)
   {
    URL *monUrl=SplitURL(url);
    exists=ReadMonitorTimesSpoolFile(monUrl,MofY,DofM,DofW,HofD);
    FreeURL(monUrl);
   }
 else
   {
    strcpy(MofY,"111111111111");
    strcpy(DofM,"1111111111111111111111111111111");
    strcpy(DofW,"1111111");
    strcpy(HofD,"100000000000000000000000");
   }

 if(!strcmp(DofM,"1111111111111111111111111111111"))
    strcpy(dofmstr,"*");
 else
   {
    *dofmstr=0;
    p=dofmstr;
    for(i=0;i<31;i++)
       if(DofM[i]=='1')
         {
          sprintf(p,"%d ",i+1);
          p+=strlen(p);
         }
   }

 if(!strcmp(HofD,"100000000000000000000000"))
    strcpy(hofdstr,"0");
 else
   {
    *hofdstr=0;
    p=hofdstr;
    for(i=0;i<24;i++)
       if(HofD[i]=='1')
         {
          sprintf(p,"%d ",i);
          p+=strlen(p);
         }
   }

 HTMLMessage(fd,200,"WWWOFFLE Monitor Page",NULL,"MonitorPage",
             "url",url,
             "exists",exists==0?NULL:"Yes",
             "mofy1",MofY[0]=='1'?"Yes":NULL,
             "mofy2",MofY[1]=='1'?"Yes":NULL,
             "mofy3",MofY[2]=='1'?"Yes":NULL,
             "mofy4",MofY[3]=='1'?"Yes":NULL,
             "mofy5",MofY[4]=='1'?"Yes":NULL,
             "mofy6",MofY[5]=='1'?"Yes":NULL,
             "mofy7",MofY[6]=='1'?"Yes":NULL,
             "mofy8",MofY[7]=='1'?"Yes":NULL,
             "mofy9",MofY[8]=='1'?"Yes":NULL,
             "mofy10",MofY[9]=='1'?"Yes":NULL,
             "mofy11",MofY[10]=='1'?"Yes":NULL,
             "mofy12",MofY[11]=='1'?"Yes":NULL,
             "dofm",dofmstr,
             "dofw0",DofW[0]=='1'?"Yes":NULL,
             "dofw1",DofW[1]=='1'?"Yes":NULL,
             "dofw2",DofW[2]=='1'?"Yes":NULL,
             "dofw3",DofW[3]=='1'?"Yes":NULL,
             "dofw4",DofW[4]=='1'?"Yes":NULL,
             "dofw5",DofW[5]=='1'?"Yes":NULL,
             "dofw6",DofW[6]=='1'?"Yes":NULL,
             "hofd",hofdstr,
             NULL);

 if(url)
    free(url);
}