Annotation of embedaddon/curl/docs/libcurl/opts/CURLOPT_CONNECT_TO.3, revision 1.1

1.1     ! misho       1: .\" **************************************************************************
        !             2: .\" *                                  _   _ ____  _
        !             3: .\" *  Project                     ___| | | |  _ \| |
        !             4: .\" *                             / __| | | | |_) | |
        !             5: .\" *                            | (__| |_| |  _ <| |___
        !             6: .\" *                             \___|\___/|_| \_\_____|
        !             7: .\" *
        !             8: .\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
        !             9: .\" *
        !            10: .\" * This software is licensed as described in the file COPYING, which
        !            11: .\" * you should have received as part of this distribution. The terms
        !            12: .\" * are also available at https://curl.haxx.se/docs/copyright.html.
        !            13: .\" *
        !            14: .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
        !            15: .\" * copies of the Software, and permit persons to whom the Software is
        !            16: .\" * furnished to do so, under the terms of the COPYING file.
        !            17: .\" *
        !            18: .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
        !            19: .\" * KIND, either express or implied.
        !            20: .\" *
        !            21: .\" **************************************************************************
        !            22: .\"
        !            23: .TH CURLOPT_CONNECT_TO 3 "March 23, 2020" "libcurl 7.70.0" "curl_easy_setopt options"
        !            24: 
        !            25: .SH NAME
        !            26: CURLOPT_CONNECT_TO \- Connect to a specific host and port instead of the URL's host and port
        !            27: .SH SYNOPSIS
        !            28: .nf
        !            29: #include <curl/curl.h>
        !            30: 
        !            31: CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECT_TO,
        !            32:                           struct curl_slist *connect_to);
        !            33: .fi
        !            34: .SH DESCRIPTION
        !            35: Pass a pointer to a linked list of strings with "connect to" information to
        !            36: use for establishing network connections with this handle. The linked list
        !            37: should be a fully valid list of \fBstruct curl_slist\fP structs properly
        !            38: filled in. Use \fIcurl_slist_append(3)\fP to create the list and
        !            39: \fIcurl_slist_free_all(3)\fP to clean up an entire list.
        !            40: 
        !            41: Each single string should be written using the format
        !            42: HOST:PORT:CONNECT-TO-HOST:CONNECT-TO-PORT where HOST is the host of the
        !            43: request, PORT is the port of the request, CONNECT-TO-HOST is the host name to
        !            44: connect to, and CONNECT-TO-PORT is the port to connect to.
        !            45: 
        !            46: The first string that matches the request's host and port is used.
        !            47: 
        !            48: Dotted numerical IP addresses are supported for HOST and CONNECT-TO-HOST.
        !            49: A numerical IPv6 address must be written within [brackets].
        !            50: 
        !            51: Any of the four values may be empty. When the HOST or PORT is empty, the host
        !            52: or port will always match (the request's host or port is ignored).
        !            53: When CONNECT-TO-HOST or CONNECT-TO-PORT is empty, the "connect to" feature
        !            54: will be disabled for the host or port, and the request's host or port will be
        !            55: used to establish the network connection.
        !            56: 
        !            57: This option is suitable to direct the request at a specific server, e.g. at a
        !            58: specific cluster node in a cluster of servers.
        !            59: 
        !            60: The "connect to" host and port are only used to establish the network
        !            61: connection. They do NOT affect the host and port that are used for TLS/SSL
        !            62: (e.g. SNI, certificate verification) or for the application protocols.
        !            63: 
        !            64: In contrast to \fICURLOPT_RESOLVE(3)\fP, the option
        !            65: \fICURLOPT_CONNECT_TO(3)\fP does not pre-populate the DNS cache and therefore
        !            66: it does not affect future transfers of other easy handles that have been added
        !            67: to the same multi handle.
        !            68: 
        !            69: The "connect to" host and port are ignored if they are equal to the host and
        !            70: the port in the request URL, because connecting to the host and the port in
        !            71: the request URL is the default behavior.
        !            72: 
        !            73: If an HTTP proxy is used for a request having a special "connect to" host or
        !            74: port, and the "connect to" host or port differs from the request's host and
        !            75: port, the HTTP proxy is automatically switched to tunnel mode for this
        !            76: specific request. This is necessary because it is not possible to connect to a
        !            77: specific host or port in normal (non-tunnel) mode.
        !            78: 
        !            79: When this option is passed to \fIcurl_easy_setopt(3)\fP, libcurl will not copy
        !            80: the entire list so you \fBmust\fP keep it around until you no longer use this
        !            81: \fIhandle\fP for a transfer before you call \fIcurl_slist_free_all(3)\fP on
        !            82: the list.
        !            83: 
        !            84: .SH DEFAULT
        !            85: NULL
        !            86: .SH PROTOCOLS
        !            87: All
        !            88: .SH EXAMPLE
        !            89: .nf
        !            90: CURL *curl;
        !            91: struct curl_slist *connect_to = NULL;
        !            92: connect_to = curl_slist_append(NULL, "example.com::server1.example.com:");
        !            93: 
        !            94: curl = curl_easy_init();
        !            95: if(curl) {
        !            96:   curl_easy_setopt(curl, CURLOPT_CONNECT_TO, connect_to);
        !            97:   curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
        !            98: 
        !            99:   curl_easy_perform(curl);
        !           100: 
        !           101:   /* always cleanup */
        !           102:   curl_easy_cleanup(curl);
        !           103: }
        !           104: 
        !           105: curl_slist_free_all(connect_to);
        !           106: .fi
        !           107: .SH AVAILABILITY
        !           108: Added in 7.49.0
        !           109: .SH RETURN VALUE
        !           110: Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
        !           111: .SH "SEE ALSO"
        !           112: .BR CURLOPT_URL "(3), " CURLOPT_RESOLVE "(3), " CURLOPT_FOLLOWLOCATION "(3), " CURLOPT_HTTPPROXYTUNNEL  "(3), "

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>