static CURLcode smtp_parse_url_options(struct connectdata *conn);
static CURLcode smtp_parse_url_path(struct Curl_easy *data);
static CURLcode smtp_parse_custom_request(struct Curl_easy *data);
-static CURLcode smtp_parse_address(struct connectdata *conn, const char *fqma,
+static CURLcode smtp_parse_address(struct Curl_easy *data, const char *fqma,
char **address, struct hostname *host);
static CURLcode smtp_perform_auth(struct Curl_easy *data,
struct connectdata *conn, const char *mech,
/* Parse the mailbox to verify into the local address and host name
parts, converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, smtp->rcpt->data,
+ result = smtp_parse_address(data, smtp->rcpt->data,
&address, &host);
if(result)
return result;
/* Parse the FROM mailbox into the local address and host name parts,
converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, data->set.str[STRING_MAIL_FROM],
+ result = smtp_parse_address(data, data->set.str[STRING_MAIL_FROM],
&address, &host);
if(result)
return result;
/* Parse the AUTH mailbox into the local address and host name parts,
converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, data->set.str[STRING_MAIL_AUTH],
+ result = smtp_parse_address(data, data->set.str[STRING_MAIL_AUTH],
&address, &host);
if(result) {
free(from);
/* Parse the recipient mailbox into the local address and host name parts,
converting the host name to an IDN A-label if necessary */
- result = smtp_parse_address(conn, smtp->rcpt->data,
+ result = smtp_parse_address(data, smtp->rcpt->data,
&address, &host);
if(result)
return result;
* calling function deems it to be) then the input will simply be returned in
* the address part with the host name being NULL.
*/
-static CURLcode smtp_parse_address(struct connectdata *conn, const char *fqma,
+static CURLcode smtp_parse_address(struct Curl_easy *data, const char *fqma,
char **address, struct hostname *host)
{
CURLcode result = CURLE_OK;
host->name = host->name + 1;
/* Attempt to convert the host name to IDN ACE */
- (void) Curl_idnconvert_hostname(conn, host);
+ (void) Curl_idnconvert_hostname(data, host);
/* If Curl_idnconvert_hostname() fails then we shall attempt to continue
and send the host name using UTF-8 rather than as 7-bit ACE (which is
struct connectdata *conn,
struct curltime now)
{
- if(!conn->data) {
- timediff_t idletime = Curl_timediff(now, conn->lastused);
- idletime /= 1000; /* integer seconds is fine */
+ timediff_t idletime = Curl_timediff(now, conn->lastused);
+ idletime /= 1000; /* integer seconds is fine */
- if(idletime > data->set.maxage_conn) {
- infof(data, "Too old connection (%ld seconds), disconnect it\n",
- idletime);
- return TRUE;
- }
+ if(idletime > data->set.maxage_conn) {
+ infof(data, "Too old connection (%ld seconds), disconnect it\n",
+ idletime);
+ return TRUE;
}
return FALSE;
}
struct connectdata *conn)
{
if(data->set.verbose)
- infof(conn->data, "Connected to %s (%s) port %ld (#%ld)\n",
+ infof(data, "Connected to %s (%s) port %ld (#%ld)\n",
#ifndef CURL_DISABLE_PROXY
conn->bits.socksproxy ? conn->socks_proxy.host.dispname :
conn->bits.httpproxy ? conn->http_proxy.host.dispname :
/*
* Perform any necessary IDN conversion of hostname
*/
-CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
+CURLcode Curl_idnconvert_hostname(struct Curl_easy *data,
struct hostname *host)
{
- struct Curl_easy *data = conn->data;
-
#ifndef USE_LIBIDN2
(void)data;
- (void)conn;
+ (void)data;
#elif defined(CURL_DISABLE_VERBOSE_STRINGS)
- (void)conn;
+ (void)data;
#endif
/* set the name we use to display the host name */
* the scope_id based on that!
*/
-static void zonefrom_url(CURLU *uh, struct connectdata *conn)
+static void zonefrom_url(CURLU *uh, struct Curl_easy *data,
+ struct connectdata *conn)
{
char *zoneid;
- CURLUcode uc;
-
- uc = curl_url_get(uh, CURLUPART_ZONEID, &zoneid, 0);
+ CURLUcode uc = curl_url_get(uh, CURLUPART_ZONEID, &zoneid, 0);
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+ (void)data;
+#endif
if(!uc && zoneid) {
char *endp;
scopeidx = if_nametoindex(zoneid);
#endif
if(!scopeidx)
- infof(conn->data, "Invalid zoneid: %s; %s\n", zoneid,
+ infof(data, "Invalid zoneid: %s; %s\n", zoneid,
strerror(errno));
else
conn->scope_id = scopeidx;
hlen = strlen(hostname);
hostname[hlen - 1] = 0;
- zonefrom_url(uh, conn);
+ zonefrom_url(uh, data, conn);
}
/* make sure the connect struct gets its own copy of the host name */
* name and is not limited to HTTP proxies only.
* The returned pointer must be freed by the caller (unless NULL)
****************************************************************/
-static char *detect_proxy(struct connectdata *conn)
+static char *detect_proxy(struct Curl_easy *data,
+ struct connectdata *conn)
{
char *proxy = NULL;
const char *protop = conn->handler->scheme;
char *envp = proxy_env;
char *prox;
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+ (void)data;
+#endif
/* Now, build <protocol>_proxy and check for such a one to use */
while(*protop)
}
}
if(proxy)
- infof(conn->data, "Uses proxy env variable %s == '%s'\n", envp, proxy);
+ infof(data, "Uses proxy env variable %s == '%s'\n", envp, proxy);
return proxy;
}
size_t len = strlen(host);
host[len-1] = 0; /* clear the trailing bracket */
host++;
- zonefrom_url(uhp, conn);
+ zonefrom_url(uhp, data, conn);
}
proxyinfo->host.name = host;
/* create_conn helper to parse and init proxy values. to be called after unix
socket init but before any proxy vars are evaluated. */
-static CURLcode create_conn_helper_init_proxy(struct connectdata *conn)
+static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data,
+ struct connectdata *conn)
{
char *proxy = NULL;
char *socksproxy = NULL;
char *no_proxy = NULL;
CURLcode result = CURLE_OK;
- struct Curl_easy *data = conn->data;
/*************************************************************
* Extract the user and password from the authentication string
no_proxy = curl_getenv(p);
}
if(no_proxy) {
- infof(conn->data, "Uses proxy env variable %s == '%s'\n", p, no_proxy);
+ infof(data, "Uses proxy env variable %s == '%s'\n", p, no_proxy);
}
}
#ifndef CURL_DISABLE_HTTP
else if(!proxy && !socksproxy)
/* if the host is not in the noproxy list, detect proxy. */
- proxy = detect_proxy(conn);
+ proxy = detect_proxy(data, conn);
#endif /* CURL_DISABLE_HTTP */
Curl_safefree(no_proxy);
/* After the unix socket init but before the proxy vars are used, parse and
initialize the proxy vars */
#ifndef CURL_DISABLE_PROXY
- result = create_conn_helper_init_proxy(conn);
+ result = create_conn_helper_init_proxy(data, conn);
if(result)
goto out;
/*************************************************************
* IDN-convert the hostnames
*************************************************************/
- result = Curl_idnconvert_hostname(conn, &conn->host);
+ result = Curl_idnconvert_hostname(data, &conn->host);
if(result)
goto out;
if(conn->bits.conn_to_host) {
- result = Curl_idnconvert_hostname(conn, &conn->conn_to_host);
+ result = Curl_idnconvert_hostname(data, &conn->conn_to_host);
if(result)
goto out;
}
#ifndef CURL_DISABLE_PROXY
if(conn->bits.httpproxy) {
- result = Curl_idnconvert_hostname(conn, &conn->http_proxy.host);
+ result = Curl_idnconvert_hostname(data, &conn->http_proxy.host);
if(result)
goto out;
}
if(conn->bits.socksproxy) {
- result = Curl_idnconvert_hostname(conn, &conn->socks_proxy.host);
+ result = Curl_idnconvert_hostname(data, &conn->socks_proxy.host);
if(result)
goto out;
}
* conn->data MUST already have been setup fine (in create_conn)
*/
-CURLcode Curl_setup_conn(struct connectdata *conn,
+CURLcode Curl_setup_conn(struct Curl_easy *data,
bool *protocol_done)
{
CURLcode result = CURLE_OK;
- struct Curl_easy *data = conn->data;
+ struct connectdata *conn = data->conn;
Curl_pgrsTime(data, TIMER_NAMELOOKUP);
/* DNS resolution is done: that's either because this is a reused
connection, in which case DNS was unnecessary, or because DNS
really did finish already (synch resolver/fast async resolve) */
- result = Curl_setup_conn(conn, protocol_done);
+ result = Curl_setup_conn(data, protocol_done);
}
}