Lines Matching +full:pac +full:- +full:proxy +full:- +full:agent
1 ---
3 SPDX-License-Identifier: curl
4 Title: libcurl-tutorial
7 See-also:
8 - libcurl-easy (3)
9 - libcurl-errors (3)
10 - libcurl-multi (3)
11 - libcurl-url (3)
13 - All
14 ---
18 libcurl-tutorial - libcurl programming tutorial
46 installed them. The 'curl-config'[3] tool can be used to get this information:
48 $ curl-config --cflags
57 command line. To figure out which flags to use, once again the 'curl-config'
60 $ curl-config --libs
66 varies from different libraries and builds is the support for SSL-based
68 properly at build-time, libcurl is built with SSL support. To figure out if an
69 installed libcurl has been built with SSL support enabled, use *curl-config*
73 $ curl-config --feature
86 area. See docs/libcurl/libcurl.m4 file - it includes docs on how to use it.
122 which only does anything on libcurls compiled and built SSL-enabled. On these
143 It is considered best-practice to determine libcurl features at runtime rather
144 than at build-time (if possible of course). By calling
228 rare platform-dependent nitpicks. Did you spot it? On some platforms[2],
238 CURLOPT_WRITEFUNCTION(3) if you set CURLOPT_WRITEDATA(3) - or experience
272 # Multi-threading Issues
275 libcurl-thread(3) for more information.
281 does, or the remote server might return non-standard replies that confuse the
302 Getting some in-depth knowledge about the protocols involved is never wrong,
366 them URL encoded, as %XX where XX is a two-digit hexadecimal number.
378 users who need to authenticate themselves to a proxy they use. libcurl offers
394 non-FTP protocols such as HTTP. To make curl use this file, use the
425 method is called 'Basic', which is sending the name and password in clear-text
426 in the HTTP request, base64-encoded. This is insecure.
437 When you send authentication to a proxy, you can also set authentication type
445 to make libcurl pick the most secure one out of the types the server/proxy
446 claims to support. This method does however add a round-trip since libcurl
482 Content-Type: header of the post? Well, binary posts prevent libcurl from being
490 headers = curl_slist_append(headers, "Content-Type: text/xml");
507 POST operations are required, they do not do multi-part formposts. Multi-part
510 called multi-part because they are built by a chain of parts, each part being
512 fact create and post a multi-part formpost with the regular libcurl POST
517 functions: using those, you can create and fill a multi-part form. Function
518 curl_mime_init(3) creates a multi-part body; you can then append new parts
519 to a multi-part body using curl_mime_addpart(3).
522 curl_mime_data(3), file using curl_mime_filedata(3) and user-defined data
526 curl_mime_headers(3) allows defining the part's headers. When a multi-part
541 curl_mime_name(part, "logotype-image");
555 curl_mime_subparts(3) implements nested multi-parts, this way of
585 CURLFORM_COPYNAME, "logotype-image",
597 Multipart formposts are chains of parts using MIME-style separators and
599 that describe the individual content-type, size etc. To enable your
608 headers = curl_slist_append(headers, "Content-Type: text/xml");
611 CURLFORM_COPYNAME, "logotype-image",
635 Four rules have to be respected in building the multi-part:
637 - The easy handle must be created before building the multi-part.
639 - The multi-part is always created by a call to curl_mime_init(handle).
641 - Each part is created by a call to curl_mime_addpart(multipart).
643 - When complete, the multi-part must be bound to the easy handle using
664 the headers to be automatically released upon destroyed the multi-part, thus
665 saving a clean-up call to curl_slist_free_all(3).
669 CURLFORM_PTRNAME, "logotype-image",
670 CURLFORM_FILECONTENT, "-",
676 curl_mime_name(part, "logotype-image");
677 curl_mime_data_cb(part, (curl_off_t) -1, fread, fseek, NULL, stdin);
680 curl_mime_name(3) always copies the field name. The special filename "-" is
682 source using fread(). The transfer is be chunk-encoded since the data size is
766 For historical and traditional reasons, libcurl has a built-in progress meter
773 For most applications however, the built-in progress meter is useless and what
798 The callbacks CANNOT be non-static class member functions
814 What "proxy" means according to Merriam-Webster: "a person authorized to act
819 access to employees through their proxies. Network clients or user-agents ask
820 the proxy for documents, the proxy does the actual request and then it returns
824 asks the proxy for it instead of trying to connect to the actual remote host
827 If you are using a SOCKS proxy, you may find that libcurl does not quite support
830 For HTTP proxies: the fact that the proxy is an HTTP proxy puts certain
832 HTTP URL is passed to the HTTP proxy to deliver back to libcurl. This happens
834 at times it is important to understand that all operations over an HTTP proxy
838 ## Proxy Options
840 To tell libcurl to use a proxy at a given port number:
842 curl_easy_setopt(handle, CURLOPT_PROXY, "proxy-host.com:8080");
853 Tell libcurl what kind of proxy it is with CURLOPT_PROXYTYPE(3) (if not,
854 it defaults to assuming an HTTP proxy):
865 proxy to use when the input URL is HTTP. Following the same rule, the variable
870 The proxy environment variable contents should be in the format
872 specifies which type of proxy it is, and the optional port number specifies on
873 which port the proxy operates. If not specified, the internal default port
876 There are two special environment variables. 'all_proxy' is what sets proxy
878 defines a list of hosts that should not use a proxy even though a variable may
881 To explicitly disable libcurl's checking for and using the proxy environment
882 variables, set the proxy name to "" - an empty string - with
887 SSL is for secure point-to-point connections. This involves strong encryption
888 and similar things, which effectively makes it impossible for a proxy to
889 operate as a "man in between" which the proxy's task is, as previously
890 discussed. Instead, the only way to have SSL work over an HTTP proxy is to ask
891 the proxy to tunnel everything through without being able to check or fiddle
894 Opening an SSL connection over an HTTP proxy is therefore a matter of asking the
895 proxy for a straight connection to the target host on a specified port. This
896 is made with the HTTP request CONNECT. ("please dear proxy, connect me to that
899 Because of the nature of this operation, where the proxy has no idea what kind
901 few advantages that come from using a proxy, such as caching. Many
905 ## Tunneling Through Proxy
910 This is however not the only time proxy-tunneling might offer benefits to
914 machine, it suddenly also re-introduces the ability to do non-HTTP
915 operations over an HTTP proxy. You can in fact use things such as FTP
921 Tell libcurl to use proxy tunneling like this:
927 server instead of asking the proxy to do so. libcurl does not stand in the way
930 ## Proxy Auto-Config
933 .pac extension) with a JavaScript that when executed by the browser with the
935 to the URL. The returned information might be "DIRECT" (which means no proxy
936 should be used), "PROXY host:port" (to tell the browser where the proxy for
938 proxy).
944 - Depending on the JavaScript complexity, write up a script that translates it
947 - Read the JavaScript code and rewrite the same logic in another language.
949 - Implement a JavaScript interpreter; people have successfully used the
952 - Ask your admins to stop this, for a static proxy setup or similar.
956 Re-cycling the same easy handle several times when doing multiple requests is
966 re-connection time.
968 FTP connections that are kept alive save a lot of time, as the command-
969 response round-trips are skipped, and also you do not risk getting blocked
1009 When doing POST requests, libcurl sets this header to "100-continue" to ask
1018 reliable protocol that is widely deployed and has excellent proxy-support.
1043 HTTP-like protocols pass a series of headers to the server when doing the
1050 headers = curl_slist_append(headers, "Hey-server-hey: how are you?");
1051 headers = curl_slist_append(headers, "X-silly-content: yes");
1066 headers = curl_slist_append(headers, "Accept: Agent-007");
1083 ## Enforcing chunked transfer-encoding
1085 By making sure a request uses the custom header "Transfer-Encoding: chunked"
1086 when doing a non-GET HTTP operation, libcurl switches over to "chunked"
1095 getting 1.1-requests and when dealing with stubborn old things like that, you
1102 Not all protocols are HTTP-like, and thus the above may not help you when
1107 here), and you can only use commands that work on the control-connection
1109 data-connection must be left to libcurl's own judgment. Also be aware that
1118 headers = curl_slist_append(headers, "DELE file-to-remove");
1142 are in "HTTP-style", looking like they do in HTTP.
1163 In real-world cases, servers send new cookies to replace existing ones to
1166 Cookies are sent from server to clients with the header Set-Cookie: and
1203 file. We call that the cookie-jar. When you set a filename with
1218 best for all the people behind firewalls, NATs or IP-masquerading setups.
1231 with the CURLOPT_FTPPORT(3) option. If you set it to "-", libcurl uses your
1242 In addition to support HTTP multi-part form fields, the MIME API can be used
1248 multi-part, for example to include another email message or to offer several
1251 To build such a message, you prepare the nth-level multi-part and then include
1252 it as a source to the parent multi-part using function
1254 bound to its parent multi-part, a nth-level multi-part belongs to it and
1257 Email messages data is not supposed to be non-ascii and line length is
1263 use this function (this would over-encode it), but explicitly set the
1295 "Content-Disposition: inline");
1318 Some protocols provide "headers", meta-data separated from the normal
1336 actually true headers, but in this case we pretend they are! ;-)
1351 multi-threaded programs, but the truth is almost the reverse. The multi
1352 interface allows a single-threaded application to perform the same kinds of
1353 multiple, simultaneous transfers that multi-threaded programs can perform. It
1354 allows many of the benefits of multi-threaded transfers without the complexity
1359 designed for using with select(). See the libcurl-multi.3 man page for details
1391 what it wants to do. Take note that libcurl does also feature some time-out
1422 share a lot of the data that otherwise would be kept on a per-easy handle
1429 easy handles by using the share interface, see libcurl-share(3).
1439 Transfer-Encoding in cases where HTTP uploads are done with data of an unknown
1450 The curl-config tool is generated at build-time (on Unix-like systems) and