-
-
Save CMCDragonkai/48b0ec28c5325b1d815f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash | |
# this can be useful when developing against a custom DNS server, or | |
# for example, if you made a change to the DNS settings of a domain, and you | |
# know the authoritative nameserver IP address for a domain, you could use this | |
# to bypass the intermediate DNS cache, and apply an HTTP request using the new | |
# DNS settings supplied by your specified (authoritative) nameserver | |
curl --dns-servers <DNSIP,DNSIP> url.com | |
# acquire the authoritative nameserver IP using | |
dig url.com NS | |
# then ping the NS to get its IP address | |
# you can also directly resolve | |
curl \ | |
--resolve www.example.com:443:198.14.3.5 \ | |
https://www.example.com \ | |
--verbose |
For Mac and homebrew users: you can have brew compile curl for you with the --dns-servers option enabled via:
brew install curl --with-c-ares
For MacPorts users,
sudo port install curl +ares
to get this feature.
I got this error
A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.
I got this error
A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.
@SalimF do you happen to find any solution?
For Mac and homebrew users: you can have brew compile curl for you with the --dns-servers option enabled via:
brew install curl --with-c-ares
I got:
Error: invalid option: --with-c-ares
I think by now its brew install curl-openssl
I think by now its
brew install curl-openssl
upvote
@SalimF do you happen to find any solution?
I solve it by installing latest version my distro repository offers .
$ curl --version
curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1i zlib/1.2.11 libidn2/2.3.0 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Release-Date: 2018-01-24
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
I have the same issue - any ideas would be appreciated.
$ curl --dns-servers 96.7.136.168 www.google.com
curl: (4) A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision.
$ curl --version
curl 7.64.1 (x86_64-apple-darwin19.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.39.2
Release-Date: 2019-03-27
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets
brew install curl --with-c-ares
Usage: brew install [options] formula|cask [...]
Install a formula or cask. Additional options specific to a formula may be
appended to the command.
Unless HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set, brew upgrade or brew
reinstall will be run for outdated dependents and dependents with broken
linkage, respectively.
Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the installed formulae or, every 30 days, for all formulae.
Unless HOMEBREW_NO_INSTALL_UPGRADE is set, brew install formula will
upgrade formula if it is already installed but outdated.
-d, --debug If brewing fails, open an interactive
debugging session with access to IRB or a
shell inside the temporary build directory.
-f, --force Install formulae without checking for
previously installed keg-only or non-migrated
versions. When installing casks, overwrite
existing files (binaries and symlinks are
excluded, unless originally from the same
cask).
-v, --verbose Print the verification and postinstall steps.
--formula, --formulae Treat all named arguments as formulae.
--ignore-dependencies An unsupported Homebrew development flag to
skip installing any dependencies of any kind.
If the dependencies are not already present,
the formula will have issues. If you're not
developing Homebrew, consider adjusting your
PATH rather than using this flag.
--only-dependencies Install the dependencies with specified
options but do not install the formula
itself.
--cc Attempt to compile using the specified
compiler, which should be the name of the
compiler's executable, e.g. gcc-7 for GCC
7. In order to use LLVM's clang, specify
llvm_clang. To use the Apple-provided
clang, specify clang. This option will only
accept compilers that are provided by
Homebrew or bundled with macOS. Please do not
file issues if you encounter errors while
using this option.
-s, --build-from-source Compile formula from source even if a
bottle is provided. Dependencies will still
be installed from bottles if they are
available.
--force-bottle Install from a bottle if it exists for the
current or newest version of macOS, even if
it would not normally be used for
installation.
--include-test Install testing dependencies required to run
brew test formula.
--HEAD If formula defines it, install the HEAD
version, aka. main, trunk, unstable, master.
--fetch-HEAD Fetch the upstream repository to detect if
the HEAD installation of the formula is
outdated. Otherwise, the repository's HEAD
will only be checked for updates when a new
stable or development version has been
released.
--keep-tmp Retain the temporary files created during
installation.
--build-bottle Prepare the formula for eventual bottling
during installation, skipping any
post-install steps.
--bottle-arch Optimise bottles for the specified
architecture rather than the oldest
architecture supported by the version of
macOS the bottles are built on.
--display-times Print install times for each package at the
end of the run.
-i, --interactive Download and patch formula, then open a
shell. This allows the user to run
./configure --help and otherwise determine
how to turn the software package into a
Homebrew package.
-g, --git Create a Git repository, useful for creating
patches to the software.
--overwrite Delete files that already exist in the prefix
while linking.
--cask, --casks Treat all named arguments as casks.
--[no-]binaries Disable/enable linking of helper executables
(default: enabled).
--require-sha Require all casks to have a checksum.
--[no-]quarantine Disable/enable quarantining of downloads
(default: enabled).
--skip-cask-deps Skip installing cask dependencies.
--appdir Target location for Applications (default:
/Applications).
--colorpickerdir Target location for Color Pickers (default:
~/Library/ColorPickers).
--prefpanedir Target location for Preference Panes
(default: ~/Library/PreferencePanes).
--qlplugindir Target location for QuickLook Plugins
(default: ~/Library/QuickLook).
--mdimporterdir Target location for Spotlight Plugins
(default: ~/Library/Spotlight).
--dictionarydir Target location for Dictionaries (default:
~/Library/Dictionaries).
--fontdir Target location for Fonts (default:
~/Library/Fonts).
--servicedir Target location for Services (default:
~/Library/Services).
--input-methoddir Target location for Input Methods (default:
~/Library/Input Methods).
--internet-plugindir Target location for Internet Plugins
(default: ~/Library/Internet Plug-Ins).
--audio-unit-plugindir Target location for Audio Unit Plugins
(default:
~/Library/Audio/Plug-Ins/Components).
--vst-plugindir Target location for VST Plugins (default:
~/Library/Audio/Plug-Ins/VST).
--vst3-plugindir Target location for VST3 Plugins (default:
~/Library/Audio/Plug-Ins/VST3).
--screen-saverdir Target location for Screen Savers (default:
~/Library/Screen Savers).
--language Comma-separated list of language codes to
prefer for cask installation. The first
matching language is used, otherwise it
reverts to the cask's default language. The
default value is the language of your system.
-q, --quiet Make some output more quiet.
-h, --help Show this message.
Error: invalid option: --with-c-ares
MacPorts
thanks @patrick-webs
I am also hitting this limitation which is quite common and I found an alternative which is to use --resolve:
curl --resolve domain:port:ip url.com
Example, for https://www.google.com:
curl --resolve www.google.com:443:172.217.10.132 www.google.com