diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-03-06 09:21:01 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-03-06 09:21:01 +0100 |
commit | 29be83ee74880030a16af46396ee83a3d8ba724b (patch) | |
tree | 942639d8ed5faaf09d0fe572b3183b38e17a9572 /lib/asyn-ares.c | |
parent | 813263dc3a45a886d5bcb810555a4a32eb3a3f70 (diff) | |
download | curl-29be83ee74880030a16af46396ee83a3d8ba724b.tar.gz |
ares: return error at once if timed out before name resolve starts
Pointed-out-by: Ray Satiro
Bug: https://curl.haxx.se/mail/lib-2017-03/0004.html
Diffstat (limited to 'lib/asyn-ares.c')
-rw-r--r-- | lib/asyn-ares.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index c038c2a3f..ae73d0502 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -359,6 +359,11 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, struct Curl_dns_entry *temp_entry; timeout = Curl_timeleft(data, &now, TRUE); + if(timeout < 0) { + /* already expired! */ + connclose(conn, "Timed out before name resolve started"); + return CURLE_OPERATION_TIMEDOUT; + } if(!timeout) timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */ |