summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/hostip.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 1a18a3ed7..0d477bea9 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -430,10 +430,6 @@ Curl_cache_addr(struct Curl_easy *data,
* function is used. You MUST call Curl_resolv_unlock() later (when you're
* done using this struct) to decrease the counter again.
*
- * In debug mode, we specifically test for an interface name "LocalHost"
- * and resolve "localhost" instead as a means to permit test cases
- * to connect to a local test server with any host name.
- *
* Return codes:
*
* CURLRESOLV_ERROR (-1) = error, no pointer
@@ -450,6 +446,11 @@ int Curl_resolv(struct connectdata *conn,
struct Curl_easy *data = conn->data;
CURLcode result;
int rc = CURLRESOLV_ERROR; /* default to failure */
+#ifdef DEBUGBUILD
+ char *fakehost = curl_getenv("CURL_URL_HOSTNAME");
+ if(fakehost)
+ hostname = fakehost;
+#endif
*entry = NULL;
@@ -475,19 +476,15 @@ int Curl_resolv(struct connectdata *conn,
/* Check what IP specifics the app has requested and if we can provide it.
* If not, bail out. */
- if(!Curl_ipvalid(conn))
- return CURLRESOLV_ERROR;
+ if(!Curl_ipvalid(conn)) {
+ rc = CURLRESOLV_ERROR;
+ goto end;
+ }
/* If Curl_getaddrinfo() returns NULL, 'respwait' might be set to a
non-zero value indicating that we need to wait for the response to the
resolve call */
- addr = Curl_getaddrinfo(conn,
-#ifdef DEBUGBUILD
- (data->set.str[STRING_DEVICE]
- && !strcmp(data->set.str[STRING_DEVICE],
- "LocalHost"))?"localhost":
-#endif
- hostname, port, &respwait);
+ addr = Curl_getaddrinfo(conn, hostname, port, &respwait);
if(!addr) {
if(respwait) {
@@ -522,7 +519,10 @@ int Curl_resolv(struct connectdata *conn,
}
*entry = dns;
-
+ end:
+#ifdef DEBUGBUILD
+ free(fakehost);
+#endif
return rc;
}