curl/docs/libcurl/opts/CURLOPT_INTERFACE.3

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
2.8 KiB
Groff
Raw Normal View History

2014-06-18 19:18:58 +08:00
.\" **************************************************************************
.\" * _ _ ____ _
.\" * Project ___| | | | _ \| |
.\" * / __| | | | |_) | |
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
2014-06-18 19:18:58 +08:00
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
2020-11-04 21:02:01 +08:00
.\" * are also available at https://curl.se/docs/copyright.html.
2014-06-18 19:18:58 +08:00
.\" *
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
.\" * copies of the Software, and permit persons to whom the Software is
.\" * furnished to do so, under the terms of the COPYING file.
.\" *
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
.\" * KIND, either express or implied.
.\" *
.\" * SPDX-License-Identifier: curl
.\" *
2014-06-18 19:18:58 +08:00
.\" **************************************************************************
.\"
.TH CURLOPT_INTERFACE 3 "17 Jun 2014" libcurl libcurl
2014-06-18 19:18:58 +08:00
.SH NAME
CURLOPT_INTERFACE \- source interface for outgoing traffic
.SH SYNOPSIS
.nf
2014-06-18 19:18:58 +08:00
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERFACE, char *interface);
.fi
2014-06-18 19:18:58 +08:00
.SH DESCRIPTION
Pass a char * as parameter. This sets the \fIinterface\fP name to use as
outgoing network interface. The name can be an interface name, an IP address,
or a host name.
If the parameter starts with "if!" then it is treated only as an interface
name. If the parameter starts with \&"host!" it is treated as either an IP
address or a hostname.
KNOWN_BUGS: remove items not considered bugs any more - CURL_GLOBAL_SSL This option was changed in libcurl 7.57.0 and clearly it has not caused too many issues and a lot of time has passed. - Store TLS context per transfer instead of per connection This is a possible future optimization. One that is much less important and interesting since the added support for CA caching. - Microsoft telnet server This bug was filed in May 2007 against curl 7.16.1 and we have not received further reports. - active FTP over a SOCKS Actually, proxies in general is not working with active FTP mode. This is now added in proxy documentation. - DICT responses show the underlying protocol curl still does this, but since this is now an established behavior since forever we cannot change it easily and adding an option for it seems crazy as this protocol is not so little its not worth it. Let's just live with it. - Secure Transport disabling hostname validation also disables SNI This is an already documented restriction in Secure Transport. - CURLOPT_SEEKFUNCTION not called with CURLFORM_STREAM The curl_formadd() function is marked and documented as deprecated. No point in collecting bugs for it. It should not be used further. - STARTTRANSFER time is wrong for HTTP POSTs After close source code inspection I cannot see how this is true or that there is any special treatment for different HTTP methods. We also have not received many further reports on this, making me strongly suspect that this is no (longer an) issue. - multipart formposts file name encoding The once proposed RFC 5987-encoding is since RFC 7578 documented as MUST NOT be used. The since then implemented MIME API allows the user to set the name on their own and can thus provide it encoded as it wants. - DoH is not used for all name resolves when enabled It is questionable if users actually want to use DoH for interface and FTP port name resolving. This restriction is now documented and we advice users against using name resolving at all for these functions. Closes #10043
2022-12-06 20:00:35 +08:00
If "if!" is specified but the parameter does not match an existing interface,
\fICURLE_INTERFACE_FAILED\fP is returned from the libcurl function used to
perform the transfer.
libcurl does not support using network interface names for this option on
Windows.
KNOWN_BUGS: remove items not considered bugs any more - CURL_GLOBAL_SSL This option was changed in libcurl 7.57.0 and clearly it has not caused too many issues and a lot of time has passed. - Store TLS context per transfer instead of per connection This is a possible future optimization. One that is much less important and interesting since the added support for CA caching. - Microsoft telnet server This bug was filed in May 2007 against curl 7.16.1 and we have not received further reports. - active FTP over a SOCKS Actually, proxies in general is not working with active FTP mode. This is now added in proxy documentation. - DICT responses show the underlying protocol curl still does this, but since this is now an established behavior since forever we cannot change it easily and adding an option for it seems crazy as this protocol is not so little its not worth it. Let's just live with it. - Secure Transport disabling hostname validation also disables SNI This is an already documented restriction in Secure Transport. - CURLOPT_SEEKFUNCTION not called with CURLFORM_STREAM The curl_formadd() function is marked and documented as deprecated. No point in collecting bugs for it. It should not be used further. - STARTTRANSFER time is wrong for HTTP POSTs After close source code inspection I cannot see how this is true or that there is any special treatment for different HTTP methods. We also have not received many further reports on this, making me strongly suspect that this is no (longer an) issue. - multipart formposts file name encoding The once proposed RFC 5987-encoding is since RFC 7578 documented as MUST NOT be used. The since then implemented MIME API allows the user to set the name on their own and can thus provide it encoded as it wants. - DoH is not used for all name resolves when enabled It is questionable if users actually want to use DoH for interface and FTP port name resolving. This restriction is now documented and we advice users against using name resolving at all for these functions. Closes #10043
2022-12-06 20:00:35 +08:00
We strongly advise against specifying the interface with a hostname, as it
causes libcurl to do a blocking name resolve call to retrieve the IP
address. That name resolve operation does \fBnot\fP use DNS-over-HTTPS even if
KNOWN_BUGS: remove items not considered bugs any more - CURL_GLOBAL_SSL This option was changed in libcurl 7.57.0 and clearly it has not caused too many issues and a lot of time has passed. - Store TLS context per transfer instead of per connection This is a possible future optimization. One that is much less important and interesting since the added support for CA caching. - Microsoft telnet server This bug was filed in May 2007 against curl 7.16.1 and we have not received further reports. - active FTP over a SOCKS Actually, proxies in general is not working with active FTP mode. This is now added in proxy documentation. - DICT responses show the underlying protocol curl still does this, but since this is now an established behavior since forever we cannot change it easily and adding an option for it seems crazy as this protocol is not so little its not worth it. Let's just live with it. - Secure Transport disabling hostname validation also disables SNI This is an already documented restriction in Secure Transport. - CURLOPT_SEEKFUNCTION not called with CURLFORM_STREAM The curl_formadd() function is marked and documented as deprecated. No point in collecting bugs for it. It should not be used further. - STARTTRANSFER time is wrong for HTTP POSTs After close source code inspection I cannot see how this is true or that there is any special treatment for different HTTP methods. We also have not received many further reports on this, making me strongly suspect that this is no (longer an) issue. - multipart formposts file name encoding The once proposed RFC 5987-encoding is since RFC 7578 documented as MUST NOT be used. The since then implemented MIME API allows the user to set the name on their own and can thus provide it encoded as it wants. - DoH is not used for all name resolves when enabled It is questionable if users actually want to use DoH for interface and FTP port name resolving. This restriction is now documented and we advice users against using name resolving at all for these functions. Closes #10043
2022-12-06 20:00:35 +08:00
\fICURLOPT_DOH_URL(3)\fP is set.
The application does not have to keep the string around after setting this
option.
2014-06-18 19:18:58 +08:00
.SH DEFAULT
NULL, use whatever the TCP stack finds suitable
.SH PROTOCOLS
All
.SH EXAMPLE
.nf
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
curl_easy_setopt(curl, CURLOPT_INTERFACE, "eth0");
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
.fi
2014-06-18 19:18:58 +08:00
.SH AVAILABILITY
The "if!" and "host!" syntax was added in 7.24.0.
.SH RETURN VALUE
Returns CURLE_OK on success or
CURLE_OUT_OF_MEMORY if there was insufficient heap space.
2014-06-18 19:18:58 +08:00
.SH "SEE ALSO"
.BR CURLOPT_SOCKOPTFUNCTION "(3), " CURLOPT_TCP_NODELAY "(3), "