summaryrefslogtreecommitdiff
path: root/lib/hostip.c
Commit message (Collapse)AuthorAgeFilesLines
* timediff: make it 64 bit (if possible) even with 32 bit time_tDaniel Stenberg2019-08-011-1/+1
| | | | | | | ... to make it hold microseconds too. Fixes #4165 Closes #4168
* cleanup: remove the 'numsocks' argument used in many placesDaniel Stenberg2019-07-301-4/+2
| | | | | | | | | It was used (intended) to pass in the size of the 'socks' array that is also passed to these functions, but was rarely actually checked/used and the array is defined to a fixed size of MAX_SOCKSPEREASYHANDLE entries that should be used instead. Closes #4169
* hostip: CURL_DISABLE_SHUFFLE_DNSDaniel Stenberg2019-05-171-1/+4
|
* doh: disable DOH for the cases it doesn't workDaniel Stenberg2019-05-111-3/+4
| | | | | | | | | | Due to limitations in Curl_resolver_wait_resolv(), it doesn't work for DOH resolves. This fix disables DOH for those. Limitation added to KNOWN_BUGS. Fixes #3850 Closes #3857
* CURLOPT_DNS_USE_GLOBAL_CACHE: removeDaniel Stenberg2019-04-111-34/+0
| | | | | | | | Remove the code too. The functionality has been disabled in code since 7.62.0. Setting this option will from now on simply be ignored and have no function. Closes #3654
* Curl_resolv: fix a gcc -Werror=maybe-uninitialized warningRomain Geissler2019-02-121-1/+1
| | | | Closes #3562
* hostip: make create_hostcache_id avoid alloc + freeDaniel Stenberg2019-02-111-69/+24
| | | | Closes #3544
* cleanup: make local functions staticDaniel Stenberg2019-02-101-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | urlapi: turn three local-only functions into statics conncache: make conncache_find_first_connection static multi: make detach_connnection static connect: make getaddressinfo static curl_ntlm_core: make hmac_md5 static http2: make two functions static http: make http_setup_conn static connect: make tcpnodelay static tests: make UNITTEST a thing to mark functions with, so they can be static for normal builds and non-static for unit test builds ... and mark Curl_shuffle_addr accordingly. url: make up_free static setopt: make vsetopt static curl_endian: make write32_le static rtsp: make rtsp_connisdead static warnless: remove unused functions memdebug: remove one unused function, made another static
* hostip: support wildcard hostsClaes Jakobsson2018-12-271-0/+30
| | | | | | | | | | | | | | | | | This adds support for wildcard hosts in CURLOPT_RESOLVE. These are try-last so any non-wildcard entry is resolved first. If specified, any host not matched by another CURLOPT_RESOLVE config will use this as fallback. Example send a.com to 10.0.0.1 and everything else to 10.0.0.2: curl --resolve *:443:10.0.0.2 --resolve a.com:443:10.0.0.1 \ https://a.com https://b.com This is probably quite similar to using: --connect-to a.com:443:10.0.0.1:443 --connect-to :443:10.0.0.2:443 Closes #3406 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* hostip: fix check on Curl_shuffle_addr return valueRick Deist2018-10-081-1/+1
| | | | Closes #3110
* whitespace fixesViktor Szakats2018-09-231-1/+0
| | | | | | | | | | | - replace tabs with spaces where possible - remove line ending spaces - remove double/triple newlines at EOF - fix a non-UTF-8 character - cleanup a few indentations/line continuations in manual examples Closes https://github.com/curl/curl/pull/3037
* setopt: add CURLOPT_DOH_URLDaniel Stenberg2018-09-061-10/+67
| | | | Closes #2668
* hostip: fix unused variable warningMarcel Raad2018-08-021-0/+4
| | | | | addresses is only used in an infof call, which is a macro expanding to nothing if CURL_DISABLE_VERBOSE_STRINGS is set.
* CURLOPT_RESOLVE: always purge old entry firstAlibek.Jorajev2018-06-011-15/+19
| | | | | | If there's an existing entry using the selected name. Closes #2622
* resolve: add CURLOPT_DNS_SHUFFLE_ADDRESSESRick Deist2018-03-171-1/+73
| | | | | | | | | | | This patch adds CURLOPT_DNS_SHUFFLE_ADDRESSES to explicitly request shuffling of IP addresses returned for a hostname when there is more than one. This is useful when the application knows that a round robin approach is appropriate and is willing to accept the consequences of potentially discarding some preference order returned by the system's implementation. Closes #1694
* Revert "hostip: fix compiler warning: 'variable set but not used'"Daniel Stenberg2018-03-121-1/+1
| | | | | | | This reverts commit a577059f92fc65bd6b81717f0737f897a5b34248. The assignment really needs to be there or we risk working with an uninitialized pointer.
* hostip: fix compiler warning: 'variable set but not used'Michael Kaufmann2018-03-111-1/+1
|
* url: Add option CURLOPT_RESOLVER_START_FUNCTIONFrancisco Sedano2018-02-211-0/+12
| | | | | | | | | | | | - Add new option CURLOPT_RESOLVER_START_FUNCTION to set a callback that will be called every time before a new resolve request is started (ie before a host is resolved) with a pointer to backend-specific resolver data. Currently this is only useful for ares. - Add new option CURLOPT_RESOLVER_START_DATA to set a user pointer to pass to the resolver start callback. Closes https://github.com/curl/curl/pull/2311
* hostip: fix 'potentially uninitialized variable' warningJay Satiro2018-02-201-2/+2
| | | | | | Follow-up to 50d1b33. Caught by AppVeyor.
* CURLOPT_RESOLVE: Add support for multiple IP addresses per entryAnders Bakken2018-02-201-27/+89
| | | | | | | This enables users to preresolve but still take advantage of happy eyeballs and trying multiple addresses if some are not connecting. Ref: https://github.com/curl/curl/pull/2260
* RESOLVE: output verbose text when trying to set a duplicate nameDaniel Stenberg2017-12-101-1/+4
| | | | ... to help users understand what is or isn't done!
* configure: check for netinet/in6.hRandall S. Becker2017-12-061-0/+3
| | | | | | | Needed by HPE NonStop NSE and NSX systems Fixes #2146 Closes #2155
* resolve: allow IP address within [] bracketsDaniel Stenberg2017-11-171-1/+12
| | | | | | | | | | | ... so that IPv6 addresses can be passed like they can for connect-to and how they're used in URLs. Added test 1324 to verify Reported-by: Alex Malinovich Fixes #2087 Closes #2091
* time: rename Curl_tvnow to Curl_nowDaniel Stenberg2017-10-251-1/+1
| | | | | | | | | | ... since the 'tv' stood for timeval and this function does not return a timeval struct anymore. Also, cleaned up the Curl_timediff*() functions to avoid typecasts and clean up the descriptive comments. Closes #2011
* timediff: return timediff_t from the time diff functionsDaniel Stenberg2017-10-251-2/+2
| | | | | | | | | | | | | | | ... to cater for systems with unsigned time_t variables. - Renamed the functions to curlx_timediff and Curl_timediff_us. - Added overflow protection for both of them in either direction for both 32 bit and 64 bit time_ts - Reprefixed the curlx_time functions to use Curl_* Reported-by: Peter Piekarski Fixes #2004 Closes #2005
* code style: remove wrong uses of multiple spacesDaniel Stenberg2017-09-121-1/+1
| | | | Closes #1878
* code style: use spaces around plusesDaniel Stenberg2017-09-111-5/+5
|
* time: fix type conversions and compiler warningsMichael Kaufmann2017-05-241-3/+4
| | | | | | | | | Fix bugs and compiler warnings on systems with 32-bit long and 64-bit time_t. Reviewed-by: Daniel Stenberg Closes #1499
* lib: remove unused codeMarcel Raad2017-04-261-1/+0
| | | | | | | | This fixes the following clang warnings: macro is not used [-Wunused-macros] will never be executed [-Wunreachable-code] Closes https://github.com/curl/curl/pull/1448
* spelling fixesklemens2017-03-261-3/+3
| | | | Closes #1356
* checksrc: stricter no-space-before-paren enforcementDaniel Stenberg2016-12-131-1/+1
| | | | In order to make the code style more uniform everywhere
* lib: fix compiler warnings after de4de4e3c7cMarcel Raad2016-11-181-1/+1
| | | | | | | | | Visual C++ now complains about implicitly casting time_t (64-bit) to long (32-bit). Fix this by changing some variables from long to time_t, or explicitly casting to long where the public interface would be affected. Closes #1131
* resolve: add error message when resolving using SIGALRMAndreas Streichardt2016-10-101-2/+5
| | | | Closes #1066
* internals: rename the SessionHandle struct to Curl_easyDaniel Stenberg2016-06-221-9/+9
|
* lib: include curl_printf.h as one of the last headersDaniel Stenberg2016-04-291-1/+1
| | | | | | | | | | | | | | | | | | | | curl_printf.h defines printf to curl_mprintf, etc. This can cause problems with external headers which may use __attribute__((format(printf, ...))) markers etc. To avoid that they cause problems with system includes, we include curl_printf.h after any system headers. That makes the three last headers to always be, and we keep them in this order: curl_printf.h curl_memory.h memdebug.h None of them include system headers, they all do funny #defines. Reported-by: David Benjamin Fixes #743
* code: style updatesDaniel Stenberg2016-04-031-1/+1
|
* hostip.c: minor white space edit for styleDaniel Stenberg2016-03-291-2/+3
|
* URLs: change all http:// URLs to https://Daniel Stenberg2016-02-031-1/+1
|
* hostip: fix unintended destruction of hash tableAnthony Avina2015-05-181-1/+1
| | | | .. and added unit1602 for hash.c
* hostcache: made all host caches use structs, not pointersDaniel Stenberg2015-05-121-3/+4
| | | | | | This avoids unnecessary dynamic allocs and as this also removed the last users of *hash_alloc() and *hash_destroy(), those two functions are now removed.
* hostip: fix compiler warningsDaniel Stenberg2015-04-031-36/+1
| | | | introduced in the previous mini-series of 3 commits
* actually implement CURLOPT_RESOLVE removalsStefan Bühler2015-04-031-4/+38
| | | | - also log when a CURLOPT_RESOLVE entry couldn't get parsed
* move Curl_share_lock and ref counting into Curl_fetch_addrStefan Bühler2015-04-031-20/+52
|
* fix refreshing of obsolete dns cache entriesStefan Bühler2015-04-031-38/+32
| | | | | | | | | | | | - cache entries must be also refreshed when they are in use - have the cache count as inuse reference too, freeing timestamp == 0 special value - use timestamp == 0 for CURLOPT_RESOLVE entries which don't get refreshed - remove CURLOPT_RESOLVE special inuse reference (timestamp == 0 will prevent refresh) - fix Curl_hostcache_clean - CURLOPT_RESOLVE entries don't have a special reference anymore, and it would also release non CURLOPT_RESOLVE references - fix locking in Curl_hostcache_clean - fix unit1305.c: hash now keeps a reference, need to set inuse = 1
* checksrc: use space after commaDaniel Stenberg2015-03-171-1/+1
|
* hostip: Fix signal race in Curl_resolv_timeout.Tobias Stoeckmann2015-03-141-26/+27
| | | | | | | | | | | | | | | | | | | A signal handler for SIGALRM is installed in Curl_resolv_timeout. It is configured to interrupt system calls and uses siglongjmp to return into the function if alarm() goes off. The signal handler is installed before curl_jmpenv is initialized. This means that an already installed alarm timer could trigger the newly installed signal handler, leading to undefined behavior when it accesses the uninitialized curl_jmpenv. Even if there is no previously installed alarm available, the code in Curl_resolv_timeout itself installs an alarm before the environment is fully set up. If the process is sent into suspend right after that, the signal handler could be called too early as in previous scenario. To fix this, the signal handler should only be installed and the alarm timer only be set after sigsetjmp has been called.
* mprintf.h: remove #ifdef CURLDEBUGDaniel Stenberg2015-03-031-4/+1
| | | | | ... and as a consequence, introduce curl_printf.h with that re-define magic instead and make all libcurl code use that instead.
* hostip: remove 'stale' argument from Curl_fetch_addr protoDaniel Stenberg2015-01-071-11/+10
| | | | | Also, remove the log output of the resolved name is NOT in the cache in the spirit of only telling when something is actually happening.
* code/docs: Use correct case for IPv4 and IPv6Steve Holme2014-12-271-2/+2
| | | | | | For consistency, as we seem to have a bit of a mixed bag, changed all instances of ipv4 and ipv6 in comments and documentations to use the correct case.
* resolve: cache lookup for async resolversMichael Wallner2014-08-311-23/+48
| | | | | | | | | | While waiting for a host resolve, check if the host cache may have gotten the name already (by someone else), for when the same name is resolved by several simultanoues requests. The resolver thread occasionally gets stuck in getaddrinfo() when the DNS or anything else is crappy or slow, so when a host is found in the DNS cache, leave the thread alone and let itself cleanup the mess.