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); }
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); }