summaryrefslogtreecommitdiff
path: root/lib/hostip.c
Commit message (Collapse)AuthorAgeFilesLines
...
* hostip: on macOS avoid DoH when given a numerical IP addressDaniel Stenberg2020-05-261-6/+16
| | | | | | | | | When USE_RESOLVE_ON_IPS is set (defined on macOS), it means that numerical IP addresses still need to get "resolved" - but not with DoH. Reported-by: Viktor Szakats Fixes #5454 Closes #5459
* hostip: make Curl_printable_address not return anythingDaniel Stenberg2020-05-191-23/+20
| | | | | | | | | It was not used much anyway and instead we let it store a blank buffer in case of failure. Reported-by: MonocleAI Fixes #5411 Closes #5418
* source cleanup: remove all custom typedef structsDaniel Stenberg2020-05-151-11/+11
| | | | | | | | | | | - Stick to a single unified way to use structs - Make checksrc complain on 'typedef struct {' - Allow them in tests, public headers and examples - Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually typedef different types/structs depending on build conditions. Closes #5338
* conncache: various concept cleanupsDaniel Stenberg2020-04-301-5/+7
| | | | | | | | | | | | | | | | More connection cache accesses are protected by locks. CONNCACHE_* is a beter prefix for the connection cache lock macros. Curl_attach_connnection: now called as soon as there's a connection struct available and before the connection is added to the connection cache. Curl_disconnect: now assumes that the connection is already removed from the connection cache. Ref: #4915 Closes #5009
* socks: make the connect phase non-blockingDaniel Stenberg2020-02-171-12/+12
| | | | | | Removes two entries from KNOWN_BUGS. Closes #4907
* fix: Copyright year out of date, should be 2020Daniel Stenberg2020-01-101-1/+1
| | | | Follow-up to 875314ed0bf3b
* hostip: move code to resolve IP address literals to `Curl_resolv`Marcel Raad2020-01-101-17/+39
| | | | | | | | | | | | | | | | The code was duplicated in the various resolver backends. Also, it was called after the call to `Curl_ipvalid`, which matters in case of `CURLRES_IPV4` when called from `connect.c:bindlocal`. This caused test 1048 to fail on classic MinGW. The code ignores `conn->ip_version` as done previously in the individual resolver backends. Move the call to the `resolver_start` callback up to appease test 655, which wants it to be called also for literal addresses. Closes https://github.com/curl/curl/pull/4798
* hostip: suppress compiler warningMarcel Raad2019-12-131-0/+4
| | | | | | | With `--disable-doh --disable-threaded-resolver`, the `dns` parameter is not used. Closes https://github.com/curl/curl/pull/4692
* lib: silence conversion warningsMarcel Raad2019-10-011-1/+1
| | | | Closes https://github.com/curl/curl/pull/4444
* 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